@@ -545,7 +545,7 @@ discard block  | 
                                                    ||
| 545 | 545 | *  | 
                                                        
| 546 | 546 | * @access public  | 
                                                        
| 547 | 547 | * @param string $CNT_ISO  | 
                                                        
| 548 | - * @return mixed string | array  | 
                                                        |
| 548 | + * @return string|null string | array  | 
                                                        |
| 549 | 549 | */  | 
                                                        
| 550 | 550 |  	public function display_country_settings( $CNT_ISO = '' ) { | 
                                                        
| 551 | 551 | |
@@ -708,7 +708,7 @@ discard block  | 
                                                    ||
| 708 | 708 | * delete_state  | 
                                                        
| 709 | 709 | *  | 
                                                        
| 710 | 710 | * @access public  | 
                                                        
| 711 | - * @return boolean | void  | 
                                                        |
| 711 | + * @return false|null | void  | 
                                                        |
| 712 | 712 | */  | 
                                                        
| 713 | 713 |  	public function delete_state() { | 
                                                        
| 714 | 714 | $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;  | 
                                                        
@@ -938,10 +938,10 @@ discard block  | 
                                                    ||
| 938 | 938 | /**  | 
                                                        
| 939 | 939 | * generates a dropdown of all parent pages - copied from WP core  | 
                                                        
| 940 | 940 | *  | 
                                                        
| 941 | - * @param unknown_type $default  | 
                                                        |
| 942 | - * @param unknown_type $parent  | 
                                                        |
| 943 | - * @param unknown_type $level  | 
                                                        |
| 944 | - * @return unknown  | 
                                                        |
| 941 | + * @param integer $default  | 
                                                        |
| 942 | + * @param integer $parent  | 
                                                        |
| 943 | + * @param integer $level  | 
                                                        |
| 944 | + * @return null|false  | 
                                                        |
| 945 | 945 | */  | 
                                                        
| 946 | 946 |  	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { | 
                                                        
| 947 | 947 | global $wpdb;  | 
                                                        
@@ -154,7 +154,7 @@ discard block  | 
                                                    ||
| 154 | 154 | 'order' => 50  | 
                                                        
| 155 | 155 | ),  | 
                                                        
| 156 | 156 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),  | 
                                                        
| 157 | - 'help_tabs' => array(  | 
                                                        |
| 157 | + 'help_tabs' => array(  | 
                                                        |
| 158 | 158 | 'general_settings_critical_pages_help_tab' => array(  | 
                                                        
| 159 | 159 |  						'title' => __('Critical Pages', 'event_espresso'), | 
                                                        
| 160 | 160 | 'filename' => 'general_settings_critical_pages'  | 
                                                        
@@ -168,7 +168,7 @@ discard block  | 
                                                    ||
| 168 | 168 |  					'label' => __('Your Organization', 'event_espresso'), | 
                                                        
| 169 | 169 | 'order' => 20  | 
                                                        
| 170 | 170 | ),  | 
                                                        
| 171 | - 'help_tabs' => array(  | 
                                                        |
| 171 | + 'help_tabs' => array(  | 
                                                        |
| 172 | 172 | 'general_settings_your_organization_help_tab' => array(  | 
                                                        
| 173 | 173 |  						'title' => __('Your Organization', 'event_espresso'), | 
                                                        
| 174 | 174 | 'filename' => 'general_settings_your_organization'  | 
                                                        
@@ -184,7 +184,7 @@ discard block  | 
                                                    ||
| 184 | 184 | 'order' => 60  | 
                                                        
| 185 | 185 | ),  | 
                                                        
| 186 | 186 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),  | 
                                                        
| 187 | - 'help_tabs' => array(  | 
                                                        |
| 187 | + 'help_tabs' => array(  | 
                                                        |
| 188 | 188 | 'general_settings_admin_options_help_tab' => array(  | 
                                                        
| 189 | 189 |  						'title' => __('Admin Options', 'event_espresso'), | 
                                                        
| 190 | 190 | 'filename' => 'general_settings_admin_options'  | 
                                                        
@@ -198,7 +198,7 @@ discard block  | 
                                                    ||
| 198 | 198 |  					'label' => __('Countries', 'event_espresso'), | 
                                                        
| 199 | 199 | 'order' => 70  | 
                                                        
| 200 | 200 | ),  | 
                                                        
| 201 | - 'help_tabs' => array(  | 
                                                        |
| 201 | + 'help_tabs' => array(  | 
                                                        |
| 202 | 202 | 'general_settings_countries_help_tab' => array(  | 
                                                        
| 203 | 203 |  						'title' => __('Countries', 'event_espresso'), | 
                                                        
| 204 | 204 | 'filename' => 'general_settings_countries'  | 
                                                        
@@ -1,6 +1,7 @@ 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 | 6 | /**  | 
                                                        
| 6 | 7 | * Event Espresso  | 
                                                        
@@ -419,8 +420,9 @@ discard block  | 
                                                    ||
| 419 | 420 | }  | 
                                                        
| 420 | 421 | |
| 421 | 422 |  	protected function _update_your_organization_settings() { | 
                                                        
| 422 | - if ( is_main_site() )  | 
                                                        |
| 423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;  | 
                                                        |
| 423 | +		if ( is_main_site() ) { | 
                                                        |
| 424 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;  | 
                                                        |
| 425 | + }  | 
                                                        |
| 424 | 426 | EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;  | 
                                                        
| 425 | 427 | EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;  | 
                                                        
| 426 | 428 | EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;  | 
                                                        
@@ -950,10 +952,11 @@ discard block  | 
                                                    ||
| 950 | 952 |  		if ( $items ) { | 
                                                        
| 951 | 953 |  			foreach ( $items as $item ) { | 
                                                        
| 952 | 954 | $pad = str_repeat( ' ', $level * 3 );  | 
                                                        
| 953 | - if ( $item->ID == $default)  | 
                                                        |
| 954 | - $current = ' selected="selected"';  | 
                                                        |
| 955 | - else  | 
                                                        |
| 956 | - $current = '';  | 
                                                        |
| 955 | +				if ( $item->ID == $default) { | 
                                                        |
| 956 | + $current = ' selected="selected"';  | 
                                                        |
| 957 | +				} else { | 
                                                        |
| 958 | + $current = '';  | 
                                                        |
| 959 | + }  | 
                                                        |
| 957 | 960 | |
| 958 | 961 | echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";  | 
                                                        
| 959 | 962 | parent_dropdown( $default, $item->ID, $level +1 );  | 
                                                        
@@ -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 | /**  | 
                                                        
@@ -40,8 +40,8 @@ discard block  | 
                                                    ||
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | |
| 43 | -	public function __construct( $routing = TRUE ) { | 
                                                        |
| 44 | - parent::__construct( $routing );  | 
                                                        |
| 43 | +	public function __construct($routing = TRUE) { | 
                                                        |
| 44 | + parent::__construct($routing);  | 
                                                        |
| 45 | 45 | }  | 
                                                        
| 46 | 46 | |
| 47 | 47 | |
@@ -57,10 +57,10 @@ discard block  | 
                                                    ||
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 |  	protected function _ajax_hooks() { | 
                                                        
| 60 | -		add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings')); | 
                                                        |
| 61 | -		add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states')); | 
                                                        |
| 62 | -		add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 ); | 
                                                        |
| 63 | -		add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state')); | 
                                                        |
| 60 | +		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); | 
                                                        |
| 61 | +		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); | 
                                                        |
| 62 | +		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); | 
                                                        |
| 63 | +		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); | 
                                                        |
| 64 | 64 | }  | 
                                                        
| 65 | 65 | |
| 66 | 66 | |
@@ -153,14 +153,14 @@ discard block  | 
                                                    ||
| 153 | 153 |  					'label' => __('Critical Pages', 'event_espresso'), | 
                                                        
| 154 | 154 | 'order' => 50  | 
                                                        
| 155 | 155 | ),  | 
                                                        
| 156 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),  | 
                                                        |
| 156 | +				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 157 | 157 | 'help_tabs' => array(  | 
                                                        
| 158 | 158 | 'general_settings_critical_pages_help_tab' => array(  | 
                                                        
| 159 | 159 |  						'title' => __('Critical Pages', 'event_espresso'), | 
                                                        
| 160 | 160 | 'filename' => 'general_settings_critical_pages'  | 
                                                        
| 161 | 161 | )  | 
                                                        
| 162 | 162 | ),  | 
                                                        
| 163 | - 'help_tour' => array( 'Critical_Pages_Help_Tour' ),  | 
                                                        |
| 163 | +				'help_tour' => array('Critical_Pages_Help_Tour'), | 
                                                        |
| 164 | 164 | 'require_nonce' => FALSE  | 
                                                        
| 165 | 165 | ),  | 
                                                        
| 166 | 166 | 'default' => array(  | 
                                                        
@@ -174,8 +174,8 @@ discard block  | 
                                                    ||
| 174 | 174 | 'filename' => 'general_settings_your_organization'  | 
                                                        
| 175 | 175 | )  | 
                                                        
| 176 | 176 | ),  | 
                                                        
| 177 | - 'help_tour' => array( 'Your_Organization_Help_Tour' ),  | 
                                                        |
| 178 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),  | 
                                                        |
| 177 | +				'help_tour' => array('Your_Organization_Help_Tour'), | 
                                                        |
| 178 | +				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 179 | 179 | 'require_nonce' => FALSE  | 
                                                        
| 180 | 180 | ),  | 
                                                        
| 181 | 181 | 'admin_option_settings' => array(  | 
                                                        
@@ -183,14 +183,14 @@ discard block  | 
                                                    ||
| 183 | 183 |  					'label' => __('Admin Options', 'event_espresso'), | 
                                                        
| 184 | 184 | 'order' => 60  | 
                                                        
| 185 | 185 | ),  | 
                                                        
| 186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),  | 
                                                        |
| 186 | +				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 187 | 187 | 'help_tabs' => array(  | 
                                                        
| 188 | 188 | 'general_settings_admin_options_help_tab' => array(  | 
                                                        
| 189 | 189 |  						'title' => __('Admin Options', 'event_espresso'), | 
                                                        
| 190 | 190 | 'filename' => 'general_settings_admin_options'  | 
                                                        
| 191 | 191 | )  | 
                                                        
| 192 | 192 | ),  | 
                                                        
| 193 | - 'help_tour' => array( 'Admin_Options_Help_Tour' ),  | 
                                                        |
| 193 | +				'help_tour' => array('Admin_Options_Help_Tour'), | 
                                                        |
| 194 | 194 | 'require_nonce' => FALSE  | 
                                                        
| 195 | 195 | ),  | 
                                                        
| 196 | 196 | 'country_settings' => array(  | 
                                                        
@@ -204,7 +204,7 @@ discard block  | 
                                                    ||
| 204 | 204 | 'filename' => 'general_settings_countries'  | 
                                                        
| 205 | 205 | )  | 
                                                        
| 206 | 206 | ),  | 
                                                        
| 207 | - 'help_tour' => array( 'Countries_Help_Tour' ),  | 
                                                        |
| 207 | +				'help_tour' => array('Countries_Help_Tour'), | 
                                                        |
| 208 | 208 | 'require_nonce' => FALSE  | 
                                                        
| 209 | 209 | )  | 
                                                        
| 210 | 210 | );  | 
                                                        
@@ -222,11 +222,11 @@ discard block  | 
                                                    ||
| 222 | 222 | }  | 
                                                        
| 223 | 223 | |
| 224 | 224 |  	public function admin_init() { | 
                                                        
| 225 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );  | 
                                                        |
| 226 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );  | 
                                                        |
| 227 | - EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' );  | 
                                                        |
| 228 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';  | 
                                                        |
| 229 | - EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol );  | 
                                                        |
| 225 | +		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); | 
                                                        |
| 226 | +		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); | 
                                                        |
| 227 | +		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso'); | 
                                                        |
| 228 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';  | 
                                                        |
| 229 | +		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol); | 
                                                        |
| 230 | 230 | }  | 
                                                        
| 231 | 231 | |
| 232 | 232 |  	public function admin_notices() {} | 
                                                        
@@ -239,21 +239,21 @@ discard block  | 
                                                    ||
| 239 | 239 | //scripts  | 
                                                        
| 240 | 240 |  		wp_enqueue_script('media-upload'); | 
                                                        
| 241 | 241 |  		wp_enqueue_script('thickbox'); | 
                                                        
| 242 | - wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );  | 
                                                        |
| 243 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );  | 
                                                        |
| 244 | - wp_enqueue_script( 'organization_settings' );  | 
                                                        |
| 245 | - wp_enqueue_style( 'organization-css' );  | 
                                                        |
| 246 | -		$confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); | 
                                                        |
| 247 | - wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );  | 
                                                        |
| 242 | +		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 243 | +		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 244 | +		wp_enqueue_script('organization_settings'); | 
                                                        |
| 245 | +		wp_enqueue_style('organization-css'); | 
                                                        |
| 246 | +		$confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); | 
                                                        |
| 247 | +		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); | 
                                                        |
| 248 | 248 | |
| 249 | 249 | }  | 
                                                        
| 250 | 250 | |
| 251 | 251 |  	public function load_scripts_styles_country_settings() { | 
                                                        
| 252 | 252 | //scripts  | 
                                                        
| 253 | - wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );  | 
                                                        |
| 254 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );  | 
                                                        |
| 255 | - wp_enqueue_script( 'gen_settings_countries' );  | 
                                                        |
| 256 | - wp_enqueue_style( 'organization-css' );  | 
                                                        |
| 253 | +		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 254 | +		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 255 | +		wp_enqueue_script('gen_settings_countries'); | 
                                                        |
| 256 | +		wp_enqueue_style('organization-css'); | 
                                                        |
| 257 | 257 | |
| 258 | 258 | }  | 
                                                        
| 259 | 259 | |
@@ -265,37 +265,37 @@ discard block  | 
                                                    ||
| 265 | 265 | |
| 266 | 266 | // Check to make sure all of the main pages are setup properly,  | 
                                                        
| 267 | 267 | // if not create the default pages and display an admin notice  | 
                                                        
| 268 | - EE_Registry::instance()->load_helper( 'Activation' );  | 
                                                        |
| 268 | +		EE_Registry::instance()->load_helper('Activation'); | 
                                                        |
| 269 | 269 | EEH_Activation::verify_default_pages_exist();  | 
                                                        
| 270 | 270 | |
| 271 | 271 | $this->_transient_garbage_collection();  | 
                                                        
| 272 | 272 | $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        
| 273 | 273 | |
| 274 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;  | 
                                                        |
| 275 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;  | 
                                                        |
| 274 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL;  | 
                                                        |
| 275 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;  | 
                                                        |
| 276 | 276 | |
| 277 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;  | 
                                                        |
| 278 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;  | 
                                                        |
| 277 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL;  | 
                                                        |
| 278 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;  | 
                                                        |
| 279 | 279 | |
| 280 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;  | 
                                                        |
| 281 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;  | 
                                                        |
| 280 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;  | 
                                                        |
| 281 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;  | 
                                                        |
| 282 | 282 | |
| 283 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;  | 
                                                        |
| 284 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;  | 
                                                        |
| 283 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL;  | 
                                                        |
| 284 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;  | 
                                                        |
| 285 | 285 | |
| 286 | - $this->_set_add_edit_form_tags( 'update_espresso_page_settings' );  | 
                                                        |
| 287 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );  | 
                                                        |
| 288 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );  | 
                                                        |
| 286 | +		$this->_set_add_edit_form_tags('update_espresso_page_settings'); | 
                                                        |
| 287 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);  | 
                                                        |
| 288 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);  | 
                                                        |
| 289 | 289 | $this->display_admin_page_with_sidebar();  | 
                                                        
| 290 | 290 | |
| 291 | 291 | }  | 
                                                        
| 292 | 292 | |
| 293 | 293 |  	protected function _update_espresso_page_settings() { | 
                                                        
| 294 | 294 | // capture incoming request data  | 
                                                        
| 295 | - $reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;  | 
                                                        |
| 296 | - $txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;  | 
                                                        |
| 297 | - $thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;  | 
                                                        |
| 298 | - $cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;  | 
                                                        |
| 295 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;  | 
                                                        |
| 296 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;  | 
                                                        |
| 297 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;  | 
                                                        |
| 298 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;  | 
                                                        |
| 299 | 299 | // pack critical_pages into an array  | 
                                                        
| 300 | 300 | $critical_pages = array(  | 
                                                        
| 301 | 301 | 'reg_page_id' => $reg_page_id,  | 
                                                        
@@ -303,17 +303,17 @@ discard block  | 
                                                    ||
| 303 | 303 | 'thank_you_page_id' => $thank_you_page_id,  | 
                                                        
| 304 | 304 | 'cancel_page_id' => $cancel_page_id  | 
                                                        
| 305 | 305 | );  | 
                                                        
| 306 | -		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) { | 
                                                        |
| 306 | +		foreach ($critical_pages as $critical_page_name => $critical_page_id) { | 
                                                        |
| 307 | 307 | // has the page changed ?  | 
                                                        
| 308 | -			if ( EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id ) { | 
                                                        |
| 308 | +			if (EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id) { | 
                                                        |
| 309 | 309 | // grab post object for old page  | 
                                                        
| 310 | - $post = get_post( EE_Registry::instance()->CFG->core->$critical_page_name );  | 
                                                        |
| 310 | + $post = get_post(EE_Registry::instance()->CFG->core->$critical_page_name);  | 
                                                        |
| 311 | 311 | // update post shortcodes for old page  | 
                                                        
| 312 | - EE_Admin::parse_post_content_on_save( $critical_page_id, $post );  | 
                                                        |
| 312 | + EE_Admin::parse_post_content_on_save($critical_page_id, $post);  | 
                                                        |
| 313 | 313 | // grab post object for new page  | 
                                                        
| 314 | - $post = get_post( $critical_page_id );  | 
                                                        |
| 314 | + $post = get_post($critical_page_id);  | 
                                                        |
| 315 | 315 | // update post shortcodes for new page  | 
                                                        
| 316 | - EE_Admin::parse_post_content_on_save( $critical_page_id, $post );  | 
                                                        |
| 316 | + EE_Admin::parse_post_content_on_save($critical_page_id, $post);  | 
                                                        |
| 317 | 317 | }  | 
                                                        
| 318 | 318 | }  | 
                                                        
| 319 | 319 | // set page IDs  | 
                                                        
@@ -322,14 +322,14 @@ discard block  | 
                                                    ||
| 322 | 322 | EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;  | 
                                                        
| 323 | 323 | EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;  | 
                                                        
| 324 | 324 | |
| 325 | - EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );  | 
                                                        |
| 325 | +		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data); | 
                                                        |
| 326 | 326 | |
| 327 | 327 |  		$what = __('Critical Pages & Shortcodes', 'event_espresso'); | 
                                                        
| 328 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 328 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 329 | 329 | $query_args = array(  | 
                                                        
| 330 | 330 | 'action' => 'critical_pages'  | 
                                                        
| 331 | 331 | );  | 
                                                        
| 332 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 332 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 333 | 333 | |
| 334 | 334 | }  | 
                                                        
| 335 | 335 | |
@@ -344,35 +344,35 @@ discard block  | 
                                                    ||
| 344 | 344 | |
| 345 | 345 |  	protected function _your_organization_settings() { | 
                                                        
| 346 | 346 | |
| 347 | - $this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';  | 
                                                        |
| 348 | - $this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';  | 
                                                        |
| 349 | - $this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';  | 
                                                        |
| 350 | - $this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';  | 
                                                        |
| 351 | - $this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';  | 
                                                        |
| 352 | - $this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';  | 
                                                        |
| 353 | - $this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';  | 
                                                        |
| 354 | - $this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';  | 
                                                        |
| 355 | - $this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';  | 
                                                        |
| 356 | - $this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';  | 
                                                        |
| 357 | - $this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;  | 
                                                        |
| 358 | - $this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';  | 
                                                        |
| 359 | - $this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';  | 
                                                        |
| 360 | - $this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';  | 
                                                        |
| 361 | - $this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';  | 
                                                        |
| 362 | - $this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';  | 
                                                        |
| 363 | - $this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';  | 
                                                        |
| 347 | +		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; | 
                                                        |
| 348 | +		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; | 
                                                        |
| 349 | +		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; | 
                                                        |
| 350 | +		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; | 
                                                        |
| 351 | +		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; | 
                                                        |
| 352 | +		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; | 
                                                        |
| 353 | +		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; | 
                                                        |
| 354 | +		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; | 
                                                        |
| 355 | +		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; | 
                                                        |
| 356 | +		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; | 
                                                        |
| 357 | +		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE; | 
                                                        |
| 358 | +		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; | 
                                                        |
| 359 | +		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; | 
                                                        |
| 360 | +		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; | 
                                                        |
| 361 | +		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; | 
                                                        |
| 362 | +		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; | 
                                                        |
| 363 | +		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; | 
                                                        |
| 364 | 364 | //UXIP settings  | 
                                                        
| 365 | - $this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;  | 
                                                        |
| 365 | +		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE; | 
                                                        |
| 366 | 366 | |
| 367 | - EE_Registry::instance()->load_helper( 'Form_Fields' );  | 
                                                        |
| 368 | - $STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;  | 
                                                        |
| 367 | +		EE_Registry::instance()->load_helper('Form_Fields'); | 
                                                        |
| 368 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;  | 
                                                        |
| 369 | 369 | $this->_template_args['states'] = new EE_Question_Form_Input(  | 
                                                        
| 370 | - EE_Question::new_instance ( array(  | 
                                                        |
| 370 | + EE_Question::new_instance(array(  | 
                                                        |
| 371 | 371 | 'QST_ID'=> 0,  | 
                                                        
| 372 | 372 |  					'QST_display_text'=> __('State/Province', 'event_espresso'), | 
                                                        
| 373 | 373 | 'QST_system'=>'admin-state'  | 
                                                        
| 374 | 374 | )),  | 
                                                        
| 375 | - EE_Answer::new_instance ( array(  | 
                                                        |
| 375 | + EE_Answer::new_instance(array(  | 
                                                        |
| 376 | 376 | 'ANS_ID' => 0,  | 
                                                        
| 377 | 377 | 'ANS_value' => $STA_ID  | 
                                                        
| 378 | 378 | )),  | 
                                                        
@@ -384,14 +384,14 @@ discard block  | 
                                                    ||
| 384 | 384 | )  | 
                                                        
| 385 | 385 | );  | 
                                                        
| 386 | 386 | |
| 387 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';  | 
                                                        |
| 387 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';  | 
                                                        |
| 388 | 388 | $this->_template_args['countries'] = new EE_Question_Form_Input(  | 
                                                        
| 389 | - EE_Question::new_instance ( array(  | 
                                                        |
| 389 | + EE_Question::new_instance(array(  | 
                                                        |
| 390 | 390 | 'QST_ID'=> 0,  | 
                                                        
| 391 | 391 |  					'QST_display_text'=> __('Country', 'event_espresso'), | 
                                                        
| 392 | 392 | 'QST_system'=>'admin-country'  | 
                                                        
| 393 | 393 | )),  | 
                                                        
| 394 | - EE_Answer::new_instance ( array(  | 
                                                        |
| 394 | + EE_Answer::new_instance(array(  | 
                                                        |
| 395 | 395 | 'ANS_ID' => 0,  | 
                                                        
| 396 | 396 | 'ANS_value' => $CNT_ISO  | 
                                                        
| 397 | 397 | )),  | 
                                                        
@@ -403,51 +403,51 @@ discard block  | 
                                                    ||
| 403 | 403 | )  | 
                                                        
| 404 | 404 | );  | 
                                                        
| 405 | 405 | |
| 406 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );  | 
                                                        |
| 407 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );  | 
                                                        |
| 406 | +		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); | 
                                                        |
| 407 | +		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); | 
                                                        |
| 408 | 408 | |
| 409 | 409 | //PUE verification stuff  | 
                                                        
| 410 | - $ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );  | 
                                                        |
| 411 | - $verify_fail = get_option( $ver_option_key );  | 
                                                        |
| 412 | - $this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';  | 
                                                        |
| 410 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);  | 
                                                        |
| 411 | + $verify_fail = get_option($ver_option_key);  | 
                                                        |
| 412 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';  | 
                                                        |
| 413 | 413 | |
| 414 | - $this->_set_add_edit_form_tags( 'update_your_organization_settings' );  | 
                                                        |
| 415 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );  | 
                                                        |
| 416 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );  | 
                                                        |
| 414 | +		$this->_set_add_edit_form_tags('update_your_organization_settings'); | 
                                                        |
| 415 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);  | 
                                                        |
| 416 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);  | 
                                                        |
| 417 | 417 | |
| 418 | 418 | $this->display_admin_page_with_sidebar();  | 
                                                        
| 419 | 419 | }  | 
                                                        
| 420 | 420 | |
| 421 | 421 |  	protected function _update_your_organization_settings() { | 
                                                        
| 422 | - if ( is_main_site() )  | 
                                                        |
| 423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;  | 
                                                        |
| 424 | - EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;  | 
                                                        |
| 425 | - EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;  | 
                                                        |
| 426 | - EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;  | 
                                                        |
| 427 | - EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city;  | 
                                                        |
| 428 | - EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID;  | 
                                                        |
| 429 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO;  | 
                                                        |
| 430 | - EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip;  | 
                                                        |
| 431 | - EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email;  | 
                                                        |
| 432 | - EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat;  | 
                                                        |
| 433 | - EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone;  | 
                                                        |
| 434 | - EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url;  | 
                                                        |
| 435 | - EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook;  | 
                                                        |
| 436 | - EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter;  | 
                                                        |
| 437 | - EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin;  | 
                                                        |
| 438 | - EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest;  | 
                                                        |
| 439 | - EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google;  | 
                                                        |
| 440 | - EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram;  | 
                                                        |
| 441 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;  | 
                                                        |
| 442 | -  | 
                                                        |
| 443 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );  | 
                                                        |
| 444 | -  | 
                                                        |
| 445 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );  | 
                                                        |
| 422 | + if (is_main_site())  | 
                                                        |
| 423 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;  | 
                                                        |
| 424 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;  | 
                                                        |
| 425 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;  | 
                                                        |
| 426 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;  | 
                                                        |
| 427 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;  | 
                                                        |
| 428 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;  | 
                                                        |
| 429 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;  | 
                                                        |
| 430 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;  | 
                                                        |
| 431 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;  | 
                                                        |
| 432 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;  | 
                                                        |
| 433 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;  | 
                                                        |
| 434 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;  | 
                                                        |
| 435 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;  | 
                                                        |
| 436 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;  | 
                                                        |
| 437 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;  | 
                                                        |
| 438 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;  | 
                                                        |
| 439 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;  | 
                                                        |
| 440 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;  | 
                                                        |
| 441 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;  | 
                                                        |
| 442 | +  | 
                                                        |
| 443 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);  | 
                                                        |
| 444 | +  | 
                                                        |
| 445 | +		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG); | 
                                                        |
| 446 | 446 | |
| 447 | 447 | $what = 'Your Organization Settings';  | 
                                                        
| 448 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 448 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 449 | 449 | |
| 450 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );  | 
                                                        |
| 450 | +		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); | 
                                                        |
| 451 | 451 | |
| 452 | 452 | }  | 
                                                        
| 453 | 453 | |
@@ -458,36 +458,36 @@ discard block  | 
                                                    ||
| 458 | 458 |  	protected function _admin_option_settings() { | 
                                                        
| 459 | 459 | |
| 460 | 460 | $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        
| 461 | - $this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE;  | 
                                                        |
| 462 | - $this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE;  | 
                                                        |
| 463 | - $this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30;  | 
                                                        |
| 464 | - $this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE;  | 
                                                        |
| 465 | - $this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE;  | 
                                                        |
| 466 | -		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; | 
                                                        |
| 467 | - $this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1;  | 
                                                        |
| 468 | -  | 
                                                        |
| 469 | - $this->_set_add_edit_form_tags( 'update_admin_option_settings' );  | 
                                                        |
| 470 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );  | 
                                                        |
| 461 | + $this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE;  | 
                                                        |
| 462 | + $this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE;  | 
                                                        |
| 463 | + $this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30;  | 
                                                        |
| 464 | + $this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE;  | 
                                                        |
| 465 | + $this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE;  | 
                                                        |
| 466 | +		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; | 
                                                        |
| 467 | + $this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1;  | 
                                                        |
| 468 | +  | 
                                                        |
| 469 | +		$this->_set_add_edit_form_tags('update_admin_option_settings'); | 
                                                        |
| 470 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);  | 
                                                        |
| 471 | 471 | $this->_template_args['template_args'] = $this->_template_args;  | 
                                                        
| 472 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );  | 
                                                        |
| 472 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);  | 
                                                        |
| 473 | 473 | $this->display_admin_page_with_sidebar();  | 
                                                        
| 474 | 474 | }  | 
                                                        
| 475 | 475 | |
| 476 | 476 |  	protected function _update_admin_option_settings() { | 
                                                        
| 477 | - EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager;  | 
                                                        |
| 478 | - EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;  | 
                                                        |
| 479 | - EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard;  | 
                                                        |
| 480 | - EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones;  | 
                                                        |
| 481 | - EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer;  | 
                                                        |
| 482 | - EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id;  | 
                                                        |
| 483 | - EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation;  | 
                                                        |
| 477 | + EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager;  | 
                                                        |
| 478 | + EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;  | 
                                                        |
| 479 | + EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard;  | 
                                                        |
| 480 | + EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones;  | 
                                                        |
| 481 | + EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer;  | 
                                                        |
| 482 | + EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id;  | 
                                                        |
| 483 | + EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation;  | 
                                                        |
| 484 | 484 | |
| 485 | - EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );  | 
                                                        |
| 485 | +		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin); | 
                                                        |
| 486 | 486 | |
| 487 | 487 | $what = 'Admin Options';  | 
                                                        
| 488 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 489 | - $success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );  | 
                                                        |
| 490 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );  | 
                                                        |
| 488 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 489 | +		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success); | 
                                                        |
| 490 | +		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings')); | 
                                                        |
| 491 | 491 | |
| 492 | 492 | }  | 
                                                        
| 493 | 493 | |
@@ -500,21 +500,21 @@ discard block  | 
                                                    ||
| 500 | 500 | |
| 501 | 501 |  	protected function _country_settings() { | 
                                                        
| 502 | 502 | |
| 503 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';  | 
                                                        |
| 504 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;  | 
                                                        |
| 503 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';  | 
                                                        |
| 504 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;  | 
                                                        |
| 505 | 505 | |
| 506 | 506 | //load field generator helper  | 
                                                        
| 507 | - EE_Registry::instance()->load_helper( 'Form_Fields' );  | 
                                                        |
| 507 | +		EE_Registry::instance()->load_helper('Form_Fields'); | 
                                                        |
| 508 | 508 | |
| 509 | 509 | $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        
| 510 | 510 | |
| 511 | 511 | $this->_template_args['countries'] = new EE_Question_Form_Input(  | 
                                                        
| 512 | - EE_Question::new_instance ( array(  | 
                                                        |
| 512 | + EE_Question::new_instance(array(  | 
                                                        |
| 513 | 513 | 'QST_ID'=> 0,  | 
                                                        
| 514 | 514 |  					'QST_display_text'=> __('Select Country', 'event_espresso'), | 
                                                        
| 515 | 515 | 'QST_system'=>'admin-country'  | 
                                                        
| 516 | 516 | )),  | 
                                                        
| 517 | - EE_Answer::new_instance ( array(  | 
                                                        |
| 517 | + EE_Answer::new_instance(array(  | 
                                                        |
| 518 | 518 | 'ANS_ID' => 0,  | 
                                                        
| 519 | 519 | 'ANS_value' => $CNT_ISO  | 
                                                        
| 520 | 520 | )),  | 
                                                        
@@ -527,14 +527,14 @@ discard block  | 
                                                    ||
| 527 | 527 | );  | 
                                                        
| 528 | 528 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 529 | 529 | |
| 530 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );  | 
                                                        |
| 531 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );  | 
                                                        |
| 530 | +		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); | 
                                                        |
| 531 | +		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); | 
                                                        |
| 532 | 532 | $this->_template_args['country_details_settings'] = $this->display_country_settings();  | 
                                                        
| 533 | 533 | $this->_template_args['country_states_settings'] = $this->display_country_states();  | 
                                                        
| 534 | 534 | |
| 535 | - $this->_set_add_edit_form_tags( 'update_country_settings' );  | 
                                                        |
| 536 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );  | 
                                                        |
| 537 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );  | 
                                                        |
| 535 | +		$this->_set_add_edit_form_tags('update_country_settings'); | 
                                                        |
| 536 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);  | 
                                                        |
| 537 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);  | 
                                                        |
| 538 | 538 | $this->display_admin_page_with_no_sidebar();  | 
                                                        
| 539 | 539 | }  | 
                                                        
| 540 | 540 | |
@@ -547,44 +547,44 @@ discard block  | 
                                                    ||
| 547 | 547 | * @param string $CNT_ISO  | 
                                                        
| 548 | 548 | * @return mixed string | array  | 
                                                        
| 549 | 549 | */  | 
                                                        
| 550 | -	public function display_country_settings( $CNT_ISO = '' ) { | 
                                                        |
| 550 | +	public function display_country_settings($CNT_ISO = '') { | 
                                                        |
| 551 | 551 | |
| 552 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;  | 
                                                        |
| 553 | -		if ( ! $CNT_ISO ) { | 
                                                        |
| 552 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;  | 
                                                        |
| 553 | +		if ( ! $CNT_ISO) { | 
                                                        |
| 554 | 554 | return '';  | 
                                                        
| 555 | 555 | }  | 
                                                        
| 556 | 556 | |
| 557 | 557 | // for ajax  | 
                                                        
| 558 | - EE_Registry::instance()->load_helper( 'Form_Fields' );  | 
                                                        |
| 559 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );  | 
                                                        |
| 560 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );  | 
                                                        |
| 561 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );  | 
                                                        |
| 562 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );  | 
                                                        |
| 563 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );  | 
                                                        |
| 558 | +		EE_Registry::instance()->load_helper('Form_Fields'); | 
                                                        |
| 559 | +		remove_all_filters('FHEE__EEH_Form_Fields__label_html'); | 
                                                        |
| 560 | +		remove_all_filters('FHEE__EEH_Form_Fields__input_html'); | 
                                                        |
| 561 | +		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); | 
                                                        |
| 562 | +		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); | 
                                                        |
| 563 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);  | 
                                                        |
| 564 | 564 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 565 | 565 | $country_input_types = array(  | 
                                                        
| 566 | - 'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),  | 
                                                        |
| 567 | - 'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),  | 
                                                        |
| 568 | - 'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),  | 
                                                        |
| 569 | - 'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),  | 
                                                        |
| 570 | - 'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),  | 
                                                        |
| 571 | - 'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),  | 
                                                        |
| 572 | - 'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),  | 
                                                        |
| 573 | - 'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),  | 
                                                        |
| 574 | - 'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),  | 
                                                        |
| 575 | - 'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),  | 
                                                        |
| 576 | - 'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))),  | 
                                                        |
| 577 | -			'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), | 
                                                        |
| 578 | -			'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), | 
                                                        |
| 579 | - 'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),  | 
                                                        |
| 580 | - 'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE )  | 
                                                        |
| 566 | +			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), | 
                                                        |
| 567 | +			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), | 
                                                        |
| 568 | +			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), | 
                                                        |
| 569 | +			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), | 
                                                        |
| 570 | +			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'), | 
                                                        |
| 571 | +			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), | 
                                                        |
| 572 | +			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), | 
                                                        |
| 573 | +			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), | 
                                                        |
| 574 | +			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE), | 
                                                        |
| 575 | +			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), | 
                                                        |
| 576 | +			'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))), | 
                                                        |
| 577 | +			'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), | 
                                                        |
| 578 | +			'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), | 
                                                        |
| 579 | +			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), | 
                                                        |
| 580 | +			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE) | 
                                                        |
| 581 | 581 | );  | 
                                                        
| 582 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );  | 
                                                        |
| 583 | - $country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );  | 
                                                        |
| 582 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);  | 
                                                        |
| 583 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);  | 
                                                        |
| 584 | 584 | |
| 585 | -		if ( defined( 'DOING_AJAX' )) { | 
                                                        |
| 586 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE );  | 
                                                        |
| 587 | - echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));  | 
                                                        |
| 585 | +		if (defined('DOING_AJAX')) { | 
                                                        |
| 586 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE);  | 
                                                        |
| 587 | +			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); | 
                                                        |
| 588 | 588 | die();  | 
                                                        
| 589 | 589 |  		} else { | 
                                                        
| 590 | 590 | return $country_details_settings;  | 
                                                        
@@ -602,50 +602,50 @@ discard block  | 
                                                    ||
| 602 | 602 | * @param string $CNT_ISO  | 
                                                        
| 603 | 603 | * @return string  | 
                                                        
| 604 | 604 | */  | 
                                                        
| 605 | -	public function display_country_states( $CNT_ISO = '' ) { | 
                                                        |
| 605 | +	public function display_country_states($CNT_ISO = '') { | 
                                                        |
| 606 | 606 | |
| 607 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;  | 
                                                        |
| 607 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;  | 
                                                        |
| 608 | 608 | |
| 609 | -		if ( ! $CNT_ISO ) { | 
                                                        |
| 609 | +		if ( ! $CNT_ISO) { | 
                                                        |
| 610 | 610 | return '';  | 
                                                        
| 611 | 611 | }  | 
                                                        
| 612 | 612 | // for ajax  | 
                                                        
| 613 | - EE_Registry::instance()->load_helper( 'Form_Fields' );  | 
                                                        |
| 614 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );  | 
                                                        |
| 615 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );  | 
                                                        |
| 616 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );  | 
                                                        |
| 617 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );  | 
                                                        |
| 618 | - $states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));  | 
                                                        |
| 613 | +		EE_Registry::instance()->load_helper('Form_Fields'); | 
                                                        |
| 614 | +		remove_all_filters('FHEE__EEH_Form_Fields__label_html'); | 
                                                        |
| 615 | +		remove_all_filters('FHEE__EEH_Form_Fields__input_html'); | 
                                                        |
| 616 | +		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); | 
                                                        |
| 617 | +		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); | 
                                                        |
| 618 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));  | 
                                                        |
| 619 | 619 | |
| 620 | 620 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';  | 
                                                        
| 621 | 621 | // global $wpdb;  | 
                                                        
| 622 | 622 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';  | 
                                                        
| 623 | 623 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 624 | -		if ( $states ) { | 
                                                        |
| 625 | -			foreach ( $states as $STA_ID => $state ) { | 
                                                        |
| 626 | -				if ( $state instanceof EE_State ) { | 
                                                        |
| 624 | +		if ($states) { | 
                                                        |
| 625 | +			foreach ($states as $STA_ID => $state) { | 
                                                        |
| 626 | +				if ($state instanceof EE_State) { | 
                                                        |
| 627 | 627 | //STA_abbrev STA_name STA_active  | 
                                                        
| 628 | 628 | $state_input_types = array(  | 
                                                        
| 629 | - 'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),  | 
                                                        |
| 630 | - 'STA_name' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),  | 
                                                        |
| 631 | - 'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )  | 
                                                        |
| 629 | +						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'), | 
                                                        |
| 630 | +						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'), | 
                                                        |
| 631 | +						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true) | 
                                                        |
| 632 | 632 | );  | 
                                                        
| 633 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );  | 
                                                        |
| 634 | - $query_args = array( 'action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );  | 
                                                        |
| 635 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );  | 
                                                        |
| 633 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);  | 
                                                        |
| 634 | +					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev()); | 
                                                        |
| 635 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);  | 
                                                        |
| 636 | 636 | }  | 
                                                        
| 637 | 637 | }  | 
                                                        
| 638 | 638 |  		} else { | 
                                                        
| 639 | 639 | $this->_template_args['states'] = FALSE;  | 
                                                        
| 640 | 640 | }  | 
                                                        
| 641 | 641 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 642 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ), GEN_SET_ADMIN_URL );  | 
                                                        |
| 642 | +		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL); | 
                                                        |
| 643 | 643 | |
| 644 | - $state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );  | 
                                                        |
| 644 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);  | 
                                                        |
| 645 | 645 | |
| 646 | -		if ( defined( 'DOING_AJAX' )) { | 
                                                        |
| 647 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE );  | 
                                                        |
| 648 | - echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));  | 
                                                        |
| 646 | +		if (defined('DOING_AJAX')) { | 
                                                        |
| 647 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE);  | 
                                                        |
| 648 | +			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); | 
                                                        |
| 649 | 649 | die();  | 
                                                        
| 650 | 650 |  		} else { | 
                                                        
| 651 | 651 | return $state_details_settings;  | 
                                                        
@@ -666,40 +666,39 @@ discard block  | 
                                                    ||
| 666 | 666 | |
| 667 | 667 | $success = TRUE;  | 
                                                        
| 668 | 668 | |
| 669 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;  | 
                                                        |
| 670 | -		if ( ! $CNT_ISO ) { | 
                                                        |
| 671 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 669 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;  | 
                                                        |
| 670 | +		if ( ! $CNT_ISO) { | 
                                                        |
| 671 | +			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 672 | 672 | $success = FALSE;  | 
                                                        
| 673 | 673 | }  | 
                                                        
| 674 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;  | 
                                                        |
| 675 | -		if ( ! $STA_abbrev ) { | 
                                                        |
| 676 | - EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 674 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;  | 
                                                        |
| 675 | +		if ( ! $STA_abbrev) { | 
                                                        |
| 676 | +			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 677 | 677 | $success = FALSE;  | 
                                                        
| 678 | 678 | }  | 
                                                        
| 679 | - $STA_name = isset( $this->_req_data['STA_name'] ) ? sanitize_text_field( $this->_req_data['STA_name'] ) :  | 
                                                        |
| 680 | - FALSE;  | 
                                                        |
| 681 | -		if ( ! $STA_name ) { | 
                                                        |
| 682 | - EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 679 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE;  | 
                                                        |
| 680 | +		if ( ! $STA_name) { | 
                                                        |
| 681 | +			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 683 | 682 | $success = FALSE;  | 
                                                        
| 684 | 683 | }  | 
                                                        
| 685 | 684 | |
| 686 | -		if ( $success ) { | 
                                                        |
| 685 | +		if ($success) { | 
                                                        |
| 687 | 686 | $cols_n_values = array(  | 
                                                        
| 688 | 687 | 'CNT_ISO' => $CNT_ISO,  | 
                                                        
| 689 | 688 | 'STA_abbrev' => $STA_abbrev,  | 
                                                        
| 690 | 689 | 'STA_name' => $STA_name,  | 
                                                        
| 691 | 690 | 'STA_active' => TRUE  | 
                                                        
| 692 | 691 | );  | 
                                                        
| 693 | - $success = EEM_State::instance()->insert ( $cols_n_values );  | 
                                                        |
| 694 | - EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) );  | 
                                                        |
| 692 | + $success = EEM_State::instance()->insert($cols_n_values);  | 
                                                        |
| 693 | +			EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); | 
                                                        |
| 695 | 694 | }  | 
                                                        
| 696 | 695 | |
| 697 | -		if ( defined( 'DOING_AJAX' )) { | 
                                                        |
| 698 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE );  | 
                                                        |
| 699 | - echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) );  | 
                                                        |
| 696 | +		if (defined('DOING_AJAX')) { | 
                                                        |
| 697 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE);  | 
                                                        |
| 698 | +			echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); | 
                                                        |
| 700 | 699 | die();  | 
                                                        
| 701 | 700 |  		} else { | 
                                                        
| 702 | - $this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );  | 
                                                        |
| 701 | +			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); | 
                                                        |
| 703 | 702 | }  | 
                                                        
| 704 | 703 | }  | 
                                                        
| 705 | 704 | |
@@ -712,25 +711,25 @@ discard block  | 
                                                    ||
| 712 | 711 | * @return boolean | void  | 
                                                        
| 713 | 712 | */  | 
                                                        
| 714 | 713 |  	public function delete_state() { | 
                                                        
| 715 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;  | 
                                                        |
| 716 | - $STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;  | 
                                                        |
| 717 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;  | 
                                                        |
| 718 | -		if ( ! $STA_ID ) { | 
                                                        |
| 719 | - EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 714 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;  | 
                                                        |
| 715 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;  | 
                                                        |
| 716 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;  | 
                                                        |
| 717 | +		if ( ! $STA_ID) { | 
                                                        |
| 718 | +			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 720 | 719 | return FALSE;  | 
                                                        
| 721 | 720 | }  | 
                                                        
| 722 | - $success = EEM_State::instance()->delete_by_ID( $STA_ID );  | 
                                                        |
| 723 | -		if ( $success !== FALSE ) { | 
                                                        |
| 724 | - do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));  | 
                                                        |
| 725 | - EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));  | 
                                                        |
| 721 | + $success = EEM_State::instance()->delete_by_ID($STA_ID);  | 
                                                        |
| 722 | +		if ($success !== FALSE) { | 
                                                        |
| 723 | +			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev)); | 
                                                        |
| 724 | +			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); | 
                                                        |
| 726 | 725 | }  | 
                                                        
| 727 | -		if ( defined( 'DOING_AJAX' )) { | 
                                                        |
| 728 | - $notices = EE_Error::get_notices( FALSE, FALSE );  | 
                                                        |
| 726 | +		if (defined('DOING_AJAX')) { | 
                                                        |
| 727 | + $notices = EE_Error::get_notices(FALSE, FALSE);  | 
                                                        |
| 729 | 728 | $notices['return_data'] = TRUE;  | 
                                                        
| 730 | - echo json_encode( $notices );  | 
                                                        |
| 729 | + echo json_encode($notices);  | 
                                                        |
| 731 | 730 | die();  | 
                                                        
| 732 | 731 |  		} else { | 
                                                        
| 733 | - $this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );  | 
                                                        |
| 732 | +			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); | 
                                                        |
| 734 | 733 | }  | 
                                                        
| 735 | 734 | }  | 
                                                        
| 736 | 735 | |
@@ -746,63 +745,63 @@ discard block  | 
                                                    ||
| 746 | 745 |  	protected function _update_country_settings() { | 
                                                        
| 747 | 746 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 748 | 747 | // grab the country ISO code  | 
                                                        
| 749 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;  | 
                                                        |
| 750 | -		if ( ! $CNT_ISO ) { | 
                                                        |
| 751 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 748 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;  | 
                                                        |
| 749 | +		if ( ! $CNT_ISO) { | 
                                                        |
| 750 | +			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 752 | 751 | return;  | 
                                                        
| 753 | 752 | }  | 
                                                        
| 754 | 753 | $cols_n_values = array();  | 
                                                        
| 755 | - $cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE;  | 
                                                        |
| 756 | - $cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;  | 
                                                        |
| 757 | - $cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL;  | 
                                                        |
| 758 | - $cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD';  | 
                                                        |
| 759 | - $cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar';  | 
                                                        |
| 760 | - $cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars';  | 
                                                        |
| 761 | - $cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$';  | 
                                                        |
| 762 | - $cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE;  | 
                                                        |
| 763 | - $cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2;  | 
                                                        |
| 764 | - $cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.';  | 
                                                        |
| 765 | - $cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ',';  | 
                                                        |
| 766 | - $cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL;  | 
                                                        |
| 767 | - $cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE;  | 
                                                        |
| 768 | - $cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;  | 
                                                        |
| 754 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE;  | 
                                                        |
| 755 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;  | 
                                                        |
| 756 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL;  | 
                                                        |
| 757 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';  | 
                                                        |
| 758 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';  | 
                                                        |
| 759 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';  | 
                                                        |
| 760 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';  | 
                                                        |
| 761 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE;  | 
                                                        |
| 762 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;  | 
                                                        |
| 763 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';  | 
                                                        |
| 764 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';  | 
                                                        |
| 765 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL;  | 
                                                        |
| 766 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE;  | 
                                                        |
| 767 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;  | 
                                                        |
| 769 | 768 | // allow filtering of country data  | 
                                                        
| 770 | - $cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );  | 
                                                        |
| 769 | +		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values); | 
                                                        |
| 771 | 770 | //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 772 | 771 | // where values  | 
                                                        
| 773 | - $where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));  | 
                                                        |
| 772 | +		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); | 
                                                        |
| 774 | 773 | // run the update  | 
                                                        
| 775 | - $success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );  | 
                                                        |
| 774 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);  | 
                                                        |
| 776 | 775 | // global $wpdb;  | 
                                                        
| 777 | 776 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';  | 
                                                        
| 778 | 777 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';  | 
                                                        
| 779 | -		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) { | 
                                                        |
| 778 | +		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) { | 
                                                        |
| 780 | 779 | // allow filtering of states data  | 
                                                        
| 781 | - $states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );  | 
                                                        |
| 780 | +			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']); | 
                                                        |
| 782 | 781 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 783 | 782 | // loop thru state data ( looks like : states[75][STA_name] )  | 
                                                        
| 784 | -			foreach( $states as $STA_ID => $state ) { | 
                                                        |
| 783 | +			foreach ($states as $STA_ID => $state) { | 
                                                        |
| 785 | 784 | $cols_n_values = array(  | 
                                                        
| 786 | 785 | 'CNT_ISO' => $CNT_ISO,  | 
                                                        
| 787 | - 'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),  | 
                                                        |
| 788 | - 'STA_name' => sanitize_text_field( $state['STA_name'] ),  | 
                                                        |
| 789 | - 'STA_active' => (bool)absint( $state['STA_active'] )  | 
                                                        |
| 786 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),  | 
                                                        |
| 787 | + 'STA_name' => sanitize_text_field($state['STA_name']),  | 
                                                        |
| 788 | + 'STA_active' => (bool) absint($state['STA_active'])  | 
                                                        |
| 790 | 789 | );  | 
                                                        
| 791 | 790 | // where values  | 
                                                        
| 792 | - $where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));  | 
                                                        |
| 791 | +				$where_cols_n_values = array(array('STA_ID' => $STA_ID)); | 
                                                        |
| 793 | 792 | // run the update  | 
                                                        
| 794 | - $success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );  | 
                                                        |
| 795 | -				if ( $success !== FALSE ) { | 
                                                        |
| 796 | - do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );  | 
                                                        |
| 793 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);  | 
                                                        |
| 794 | +				if ($success !== FALSE) { | 
                                                        |
| 795 | +					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values); | 
                                                        |
| 797 | 796 | }  | 
                                                        
| 798 | 797 | }  | 
                                                        
| 799 | 798 | }  | 
                                                        
| 800 | 799 | // check if country being edited matches org option country, and if so, then update EE_Config with new settings  | 
                                                        
| 801 | -		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) { | 
                                                        |
| 802 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );  | 
                                                        |
| 800 | +		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { | 
                                                        |
| 801 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);  | 
                                                        |
| 803 | 802 | EE_Registry::instance()->CFG->update_espresso_config();  | 
                                                        
| 804 | 803 | }  | 
                                                        
| 805 | - $this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));  | 
                                                        |
| 804 | +		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO)); | 
                                                        |
| 806 | 805 | }  | 
                                                        
| 807 | 806 | |
| 808 | 807 | |
@@ -816,11 +815,11 @@ discard block  | 
                                                    ||
| 816 | 815 | * @param string $label  | 
                                                        
| 817 | 816 | * @return string  | 
                                                        
| 818 | 817 | */  | 
                                                        
| 819 | -	public function country_form_field_label_wrap( $label, $required_text ) { | 
                                                        |
| 818 | +	public function country_form_field_label_wrap($label, $required_text) { | 
                                                        |
| 820 | 819 | return '  | 
                                                        
| 821 | 820 | <tr>  | 
                                                        
| 822 | 821 | <th>  | 
                                                        
| 823 | - ' . $label . '  | 
                                                        |
| 822 | + ' . $label.'  | 
                                                        |
| 824 | 823 | </th>';  | 
                                                        
| 825 | 824 | }  | 
                                                        
| 826 | 825 | |
@@ -834,10 +833,10 @@ discard block  | 
                                                    ||
| 834 | 833 | * @param string $label  | 
                                                        
| 835 | 834 | * @return string  | 
                                                        
| 836 | 835 | */  | 
                                                        
| 837 | -	public function country_form_field_input__wrap( $input, $label ) { | 
                                                        |
| 836 | +	public function country_form_field_input__wrap($input, $label) { | 
                                                        |
| 838 | 837 | return '  | 
                                                        
| 839 | 838 | <td class="general-settings-country-input-td">  | 
                                                        
| 840 | - ' . $input . '  | 
                                                        |
| 839 | + ' . $input.'  | 
                                                        |
| 841 | 840 | </td>  | 
                                                        
| 842 | 841 | </tr>';  | 
                                                        
| 843 | 842 | }  | 
                                                        
@@ -853,7 +852,7 @@ discard block  | 
                                                    ||
| 853 | 852 | * @param string $required_text  | 
                                                        
| 854 | 853 | * @return string  | 
                                                        
| 855 | 854 | */  | 
                                                        
| 856 | -	public function state_form_field_label_wrap( $label, $required_text  ) { | 
                                                        |
| 855 | +	public function state_form_field_label_wrap($label, $required_text) { | 
                                                        |
| 857 | 856 | return $required_text;  | 
                                                        
| 858 | 857 | }  | 
                                                        
| 859 | 858 | |
@@ -867,10 +866,10 @@ discard block  | 
                                                    ||
| 867 | 866 | * @param string $label  | 
                                                        
| 868 | 867 | * @return string  | 
                                                        
| 869 | 868 | */  | 
                                                        
| 870 | -	public function state_form_field_input__wrap( $input, $label ) { | 
                                                        |
| 869 | +	public function state_form_field_input__wrap($input, $label) { | 
                                                        |
| 871 | 870 | return '  | 
                                                        
| 872 | 871 | <td class="general-settings-country-state-input-td">  | 
                                                        
| 873 | - ' . $input . '  | 
                                                        |
| 872 | + ' . $input.'  | 
                                                        |
| 874 | 873 | </td>';  | 
                                                        
| 875 | 874 | |
| 876 | 875 | }  | 
                                                        
@@ -893,10 +892,10 @@ discard block  | 
                                                    ||
| 893 | 892 | * @param int $ee_page_id  | 
                                                        
| 894 | 893 | * @return string  | 
                                                        
| 895 | 894 | */  | 
                                                        
| 896 | -	public static function edit_view_links( $ee_page_id ) { | 
                                                        |
| 897 | -		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>'; | 
                                                        |
| 895 | +	public static function edit_view_links($ee_page_id) { | 
                                                        |
| 896 | +		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; | 
                                                        |
| 898 | 897 | $links .= '  |  ';  | 
                                                        
| 899 | -		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>'; | 
                                                        |
| 898 | +		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; | 
                                                        |
| 900 | 899 | return $links;  | 
                                                        
| 901 | 900 | }  | 
                                                        
| 902 | 901 | |
@@ -909,27 +908,27 @@ discard block  | 
                                                    ||
| 909 | 908 | * @param WP page object $ee_page  | 
                                                        
| 910 | 909 | * @return string  | 
                                                        
| 911 | 910 | */  | 
                                                        
| 912 | -	public static function page_and_shortcode_status( $ee_page, $shortcode ) { | 
                                                        |
| 911 | +	public static function page_and_shortcode_status($ee_page, $shortcode) { | 
                                                        |
| 913 | 912 | |
| 914 | 913 | // page status  | 
                                                        
| 915 | -		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') { | 
                                                        |
| 914 | +		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { | 
                                                        |
| 916 | 915 | $pg_colour = 'green';  | 
                                                        
| 917 | -			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), ' ' , ' ' ); | 
                                                        |
| 916 | +			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); | 
                                                        |
| 918 | 917 |  		 } else { | 
                                                        
| 919 | 918 | $pg_colour = 'red';  | 
                                                        
| 920 | -			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '  ); | 
                                                        |
| 919 | +			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); | 
                                                        |
| 921 | 920 | }  | 
                                                        
| 922 | 921 | |
| 923 | 922 | // shortcode status  | 
                                                        
| 924 | -		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) { | 
                                                        |
| 923 | +		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) { | 
                                                        |
| 925 | 924 | $sc_colour = 'green';  | 
                                                        
| 926 | -			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), ' ' ); | 
                                                        |
| 925 | +			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); | 
                                                        |
| 927 | 926 |  		 } else { | 
                                                        
| 928 | 927 | $sc_colour = 'red';  | 
                                                        
| 929 | -			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), ' ' ); | 
                                                        |
| 928 | +			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); | 
                                                        |
| 930 | 929 | }  | 
                                                        
| 931 | 930 | |
| 932 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';  | 
                                                        |
| 931 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';  | 
                                                        |
| 933 | 932 | |
| 934 | 933 | }  | 
                                                        
| 935 | 934 | |
@@ -944,20 +943,20 @@ discard block  | 
                                                    ||
| 944 | 943 | * @param unknown_type $level  | 
                                                        
| 945 | 944 | * @return unknown  | 
                                                        
| 946 | 945 | */  | 
                                                        
| 947 | -	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { | 
                                                        |
| 946 | +	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) { | 
                                                        |
| 948 | 947 | global $wpdb;  | 
                                                        
| 949 | -		$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) ); | 
                                                        |
| 948 | +		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent)); | 
                                                        |
| 950 | 949 | |
| 951 | -		if ( $items ) { | 
                                                        |
| 952 | -			foreach ( $items as $item ) { | 
                                                        |
| 953 | - $pad = str_repeat( ' ', $level * 3 );  | 
                                                        |
| 954 | - if ( $item->ID == $default)  | 
                                                        |
| 950 | +		if ($items) { | 
                                                        |
| 951 | +			foreach ($items as $item) { | 
                                                        |
| 952 | +				$pad = str_repeat(' ', $level * 3); | 
                                                        |
| 953 | + if ($item->ID == $default)  | 
                                                        |
| 955 | 954 | $current = ' selected="selected"';  | 
                                                        
| 956 | 955 | else  | 
                                                        
| 957 | 956 | $current = '';  | 
                                                        
| 958 | 957 | |
| 959 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";  | 
                                                        |
| 960 | - parent_dropdown( $default, $item->ID, $level +1 );  | 
                                                        |
| 958 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";  | 
                                                        |
| 959 | + parent_dropdown($default, $item->ID, $level + 1);  | 
                                                        |
| 961 | 960 | }  | 
                                                        
| 962 | 961 |  		} else { | 
                                                        
| 963 | 962 | return false;  | 
                                                        
@@ -1356,7 +1356,7 @@ discard block  | 
                                                    ||
| 1356 | 1356 | * Retrieve and set the message preview for display.  | 
                                                        
| 1357 | 1357 | *  | 
                                                        
| 1358 | 1358 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.  | 
                                                        
| 1359 | - * @return void  | 
                                                        |
| 1359 | + * @return string|null  | 
                                                        |
| 1360 | 1360 | */  | 
                                                        
| 1361 | 1361 |  	public function _preview_message( $send = FALSE ) { | 
                                                        
| 1362 | 1362 | //first make sure we've got the necessary parameters  | 
                                                        
@@ -1673,7 +1673,7 @@ discard block  | 
                                                    ||
| 1673 | 1673 | * sets up a context switcher for edit forms  | 
                                                        
| 1674 | 1674 | *  | 
                                                        
| 1675 | 1675 | * @access protected  | 
                                                        
| 1676 | - * @param EE_Message_Template_Group $template_object the template group object being displayed on the form  | 
                                                        |
| 1676 | + * @param EE_Message_Template_Group $template_group_object the template group object being displayed on the form  | 
                                                        |
| 1677 | 1677 | * @param array $args various things the context switcher needs.  | 
                                                        
| 1678 | 1678 | * @return void  | 
                                                        
| 1679 | 1679 | */  | 
                                                        
@@ -2077,7 +2077,7 @@ discard block  | 
                                                    ||
| 2077 | 2077 | * helper for permanently deleting a mtP group and all related message_templates  | 
                                                        
| 2078 | 2078 | * @param int $GRP_ID The group being deleted  | 
                                                        
| 2079 | 2079 | * @param bool $include_group whether to delete the Message Template Group as well.  | 
                                                        
| 2080 | - * @return success boolean to indicate the success of the deletes or not.  | 
                                                        |
| 2080 | + * @return integer boolean to indicate the success of the deletes or not.  | 
                                                        |
| 2081 | 2081 | */  | 
                                                        
| 2082 | 2082 |  	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) { | 
                                                        
| 2083 | 2083 | $success = 1;  | 
                                                        
@@ -2557,8 +2557,8 @@ discard block  | 
                                                    ||
| 2557 | 2557 | *  | 
                                                        
| 2558 | 2558 | * @param string $messenger What messenger we're toggling  | 
                                                        
| 2559 | 2559 | * @param boolean $deactivate if true then we deactivate  | 
                                                        
| 2560 | - * @param mixed $message_type if present what message type we're toggling  | 
                                                        |
| 2561 | - * @return void  | 
                                                        |
| 2560 | + * @param null|string $message_type if present what message type we're toggling  | 
                                                        |
| 2561 | + * @return boolean  | 
                                                        |
| 2562 | 2562 | */  | 
                                                        
| 2563 | 2563 |  	protected function _activate_messenger($messenger, $deactivate = FALSE, $message_type = FALSE) { | 
                                                        
| 2564 | 2564 | global $espresso_wp_user;  | 
                                                        
@@ -1,5 +1,6 @@ discard block  | 
                                                    ||
| 1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) | 
                                                        |
| 1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION') ) { | 
                                                        |
| 2 | 2 |  	exit('NO direct script access allowed'); | 
                                                        
| 3 | +}  | 
                                                        |
| 3 | 4 | |
| 4 | 5 | /**  | 
                                                        
| 5 | 6 | * Event Espresso  | 
                                                        
@@ -123,8 +124,9 @@ discard block  | 
                                                    ||
| 123 | 124 | $ref = str_replace( ' ', '_', $ref );  | 
                                                        
| 124 | 125 | $classname = 'EE_' . $ref . '_messenger';  | 
                                                        
| 125 | 126 | require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );  | 
                                                        
| 126 | - if ( !class_exists($classname) )  | 
                                                        |
| 127 | -				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) ); | 
                                                        |
| 127 | +			if ( !class_exists($classname) ) { | 
                                                        |
| 128 | +							throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) ); | 
                                                        |
| 129 | + }  | 
                                                        |
| 128 | 130 | |
| 129 | 131 | $a = new ReflectionClass( $classname );  | 
                                                        
| 130 | 132 | $this->_active_messengers[$messenger]['obj'] = $a->newInstance();  | 
                                                        
@@ -141,14 +143,17 @@ discard block  | 
                                                    ||
| 141 | 143 | * @return void  | 
                                                        
| 142 | 144 | */  | 
                                                        
| 143 | 145 |  	protected function _load_active_message_type_objects() { | 
                                                        
| 144 | - if ( empty($this->_active_message_types) ) return;  | 
                                                        |
| 146 | +		if ( empty($this->_active_message_types) ) { | 
                                                        |
| 147 | + return;  | 
                                                        |
| 148 | + }  | 
                                                        |
| 145 | 149 |  		foreach ( $this->_active_message_types as $message_type ) { | 
                                                        
| 146 | 150 | $ref = ucwords( str_replace( '_' , ' ', $message_type) );  | 
                                                        
| 147 | 151 | $ref = str_replace( ' ', '_', $ref );  | 
                                                        
| 148 | 152 | $classname = 'EE_' . $ref . '_message_type';  | 
                                                        
| 149 | 153 | |
| 150 | - if ( !class_exists($classname) )  | 
                                                        |
| 151 | -				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) ); | 
                                                        |
| 154 | +			if ( !class_exists($classname) ) { | 
                                                        |
| 155 | +							throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) ); | 
                                                        |
| 156 | + }  | 
                                                        |
| 152 | 157 | |
| 153 | 158 | $a = new ReflectionClass( $classname );  | 
                                                        
| 154 | 159 | $this->_active_message_types[$message_type]['obj'] = $a->newInstance();  | 
                                                        
@@ -781,12 +786,14 @@ discard block  | 
                                                    ||
| 781 | 786 | $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;  | 
                                                        
| 782 | 787 | |
| 783 | 788 | //we need messenger and message type. They should be coming from the event editor. If not here then return error  | 
                                                        
| 784 | - if ( empty( $message_type ) || empty( $messenger ) )  | 
                                                        |
| 785 | -			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); | 
                                                        |
| 789 | +		if ( empty( $message_type ) || empty( $messenger )  ) { | 
                                                        |
| 790 | +					throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); | 
                                                        |
| 791 | + }  | 
                                                        |
| 786 | 792 | |
| 787 | 793 | //we need the GRP_ID for the template being used as the base for the new template  | 
                                                        
| 788 | - if ( empty( $GRP_ID ) )  | 
                                                        |
| 789 | -			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) ); | 
                                                        |
| 794 | +		if ( empty( $GRP_ID ) ) { | 
                                                        |
| 795 | +					throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) ); | 
                                                        |
| 796 | + }  | 
                                                        |
| 790 | 797 | |
| 791 | 798 | //let's just make sure the template gets generated!  | 
                                                        
| 792 | 799 | |
@@ -902,10 +909,13 @@ discard block  | 
                                                    ||
| 902 | 909 | $continue = FALSE;  | 
                                                        
| 903 | 910 |  							if ( isset( $extra_array['shortcodes_required'] ) ) { | 
                                                        
| 904 | 911 |  								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { | 
                                                        
| 905 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) )  | 
                                                        |
| 906 | - $continue = TRUE;  | 
                                                        |
| 912 | +									if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) { | 
                                                        |
| 913 | + $continue = TRUE;  | 
                                                        |
| 914 | + }  | 
                                                        |
| 915 | + }  | 
                                                        |
| 916 | +								if ( $continue ) { | 
                                                        |
| 917 | + continue;  | 
                                                        |
| 907 | 918 | }  | 
                                                        
| 908 | - if ( $continue ) continue;  | 
                                                        |
| 909 | 919 | }  | 
                                                        
| 910 | 920 | |
| 911 | 921 | $field_id = $reference_field . '-' . $extra_field . '-content';  | 
                                                        
@@ -1610,7 +1620,9 @@ discard block  | 
                                                    ||
| 1610 | 1620 |  	protected function _set_shortcodes() { | 
                                                        
| 1611 | 1621 | |
| 1612 | 1622 | //no need to run this if the property is already set  | 
                                                        
| 1613 | - if ( !empty($this->_shortcodes ) ) return;  | 
                                                        |
| 1623 | +		if ( !empty($this->_shortcodes ) ) { | 
                                                        |
| 1624 | + return;  | 
                                                        |
| 1625 | + }  | 
                                                        |
| 1614 | 1626 | |
| 1615 | 1627 | $this->_shortcodes = $this->_get_shortcodes();  | 
                                                        
| 1616 | 1628 | }  | 
                                                        
@@ -1647,8 +1659,10 @@ discard block  | 
                                                    ||
| 1647 | 1659 | */  | 
                                                        
| 1648 | 1660 |  	protected function _set_message_template_group() { | 
                                                        
| 1649 | 1661 | |
| 1650 | - if ( !empty( $this->_message_template_group ) )  | 
                                                        |
| 1651 | - return; //get out if this is already set.  | 
                                                        |
| 1662 | +		if ( !empty( $this->_message_template_group ) ) { | 
                                                        |
| 1663 | + return;  | 
                                                        |
| 1664 | + }  | 
                                                        |
| 1665 | + //get out if this is already set.  | 
                                                        |
| 1652 | 1666 | |
| 1653 | 1667 | $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;  | 
                                                        
| 1654 | 1668 | $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;  | 
                                                        
@@ -1656,10 +1670,11 @@ discard block  | 
                                                    ||
| 1656 | 1670 | //let's get the message templates  | 
                                                        
| 1657 | 1671 | $MTP = EEM_Message_Template_Group::instance();  | 
                                                        
| 1658 | 1672 | |
| 1659 | - if ( empty($GRP_ID) )  | 
                                                        |
| 1660 | - $this->_message_template_group = $MTP->create_default_object();  | 
                                                        |
| 1661 | - else  | 
                                                        |
| 1662 | - $this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );  | 
                                                        |
| 1673 | +		if ( empty($GRP_ID) ) { | 
                                                        |
| 1674 | + $this->_message_template_group = $MTP->create_default_object();  | 
                                                        |
| 1675 | +		} else { | 
                                                        |
| 1676 | + $this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );  | 
                                                        |
| 1677 | + }  | 
                                                        |
| 1663 | 1678 | |
| 1664 | 1679 | $this->_template_pack = $this->_message_template_group->get_template_pack();  | 
                                                        
| 1665 | 1680 | $this->_variation = $this->_message_template_group->get_template_pack_variation();  | 
                                                        
@@ -1686,7 +1701,9 @@ discard block  | 
                                                    ||
| 1686 | 1701 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">  | 
                                                        
| 1687 | 1702 | <?php  | 
                                                        
| 1688 | 1703 |  					foreach ( $args as $name => $value ) { | 
                                                        
| 1689 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;  | 
                                                        |
| 1704 | +						if ( $name == 'context' || empty($value) || $name == 'extra' ) { | 
                                                        |
| 1705 | + continue;  | 
                                                        |
| 1706 | + }  | 
                                                        |
| 1690 | 1707 | ?>  | 
                                                        
| 1691 | 1708 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />  | 
                                                        
| 1692 | 1709 | <?php  | 
                                                        
@@ -1819,8 +1836,9 @@ discard block  | 
                                                    ||
| 1819 | 1836 | |
| 1820 | 1837 | //setup notices  | 
                                                        
| 1821 | 1838 |  					foreach ( $validates as $field => $error ) { | 
                                                        
| 1822 | - if ( isset($error['msg'] ) )  | 
                                                        |
| 1823 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 1839 | +						if ( isset($error['msg'] ) ) { | 
                                                        |
| 1840 | + EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 1841 | + }  | 
                                                        |
| 1824 | 1842 | }  | 
                                                        
| 1825 | 1843 | |
| 1826 | 1844 |  				} else { | 
                                                        
@@ -1966,8 +1984,9 @@ discard block  | 
                                                    ||
| 1966 | 1984 |  	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) { | 
                                                        
| 1967 | 1985 | |
| 1968 | 1986 | //if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.  | 
                                                        
| 1969 | - if ( empty( $message_types ) )  | 
                                                        |
| 1970 | - return true;  | 
                                                        |
| 1987 | +		if ( empty( $message_types ) ) { | 
                                                        |
| 1988 | + return true;  | 
                                                        |
| 1989 | + }  | 
                                                        |
| 1971 | 1990 | |
| 1972 | 1991 | EE_Registry::instance()->load_helper( 'MSG_Template' );  | 
                                                        
| 1973 | 1992 | |
@@ -2087,8 +2106,9 @@ discard block  | 
                                                    ||
| 2087 | 2106 | //then delete permanently all the related Message Templates  | 
                                                        
| 2088 | 2107 | $deleted = $MTG->delete_related_permanently( 'Message_Template' );  | 
                                                        
| 2089 | 2108 | |
| 2090 | - if ( $deleted === 0 )  | 
                                                        |
| 2091 | - $success = 0;  | 
                                                        |
| 2109 | +		if ( $deleted === 0 ) { | 
                                                        |
| 2110 | + $success = 0;  | 
                                                        |
| 2111 | + }  | 
                                                        |
| 2092 | 2112 | |
| 2093 | 2113 | //now delete permanently this particular group  | 
                                                        
| 2094 | 2114 | |
@@ -2150,8 +2170,9 @@ discard block  | 
                                                    ||
| 2150 | 2170 | */  | 
                                                        
| 2151 | 2171 |  	protected function _set_m_mt_settings() { | 
                                                        
| 2152 | 2172 | //first if this is already set then lets get out no need to regenerate data.  | 
                                                        
| 2153 | - if ( !empty($this->_m_mt_settings) )  | 
                                                        |
| 2154 | - return;  | 
                                                        |
| 2173 | +		if ( !empty($this->_m_mt_settings) ) { | 
                                                        |
| 2174 | + return;  | 
                                                        |
| 2175 | + }  | 
                                                        |
| 2155 | 2176 | |
| 2156 | 2177 | $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';  | 
                                                        
| 2157 | 2178 | |
@@ -2743,8 +2764,9 @@ discard block  | 
                                                    ||
| 2743 | 2764 | case 'message_types' :  | 
                                                        
| 2744 | 2765 |  						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) { | 
                                                        
| 2745 | 2766 |  							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) { | 
                                                        
| 2746 | - if ( isset( $settings['message_types'][$mt] ) )  | 
                                                        |
| 2747 | - $settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();  | 
                                                        |
| 2767 | +								if ( isset( $settings['message_types'][$mt] ) ) { | 
                                                        |
| 2768 | + $settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();  | 
                                                        |
| 2769 | + }  | 
                                                        |
| 2748 | 2770 | }  | 
                                                        
| 2749 | 2771 |  						} else { | 
                                                        
| 2750 | 2772 |  							foreach ( $value as $mt => $v ) { | 
                                                        
@@ -2761,9 +2783,7 @@ discard block  | 
                                                    ||
| 2761 | 2783 | }  | 
                                                        
| 2762 | 2784 | }  | 
                                                        
| 2763 | 2785 | $this->_active_messengers[$messenger]['settings'] = $settings;  | 
                                                        
| 2764 | - }  | 
                                                        |
| 2765 | -  | 
                                                        |
| 2766 | -		else if ( $this->_req_data['type'] == 'message_type' ) { | 
                                                        |
| 2786 | +		} else if ( $this->_req_data['type'] == 'message_type' ) { | 
                                                        |
| 2767 | 2787 | $settings = $this->_req_data['message_type_settings'];  | 
                                                        
| 2768 | 2788 | $messenger = $settings['messenger'];  | 
                                                        
| 2769 | 2789 | $message_type = $settings['message_type'];  | 
                                                        
@@ -190,9 +190,9 @@ discard block  | 
                                                    ||
| 190 | 190 | |
| 191 | 191 | /**  | 
                                                        
| 192 | 192 | * an array for storing key => value pairs of request actions and their corresponding methods  | 
                                                        
| 193 | - * @access protected  | 
                                                        |
| 194 | - * @return void  | 
                                                        |
| 195 | - */  | 
                                                        |
| 193 | + * @access protected  | 
                                                        |
| 194 | + * @return void  | 
                                                        |
| 195 | + */  | 
                                                        |
| 196 | 196 |  	protected function _set_page_routes() { | 
                                                        
| 197 | 197 | $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        
| 198 | 198 | $grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;  | 
                                                        
@@ -379,18 +379,18 @@ discard block  | 
                                                    ||
| 379 | 379 |  							'title' => __('Message Template Editor', 'event_espresso'), | 
                                                        
| 380 | 380 | 'callback' => 'edit_message_template_help_tab'  | 
                                                        
| 381 | 381 | ),  | 
                                                        
| 382 | - 'message_templates_help_tab' => array(  | 
                                                        |
| 383 | -                            'title' => __('Message Templates', 'event_espresso'), | 
                                                        |
| 384 | - 'filename' => 'messages_templates'  | 
                                                        |
| 385 | - ),  | 
                                                        |
| 382 | + 'message_templates_help_tab' => array(  | 
                                                        |
| 383 | +							'title' => __('Message Templates', 'event_espresso'), | 
                                                        |
| 384 | + 'filename' => 'messages_templates'  | 
                                                        |
| 385 | + ),  | 
                                                        |
| 386 | 386 | 'message_template_shortcodes' => array(  | 
                                                        
| 387 | 387 |  							'title' => __('Message Shortcodes', 'event_espresso'), | 
                                                        
| 388 | 388 | 'callback' => 'message_template_shortcodes_help_tab'  | 
                                                        
| 389 | 389 | ),  | 
                                                        
| 390 | - 'message_preview_help_tab' => array(  | 
                                                        |
| 391 | -                            'title' => __('Message Preview', 'event_espresso'), | 
                                                        |
| 392 | - 'filename' => 'messages_preview'  | 
                                                        |
| 393 | - ),  | 
                                                        |
| 390 | + 'message_preview_help_tab' => array(  | 
                                                        |
| 391 | +							'title' => __('Message Preview', 'event_espresso'), | 
                                                        |
| 392 | + 'filename' => 'messages_preview'  | 
                                                        |
| 393 | + ),  | 
                                                        |
| 394 | 394 | ),  | 
                                                        
| 395 | 395 | 'require_nonce' => FALSE  | 
                                                        
| 396 | 396 | ),  | 
                                                        
@@ -415,7 +415,7 @@ discard block  | 
                                                    ||
| 415 | 415 | 'order' => 20  | 
                                                        
| 416 | 416 | ),  | 
                                                        
| 417 | 417 |  				'metaboxes' => array('_messages_settings_metaboxes'), | 
                                                        
| 418 | - 'help_tabs' => array(  | 
                                                        |
| 418 | + 'help_tabs' => array(  | 
                                                        |
| 419 | 419 | 'messages_settings_help_tab' => array(  | 
                                                        
| 420 | 420 |  							'title' => __('Messages Settings', 'event_espresso'), | 
                                                        
| 421 | 421 | 'filename' => 'messages_settings'  | 
                                                        
@@ -428,7 +428,7 @@ discard block  | 
                                                    ||
| 428 | 428 |  							'title' => __('Activating / Deactivating Messengers', 'event_espresso'), | 
                                                        
| 429 | 429 | 'filename' => 'messages_settings_messengers'  | 
                                                        
| 430 | 430 | ),  | 
                                                        
| 431 | - ),  | 
                                                        |
| 431 | + ),  | 
                                                        |
| 432 | 432 | 'help_tour' => array( 'Messages_Settings_Help_Tour' ),  | 
                                                        
| 433 | 433 | 'require_nonce' => FALSE  | 
                                                        
| 434 | 434 | )  | 
                                                        
@@ -1564,14 +1564,14 @@ discard block  | 
                                                    ||
| 1564 | 1564 | |
| 1565 | 1565 | |
| 1566 | 1566 | /**  | 
                                                        
| 1567 | - * This returns the shortcode selector skeleton for a given context and field.  | 
                                                        |
| 1568 | - *  | 
                                                        |
| 1569 | - * @since 4.9.rc.000  | 
                                                        |
| 1570 | - *  | 
                                                        |
| 1567 | + * This returns the shortcode selector skeleton for a given context and field.  | 
                                                        |
| 1568 | + *  | 
                                                        |
| 1569 | + * @since 4.9.rc.000  | 
                                                        |
| 1570 | + *  | 
                                                        |
| 1571 | 1571 | * @param string $field The name of the field retrieving shortcodes for.  | 
                                                        
| 1572 | - * @param string $linked_input_id The css id of the input that the shortcodes get added to.  | 
                                                        |
| 1573 | - * @return string  | 
                                                        |
| 1574 | - */  | 
                                                        |
| 1572 | + * @param string $linked_input_id The css id of the input that the shortcodes get added to.  | 
                                                        |
| 1573 | + * @return string  | 
                                                        |
| 1574 | + */  | 
                                                        |
| 1575 | 1575 |  	protected function _get_shortcode_selector( $field, $linked_input_id ) { | 
                                                        
| 1576 | 1576 | $template_args = array(  | 
                                                        
| 1577 | 1577 | 'shortcodes' => $this->_get_shortcodes( array( $field ), true ),  | 
                                                        
@@ -2111,9 +2111,9 @@ discard block  | 
                                                    ||
| 2111 | 2111 | |
| 2112 | 2112 | /**  | 
                                                        
| 2113 | 2113 | * _learn_more_about_message_templates_link  | 
                                                        
| 2114 | - * @access protected  | 
                                                        |
| 2115 | - * @return string  | 
                                                        |
| 2116 | - */  | 
                                                        |
| 2114 | + * @access protected  | 
                                                        |
| 2115 | + * @return string  | 
                                                        |
| 2116 | + */  | 
                                                        |
| 2117 | 2117 |  	protected function _learn_more_about_message_templates_link() { | 
                                                        
| 2118 | 2118 |  		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; | 
                                                        
| 2119 | 2119 | }  | 
                                                        
@@ -1,4 +1,4 @@ discard block  | 
                                                    ||
| 1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) | 
                                                        |
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) | 
                                                        |
| 2 | 2 |  	exit('NO direct script access allowed'); | 
                                                        
| 3 | 3 | |
| 4 | 4 | /**  | 
                                                        
@@ -73,7 +73,7 @@ discard block  | 
                                                    ||
| 73 | 73 | * @access public  | 
                                                        
| 74 | 74 | * @return void  | 
                                                        
| 75 | 75 | */  | 
                                                        
| 76 | -	public function __construct( $routing = TRUE ) { | 
                                                        |
| 76 | +	public function __construct($routing = TRUE) { | 
                                                        |
| 77 | 77 | //make sure MSG Template helper is loaded.  | 
                                                        
| 78 | 78 |  		EE_Registry::instance()->load_helper('MSG_Template'); | 
                                                        
| 79 | 79 | //make sure messages autoloader is running  | 
                                                        
@@ -94,13 +94,13 @@ discard block  | 
                                                    ||
| 94 | 94 | |
| 95 | 95 | $this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();  | 
                                                        
| 96 | 96 | |
| 97 | - $this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;  | 
                                                        |
| 97 | + $this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;  | 
                                                        |
| 98 | 98 | |
| 99 | - EE_Registry::instance()->load_lib( 'messages' );  | 
                                                        |
| 99 | +		EE_Registry::instance()->load_lib('messages'); | 
                                                        |
| 100 | 100 | //we're also going to set the active messengers and active message types in here.  | 
                                                        
| 101 | 101 | $this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();  | 
                                                        
| 102 | - $this->_active_messengers = !empty($this->_active_messengers) ? $this->_active_messengers : array();  | 
                                                        |
| 103 | - $this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty( $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();  | 
                                                        |
| 102 | + $this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();  | 
                                                        |
| 103 | + $this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();  | 
                                                        |
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | //what about saving the objects in the active_messengers and active_message_types?  | 
                                                        
@@ -118,15 +118,15 @@ discard block  | 
                                                    ||
| 118 | 118 | * @return void  | 
                                                        
| 119 | 119 | */  | 
                                                        
| 120 | 120 |  	protected function _load_active_messenger_objects() { | 
                                                        
| 121 | -		foreach ( $this->_active_messengers as $messenger => $values ) { | 
                                                        |
| 122 | - $ref = ucwords( str_replace( '_' , ' ', $messenger) );  | 
                                                        |
| 123 | - $ref = str_replace( ' ', '_', $ref );  | 
                                                        |
| 124 | - $classname = 'EE_' . $ref . '_messenger';  | 
                                                        |
| 125 | - require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );  | 
                                                        |
| 126 | - if ( !class_exists($classname) )  | 
                                                        |
| 127 | -				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) ); | 
                                                        |
| 128 | -  | 
                                                        |
| 129 | - $a = new ReflectionClass( $classname );  | 
                                                        |
| 121 | +		foreach ($this->_active_messengers as $messenger => $values) { | 
                                                        |
| 122 | +			$ref = ucwords(str_replace('_', ' ', $messenger)); | 
                                                        |
| 123 | +			$ref = str_replace(' ', '_', $ref); | 
                                                        |
| 124 | + $classname = 'EE_'.$ref.'_messenger';  | 
                                                        |
| 125 | + require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');  | 
                                                        |
| 126 | + if ( ! class_exists($classname))  | 
                                                        |
| 127 | +				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname)); | 
                                                        |
| 128 | +  | 
                                                        |
| 129 | + $a = new ReflectionClass($classname);  | 
                                                        |
| 130 | 130 | $this->_active_messengers[$messenger]['obj'] = $a->newInstance();  | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | 132 | }  | 
                                                        
@@ -141,16 +141,16 @@ discard block  | 
                                                    ||
| 141 | 141 | * @return void  | 
                                                        
| 142 | 142 | */  | 
                                                        
| 143 | 143 |  	protected function _load_active_message_type_objects() { | 
                                                        
| 144 | - if ( empty($this->_active_message_types) ) return;  | 
                                                        |
| 145 | -		foreach ( $this->_active_message_types as $message_type ) { | 
                                                        |
| 146 | - $ref = ucwords( str_replace( '_' , ' ', $message_type) );  | 
                                                        |
| 147 | - $ref = str_replace( ' ', '_', $ref );  | 
                                                        |
| 148 | - $classname = 'EE_' . $ref . '_message_type';  | 
                                                        |
| 144 | + if (empty($this->_active_message_types)) return;  | 
                                                        |
| 145 | +		foreach ($this->_active_message_types as $message_type) { | 
                                                        |
| 146 | +			$ref = ucwords(str_replace('_', ' ', $message_type)); | 
                                                        |
| 147 | +			$ref = str_replace(' ', '_', $ref); | 
                                                        |
| 148 | + $classname = 'EE_'.$ref.'_message_type';  | 
                                                        |
| 149 | 149 | |
| 150 | - if ( !class_exists($classname) )  | 
                                                        |
| 151 | -				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) ); | 
                                                        |
| 150 | + if ( ! class_exists($classname))  | 
                                                        |
| 151 | +				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname)); | 
                                                        |
| 152 | 152 | |
| 153 | - $a = new ReflectionClass( $classname );  | 
                                                        |
| 153 | + $a = new ReflectionClass($classname);  | 
                                                        |
| 154 | 154 | $this->_active_message_types[$message_type]['obj'] = $a->newInstance();  | 
                                                        
| 155 | 155 | }  | 
                                                        
| 156 | 156 | }  | 
                                                        
@@ -158,11 +158,11 @@ discard block  | 
                                                    ||
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 |  	protected function _ajax_hooks() { | 
                                                        
| 161 | -		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) ); | 
                                                        |
| 162 | -		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') ); | 
                                                        |
| 163 | -		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') ); | 
                                                        |
| 164 | -		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) ); | 
                                                        |
| 165 | -		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) ); | 
                                                        |
| 161 | +		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle')); | 
                                                        |
| 162 | +		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle')); | 
                                                        |
| 163 | +		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings')); | 
                                                        |
| 164 | +		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form')); | 
                                                        |
| 165 | +		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack')); | 
                                                        |
| 166 | 166 | }  | 
                                                        
| 167 | 167 | |
| 168 | 168 | |
@@ -194,8 +194,8 @@ discard block  | 
                                                    ||
| 194 | 194 | * @return void  | 
                                                        
| 195 | 195 | */  | 
                                                        
| 196 | 196 |  	protected function _set_page_routes() { | 
                                                        
| 197 | - $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 198 | - $grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;  | 
                                                        |
| 197 | + $grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 198 | + $grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;  | 
                                                        |
| 199 | 199 | |
| 200 | 200 | $this->_page_routes = array(  | 
                                                        
| 201 | 201 | 'default'=> array(  | 
                                                        
@@ -231,35 +231,35 @@ discard block  | 
                                                    ||
| 231 | 231 | 'insert_message_template' => array(  | 
                                                        
| 232 | 232 | 'func' => '_insert_or_update_message_template',  | 
                                                        
| 233 | 233 | 'capability' => 'ee_edit_messages',  | 
                                                        
| 234 | - 'args' => array( 'new_template' => TRUE ),  | 
                                                        |
| 234 | +					'args' => array('new_template' => TRUE), | 
                                                        |
| 235 | 235 | 'noheader' => TRUE  | 
                                                        
| 236 | 236 | ),  | 
                                                        
| 237 | 237 | 'update_message_template' => array(  | 
                                                        
| 238 | 238 | 'func' => '_insert_or_update_message_template',  | 
                                                        
| 239 | 239 | 'capability' => 'ee_edit_message',  | 
                                                        
| 240 | 240 | 'obj_id' => $grp_id,  | 
                                                        
| 241 | - 'args' => array( 'new_template' => FALSE ),  | 
                                                        |
| 241 | +					'args' => array('new_template' => FALSE), | 
                                                        |
| 242 | 242 | 'noheader' => TRUE  | 
                                                        
| 243 | 243 | ),  | 
                                                        
| 244 | 244 | 'trash_message_template' => array(  | 
                                                        
| 245 | 245 | 'func' => '_trash_or_restore_message_template',  | 
                                                        
| 246 | 246 | 'capability' => 'ee_delete_message',  | 
                                                        
| 247 | 247 | 'obj_id' => $grp_id,  | 
                                                        
| 248 | - 'args' => array( 'trash' => TRUE, 'all' => TRUE ),  | 
                                                        |
| 248 | +					'args' => array('trash' => TRUE, 'all' => TRUE), | 
                                                        |
| 249 | 249 | 'noheader' => TRUE  | 
                                                        
| 250 | 250 | ),  | 
                                                        
| 251 | 251 | 'trash_message_template_context' => array(  | 
                                                        
| 252 | 252 | 'func' => '_trash_or_restore_message_template',  | 
                                                        
| 253 | 253 | 'capability' => 'ee_delete_message',  | 
                                                        
| 254 | 254 | 'obj_id' => $grp_id,  | 
                                                        
| 255 | - 'args' => array( 'trash' => TRUE ),  | 
                                                        |
| 255 | +					'args' => array('trash' => TRUE), | 
                                                        |
| 256 | 256 | 'noheader' => TRUE  | 
                                                        
| 257 | 257 | ),  | 
                                                        
| 258 | 258 | 'restore_message_template' => array(  | 
                                                        
| 259 | 259 | 'func' => '_trash_or_restore_message_template',  | 
                                                        
| 260 | 260 | 'capability' => 'ee_delete_message',  | 
                                                        
| 261 | 261 | 'obj_id' => $grp_id,  | 
                                                        
| 262 | - 'args' => array( 'trash' => FALSE, 'all' => TRUE ),  | 
                                                        |
| 262 | +					'args' => array('trash' => FALSE, 'all' => TRUE), | 
                                                        |
| 263 | 263 | 'noheader' => TRUE  | 
                                                        
| 264 | 264 | ),  | 
                                                        
| 265 | 265 | 'restore_message_template_context' => array(  | 
                                                        
@@ -338,7 +338,7 @@ discard block  | 
                                                    ||
| 338 | 338 | 'filename' => 'messages_overview_other',  | 
                                                        
| 339 | 339 | ),  | 
                                                        
| 340 | 340 | ),  | 
                                                        
| 341 | - 'help_tour' => array( 'Messages_Overview_Help_Tour' ),  | 
                                                        |
| 341 | +				'help_tour' => array('Messages_Overview_Help_Tour'), | 
                                                        |
| 342 | 342 | 'require_nonce' => FALSE  | 
                                                        
| 343 | 343 | ),  | 
                                                        
| 344 | 344 | 'custom_mtps' => array(  | 
                                                        
@@ -373,7 +373,7 @@ discard block  | 
                                                    ||
| 373 | 373 | ),  | 
                                                        
| 374 | 374 |  				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'), | 
                                                        
| 375 | 375 | 'has_metaboxes' => TRUE,  | 
                                                        
| 376 | - 'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),  | 
                                                        |
| 376 | +				'help_tour' => array('Message_Templates_Edit_Help_Tour'), | 
                                                        |
| 377 | 377 | 'help_tabs' => array(  | 
                                                        
| 378 | 378 | 'edit_message_template' => array(  | 
                                                        
| 379 | 379 |  							'title' => __('Message Template Editor', 'event_espresso'), | 
                                                        
@@ -429,7 +429,7 @@ discard block  | 
                                                    ||
| 429 | 429 | 'filename' => 'messages_settings_messengers'  | 
                                                        
| 430 | 430 | ),  | 
                                                        
| 431 | 431 | ),  | 
                                                        
| 432 | - 'help_tour' => array( 'Messages_Settings_Help_Tour' ),  | 
                                                        |
| 432 | +				'help_tour' => array('Messages_Settings_Help_Tour'), | 
                                                        |
| 433 | 433 | 'require_nonce' => FALSE  | 
                                                        
| 434 | 434 | )  | 
                                                        
| 435 | 435 | /*'reports' => array(  | 
                                                        
@@ -479,43 +479,43 @@ discard block  | 
                                                    ||
| 479 | 479 | |
| 480 | 480 | |
| 481 | 481 |  	public function messages_help_tab() { | 
                                                        
| 482 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';  | 
                                                        |
| 483 | - EEH_Template::display_template( $templatepath, array());  | 
                                                        |
| 482 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';  | 
                                                        |
| 483 | + EEH_Template::display_template($templatepath, array());  | 
                                                        |
| 484 | 484 | }  | 
                                                        
| 485 | 485 | |
| 486 | 486 | |
| 487 | 487 |  	public function messengers_help_tab() { | 
                                                        
| 488 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';  | 
                                                        |
| 489 | - EEH_Template::display_template( $templatepath, array());  | 
                                                        |
| 488 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';  | 
                                                        |
| 489 | + EEH_Template::display_template($templatepath, array());  | 
                                                        |
| 490 | 490 | }  | 
                                                        
| 491 | 491 | |
| 492 | 492 | |
| 493 | 493 |  	public function message_types_help_tab() { | 
                                                        
| 494 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';  | 
                                                        |
| 495 | - EEH_Template::display_template( $templatepath, array());  | 
                                                        |
| 494 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';  | 
                                                        |
| 495 | + EEH_Template::display_template($templatepath, array());  | 
                                                        |
| 496 | 496 | }  | 
                                                        
| 497 | 497 | |
| 498 | 498 | |
| 499 | 499 |  	public function messages_overview_help_tab() { | 
                                                        
| 500 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';  | 
                                                        |
| 501 | - EEH_Template::display_template( $templatepath, array());  | 
                                                        |
| 500 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';  | 
                                                        |
| 501 | + EEH_Template::display_template($templatepath, array());  | 
                                                        |
| 502 | 502 | }  | 
                                                        
| 503 | 503 | |
| 504 | 504 | |
| 505 | 505 |  	public function message_templates_help_tab() { | 
                                                        
| 506 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';  | 
                                                        |
| 507 | - EEH_Template::display_template( $templatepath, array());  | 
                                                        |
| 506 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';  | 
                                                        |
| 507 | + EEH_Template::display_template($templatepath, array());  | 
                                                        |
| 508 | 508 | }  | 
                                                        
| 509 | 509 | |
| 510 | 510 | |
| 511 | 511 |  	public function edit_message_template_help_tab() { | 
                                                        
| 512 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';  | 
                                                        |
| 513 | -		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />'; | 
                                                        |
| 514 | -		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />'; | 
                                                        |
| 515 | -		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />'; | 
                                                        |
| 516 | -		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />'; | 
                                                        |
| 517 | -		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />'; | 
                                                        |
| 518 | - EEH_Template::display_template( $templatepath, $args);  | 
                                                        |
| 512 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';  | 
                                                        |
| 513 | +		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />'; | 
                                                        |
| 514 | +		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />'; | 
                                                        |
| 515 | +		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />'; | 
                                                        |
| 516 | +		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />'; | 
                                                        |
| 517 | +		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />'; | 
                                                        |
| 518 | + EEH_Template::display_template($templatepath, $args);  | 
                                                        |
| 519 | 519 | }  | 
                                                        
| 520 | 520 | |
| 521 | 521 | |
@@ -523,25 +523,25 @@ discard block  | 
                                                    ||
| 523 | 523 |  	public function message_template_shortcodes_help_tab() { | 
                                                        
| 524 | 524 | $this->_set_shortcodes();  | 
                                                        
| 525 | 525 | $args['shortcodes'] = $this->_shortcodes;  | 
                                                        
| 526 | - $template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';  | 
                                                        |
| 527 | - EEH_Template::display_template( $template_path, $args );  | 
                                                        |
| 526 | + $template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';  | 
                                                        |
| 527 | + EEH_Template::display_template($template_path, $args);  | 
                                                        |
| 528 | 528 | }  | 
                                                        
| 529 | 529 | |
| 530 | 530 | |
| 531 | 531 | |
| 532 | 532 |  	public function preview_message_help_tab() { | 
                                                        
| 533 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';  | 
                                                        |
| 534 | - EEH_Template::display_template( $templatepath, array());  | 
                                                        |
| 533 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';  | 
                                                        |
| 534 | + EEH_Template::display_template($templatepath, array());  | 
                                                        |
| 535 | 535 | }  | 
                                                        
| 536 | 536 | |
| 537 | 537 | |
| 538 | 538 |  	public function settings_help_tab() { | 
                                                        
| 539 | - $templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';  | 
                                                        |
| 540 | -		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'; | 
                                                        |
| 541 | -		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'; | 
                                                        |
| 539 | + $templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';  | 
                                                        |
| 540 | +		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'; | 
                                                        |
| 541 | +		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'; | 
                                                        |
| 542 | 542 | $args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';  | 
                                                        
| 543 | 543 | $args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';  | 
                                                        
| 544 | - EEH_Template::display_template( $templatepath, $args);  | 
                                                        |
| 544 | + EEH_Template::display_template($templatepath, $args);  | 
                                                        |
| 545 | 545 | }  | 
                                                        
| 546 | 546 | |
| 547 | 547 | |
@@ -549,24 +549,24 @@ discard block  | 
                                                    ||
| 549 | 549 | |
| 550 | 550 | |
| 551 | 551 |  	public function load_scripts_styles() { | 
                                                        
| 552 | -		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION ); | 
                                                        |
| 552 | +		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION); | 
                                                        |
| 553 | 553 |  		wp_enqueue_style('espresso_ee_msg'); | 
                                                        
| 554 | 554 | |
| 555 | -		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE ); | 
                                                        |
| 555 | +		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 556 | 556 | }  | 
                                                        
| 557 | 557 | |
| 558 | 558 | |
| 559 | 559 | |
| 560 | 560 | |
| 561 | 561 | |
| 562 | -	public function wp_editor_css( $mce_css ) { | 
                                                        |
| 562 | +	public function wp_editor_css($mce_css) { | 
                                                        |
| 563 | 563 | //if we're on the edit_message_template route  | 
                                                        
| 564 | -		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) { | 
                                                        |
| 564 | +		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) { | 
                                                        |
| 565 | 565 | $message_type_name = $this->_active_message_type_name;  | 
                                                        
| 566 | 566 | |
| 567 | 567 | //we're going to REPLACE the existing mce css  | 
                                                        
| 568 | 568 | //we need to get the css file location from the active messenger  | 
                                                        
| 569 | - $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );  | 
                                                        |
| 569 | + $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);  | 
                                                        |
| 570 | 570 | }  | 
                                                        
| 571 | 571 | |
| 572 | 572 | return $mce_css;  | 
                                                        
@@ -584,37 +584,37 @@ discard block  | 
                                                    ||
| 584 | 584 | $this->_message_template_group->messenger_obj()->label['singular'],  | 
                                                        
| 585 | 585 | $this->_message_template_group->message_type_obj()->label['singular']  | 
                                                        
| 586 | 586 | );  | 
                                                        
| 587 | -		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' ); | 
                                                        |
| 587 | +		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso'); | 
                                                        |
| 588 | 588 | |
| 589 | -		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION ); | 
                                                        |
| 589 | +		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 590 | 590 | |
| 591 | 591 |  		wp_enqueue_script('ee_admin_js'); | 
                                                        
| 592 | 592 |  		wp_enqueue_script('ee_msgs_edit_js'); | 
                                                        
| 593 | 593 | |
| 594 | 594 | //add in special css for tiny_mce  | 
                                                        
| 595 | - add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );  | 
                                                        |
| 595 | +		add_filter('mce_css', array($this, 'wp_editor_css')); | 
                                                        |
| 596 | 596 | }  | 
                                                        
| 597 | 597 | |
| 598 | 598 | |
| 599 | 599 | |
| 600 | 600 |  	public function load_scripts_styles_display_preview_message() { | 
                                                        
| 601 | 601 | $this->_set_message_template_group();  | 
                                                        
| 602 | -		if ( isset( $this->_req_data['messenger'] ) ) { | 
                                                        |
| 602 | +		if (isset($this->_req_data['messenger'])) { | 
                                                        |
| 603 | 603 | $this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];  | 
                                                        
| 604 | 604 | }  | 
                                                        
| 605 | 605 | |
| 606 | - $message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';  | 
                                                        |
| 606 | + $message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';  | 
                                                        |
| 607 | 607 | |
| 608 | 608 | |
| 609 | -		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) ); | 
                                                        |
| 609 | +		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation)); | 
                                                        |
| 610 | 610 | }  | 
                                                        
| 611 | 611 | |
| 612 | 612 | |
| 613 | 613 | |
| 614 | 614 |  	public function load_scripts_styles_settings() { | 
                                                        
| 615 | - wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );  | 
                                                        |
| 616 | - wp_enqueue_style( 'ee-text-links' );  | 
                                                        |
| 617 | - wp_enqueue_style( 'ee-message-settings' );  | 
                                                        |
| 615 | +		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 616 | +		wp_enqueue_style('ee-text-links'); | 
                                                        |
| 617 | +		wp_enqueue_style('ee-message-settings'); | 
                                                        |
| 618 | 618 | |
| 619 | 619 |  		wp_enqueue_script('ee-messages-settings'); | 
                                                        
| 620 | 620 | }  | 
                                                        
@@ -650,9 +650,9 @@ discard block  | 
                                                    ||
| 650 | 650 | |
| 651 | 651 |  	protected function _custom_mtps_preview() { | 
                                                        
| 652 | 652 |  		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso'); | 
                                                        
| 653 | -		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />'; | 
                                                        |
| 653 | +		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />'; | 
                                                        |
| 654 | 654 |  		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>'; | 
                                                        
| 655 | - $this->display_admin_caf_preview_page( 'custom_message_types', FALSE );  | 
                                                        |
| 655 | +		$this->display_admin_caf_preview_page('custom_message_types', FALSE); | 
                                                        |
| 656 | 656 | }  | 
                                                        
| 657 | 657 | |
| 658 | 658 | |
@@ -674,7 +674,7 @@ discard block  | 
                                                    ||
| 674 | 674 | * @param bool $global whether to return just global (true) or custom templates (false)  | 
                                                        
| 675 | 675 | * @return array|WP_Error object  | 
                                                        
| 676 | 676 | */  | 
                                                        
| 677 | -	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) { | 
                                                        |
| 677 | +	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) { | 
                                                        |
| 678 | 678 | global $espresso_wp_user;  | 
                                                        
| 679 | 679 | // start with an empty array  | 
                                                        
| 680 | 680 | $message_templates = array();  | 
                                                        
@@ -684,24 +684,24 @@ discard block  | 
                                                    ||
| 684 | 684 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];  | 
                                                        
| 685 | 685 | $orderby = $this->_req_data['orderby'];  | 
                                                        
| 686 | 686 | |
| 687 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';  | 
                                                        |
| 687 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';  | 
                                                        |
| 688 | 688 | |
| 689 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 690 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;  | 
                                                        |
| 689 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 690 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;  | 
                                                        |
| 691 | 691 | |
| 692 | - $offset = ($current_page-1)*$per_page;  | 
                                                        |
| 693 | - $limit = $all ? NULL : array( $offset, $per_page );  | 
                                                        |
| 692 | + $offset = ($current_page - 1) * $per_page;  | 
                                                        |
| 693 | + $limit = $all ? NULL : array($offset, $per_page);  | 
                                                        |
| 694 | 694 | |
| 695 | 695 | |
| 696 | 696 | //options will match what is in the _views array property  | 
                                                        
| 697 | -		switch( $type ) { | 
                                                        |
| 697 | +		switch ($type) { | 
                                                        |
| 698 | 698 | |
| 699 | 699 | case 'in_use':  | 
                                                        
| 700 | - $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );  | 
                                                        |
| 700 | + $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);  | 
                                                        |
| 701 | 701 | break;  | 
                                                        
| 702 | 702 | |
| 703 | 703 | default:  | 
                                                        
| 704 | - $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );  | 
                                                        |
| 704 | + $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);  | 
                                                        |
| 705 | 705 | |
| 706 | 706 | }  | 
                                                        
| 707 | 707 | |
@@ -737,7 +737,7 @@ discard block  | 
                                                    ||
| 737 | 737 | $imts = $installed_objects['message_types'];  | 
                                                        
| 738 | 738 | $installed = array();  | 
                                                        
| 739 | 739 | |
| 740 | -		foreach ( $imts as $message_type ) { | 
                                                        |
| 740 | +		foreach ($imts as $message_type) { | 
                                                        |
| 741 | 741 | $installed[$message_type->name]['obj'] = $message_type;  | 
                                                        
| 742 | 742 | }  | 
                                                        
| 743 | 743 | |
@@ -769,24 +769,24 @@ discard block  | 
                                                    ||
| 769 | 769 | * @access protected  | 
                                                        
| 770 | 770 | * @return void  | 
                                                        
| 771 | 771 | */  | 
                                                        
| 772 | -	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) { | 
                                                        |
| 772 | +	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') { | 
                                                        |
| 773 | 773 | //set values override any request data  | 
                                                        
| 774 | - $message_type = !empty( $message_type ) ? $message_type : '';  | 
                                                        |
| 775 | - $message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;  | 
                                                        |
| 774 | + $message_type = ! empty($message_type) ? $message_type : '';  | 
                                                        |
| 775 | + $message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;  | 
                                                        |
| 776 | 776 | |
| 777 | - $messenger = !empty( $messenger ) ? $messenger : '';  | 
                                                        |
| 778 | - $messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;  | 
                                                        |
| 777 | + $messenger = ! empty($messenger) ? $messenger : '';  | 
                                                        |
| 778 | + $messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;  | 
                                                        |
| 779 | 779 | |
| 780 | - $GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';  | 
                                                        |
| 781 | - $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;  | 
                                                        |
| 780 | + $GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';  | 
                                                        |
| 781 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;  | 
                                                        |
| 782 | 782 | |
| 783 | 783 | //we need messenger and message type. They should be coming from the event editor. If not here then return error  | 
                                                        
| 784 | - if ( empty( $message_type ) || empty( $messenger ) )  | 
                                                        |
| 784 | + if (empty($message_type) || empty($messenger))  | 
                                                        |
| 785 | 785 |  			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); | 
                                                        
| 786 | 786 | |
| 787 | 787 | //we need the GRP_ID for the template being used as the base for the new template  | 
                                                        
| 788 | - if ( empty( $GRP_ID ) )  | 
                                                        |
| 789 | -			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) ); | 
                                                        |
| 788 | + if (empty($GRP_ID))  | 
                                                        |
| 789 | +			throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); | 
                                                        |
| 790 | 790 | |
| 791 | 791 | //let's just make sure the template gets generated!  | 
                                                        
| 792 | 792 | |
@@ -805,8 +805,8 @@ discard block  | 
                                                    ||
| 805 | 805 | * @param string $messenger messenger slug  | 
                                                        
| 806 | 806 | * @param int $GRP_ID GRP_ID for the related message template group this new template will be based off of.  | 
                                                        
| 807 | 807 | */  | 
                                                        
| 808 | -	public function add_message_template( $message_type, $messenger, $GRP_ID ) { | 
                                                        |
| 809 | - $this->_add_message_template( $message_type, $messenger, $GRP_ID );  | 
                                                        |
| 808 | +	public function add_message_template($message_type, $messenger, $GRP_ID) { | 
                                                        |
| 809 | + $this->_add_message_template($message_type, $messenger, $GRP_ID);  | 
                                                        |
| 810 | 810 | }  | 
                                                        
| 811 | 811 | |
| 812 | 812 | |
@@ -817,36 +817,36 @@ discard block  | 
                                                    ||
| 817 | 817 | * @return void  | 
                                                        
| 818 | 818 | */  | 
                                                        
| 819 | 819 |  	protected function _edit_message_template() { | 
                                                        
| 820 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');  | 
                                                        |
| 820 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 821 | 821 | |
| 822 | 822 | //we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.  | 
                                                        
| 823 | - add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );  | 
                                                        |
| 823 | +		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2); | 
                                                        |
| 824 | 824 | |
| 825 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;  | 
                                                        |
| 825 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;  | 
                                                        |
| 826 | 826 | |
| 827 | 827 | $this->_set_shortcodes(); //this also sets the _message_template property.  | 
                                                        
| 828 | 828 | $message_template_group = $this->_message_template_group;  | 
                                                        
| 829 | 829 | $c_label = $message_template_group->context_label();  | 
                                                        
| 830 | 830 | $c_config = $message_template_group->contexts_config();  | 
                                                        
| 831 | 831 | |
| 832 | - reset( $c_config );  | 
                                                        |
| 833 | - $context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);  | 
                                                        |
| 832 | + reset($c_config);  | 
                                                        |
| 833 | + $context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);  | 
                                                        |
| 834 | 834 | |
| 835 | 835 | |
| 836 | -		if ( empty($GRP_ID) ) { | 
                                                        |
| 836 | +		if (empty($GRP_ID)) { | 
                                                        |
| 837 | 837 | $action = 'insert_message_template';  | 
                                                        
| 838 | 838 | $button_both = FALSE;  | 
                                                        
| 839 | - $button_text = array( __( 'Save','event_espresso') );  | 
                                                        |
| 839 | +			$button_text = array(__('Save', 'event_espresso')); | 
                                                        |
| 840 | 840 |  			$button_actions = array('something_different'); | 
                                                        
| 841 | 841 | $referrer = FALSE;  | 
                                                        
| 842 | - $edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );  | 
                                                        |
| 842 | +			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL); | 
                                                        |
| 843 | 843 |  		} else { | 
                                                        
| 844 | 844 | $action = 'update_message_template';  | 
                                                        
| 845 | 845 | $button_both = TRUE;  | 
                                                        
| 846 | 846 | $button_text = array();  | 
                                                        
| 847 | 847 | $button_actions = array();  | 
                                                        
| 848 | 848 | $referrer = $this->_admin_base_url;  | 
                                                        
| 849 | - $edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );  | 
                                                        |
| 849 | +			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL); | 
                                                        |
| 850 | 850 | }  | 
                                                        
| 851 | 851 | |
| 852 | 852 | //set active messenger for this view  | 
                                                        
@@ -856,13 +856,13 @@ discard block  | 
                                                    ||
| 856 | 856 | |
| 857 | 857 | //Do we have any validation errors?  | 
                                                        
| 858 | 858 | $validators = $this->_get_transient();  | 
                                                        
| 859 | - $v_fields = !empty($validators) ? array_keys($validators) : array();  | 
                                                        |
| 859 | + $v_fields = ! empty($validators) ? array_keys($validators) : array();  | 
                                                        |
| 860 | 860 | |
| 861 | 861 | |
| 862 | 862 | //we need to assemble the title from Various details  | 
                                                        
| 863 | -		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] )); | 
                                                        |
| 863 | +		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'])); | 
                                                        |
| 864 | 864 | |
| 865 | -		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label ); | 
                                                        |
| 865 | +		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label); | 
                                                        |
| 866 | 866 | |
| 867 | 867 | $this->_template_args['GRP_ID'] = $GRP_ID;  | 
                                                        
| 868 | 868 | $this->_template_args['message_template'] = $message_template_group;  | 
                                                        
@@ -873,7 +873,7 @@ discard block  | 
                                                    ||
| 873 | 873 | $MSG = new EE_messages();  | 
                                                        
| 874 | 874 | $template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());  | 
                                                        
| 875 | 875 | |
| 876 | -		if ( !$template_field_structure ) { | 
                                                        |
| 876 | +		if ( ! $template_field_structure) { | 
                                                        |
| 877 | 877 | $template_field_structure = FALSE;  | 
                                                        
| 878 | 878 |  			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso'); | 
                                                        
| 879 | 879 | }  | 
                                                        
@@ -883,38 +883,38 @@ discard block  | 
                                                    ||
| 883 | 883 | |
| 884 | 884 | |
| 885 | 885 | //if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.  | 
                                                        
| 886 | -		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) { | 
                                                        |
| 887 | -			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) { | 
                                                        |
| 888 | - unset( $template_field_structure[$context][$reference_field] );  | 
                                                        |
| 886 | +		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) { | 
                                                        |
| 887 | +			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) { | 
                                                        |
| 888 | + unset($template_field_structure[$context][$reference_field]);  | 
                                                        |
| 889 | 889 | }  | 
                                                        
| 890 | 890 | }  | 
                                                        
| 891 | 891 | |
| 892 | 892 | //let's loop through the template_field_structure and actually assemble the input fields!  | 
                                                        
| 893 | -		if ( !empty($template_field_structure) ) { | 
                                                        |
| 894 | - $id_prefix= 'ee-msg-edit-template-fields-';  | 
                                                        |
| 895 | -			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) { | 
                                                        |
| 893 | +		if ( ! empty($template_field_structure)) { | 
                                                        |
| 894 | + $id_prefix = 'ee-msg-edit-template-fields-';  | 
                                                        |
| 895 | +			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) { | 
                                                        |
| 896 | 896 | //if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.  | 
                                                        
| 897 | -				if ( $template_field == 'extra' ) { | 
                                                        |
| 897 | +				if ($template_field == 'extra') { | 
                                                        |
| 898 | 898 | $this->_template_args['is_extra_fields'] = TRUE;  | 
                                                        
| 899 | -					foreach ( $field_setup_array as $reference_field => $new_fields_array ) { | 
                                                        |
| 900 | -						foreach ( $new_fields_array as $extra_field =>  $extra_array ) { | 
                                                        |
| 899 | +					foreach ($field_setup_array as $reference_field => $new_fields_array) { | 
                                                        |
| 900 | +						foreach ($new_fields_array as $extra_field =>  $extra_array) { | 
                                                        |
| 901 | 901 | //let's verify if we need this extra field via the shortcodes parameter.  | 
                                                        
| 902 | 902 | $continue = FALSE;  | 
                                                        
| 903 | -							if ( isset( $extra_array['shortcodes_required'] ) ) { | 
                                                        |
| 904 | -								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { | 
                                                        |
| 905 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) )  | 
                                                        |
| 903 | +							if (isset($extra_array['shortcodes_required'])) { | 
                                                        |
| 904 | +								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) { | 
                                                        |
| 905 | + if ( ! array_key_exists($shortcode, $this->_shortcodes))  | 
                                                        |
| 906 | 906 | $continue = TRUE;  | 
                                                        
| 907 | 907 | }  | 
                                                        
| 908 | - if ( $continue ) continue;  | 
                                                        |
| 908 | + if ($continue) continue;  | 
                                                        |
| 909 | 909 | }  | 
                                                        
| 910 | 910 | |
| 911 | - $field_id = $reference_field . '-' . $extra_field . '-content';  | 
                                                        |
| 911 | + $field_id = $reference_field.'-'.$extra_field.'-content';  | 
                                                        |
| 912 | 912 | $template_form_fields[$field_id] = $extra_array;  | 
                                                        
| 913 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';  | 
                                                        |
| 914 | - $css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';  | 
                                                        |
| 915 | - $template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;  | 
                                                        |
| 913 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';  | 
                                                        |
| 914 | + $css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';  | 
                                                        |
| 915 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;  | 
                                                        |
| 916 | 916 |  							$content = $message_templates[$context][$reference_field]->get('MTP_content'); | 
                                                        
| 917 | - $template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';  | 
                                                        |
| 917 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';  | 
                                                        |
| 918 | 918 | |
| 919 | 919 | //do we have a validation error? if we do then let's use that value instead  | 
                                                        
| 920 | 920 | $template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];  | 
                                                        
@@ -924,32 +924,32 @@ discard block  | 
                                                    ||
| 924 | 924 | |
| 925 | 925 | //shortcode selector  | 
                                                        
| 926 | 926 | $field_name_to_use = $extra_field == 'main' ? 'content' : $extra_field;  | 
                                                        
| 927 | - $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $field_name_to_use, $field_id );  | 
                                                        |
| 927 | + $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($field_name_to_use, $field_id);  | 
                                                        |
| 928 | 928 | |
| 929 | -							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) { | 
                                                        |
| 929 | +							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') { | 
                                                        |
| 930 | 930 | //we want to decode the entities  | 
                                                        
| 931 | - $template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );  | 
                                                        |
| 931 | + $template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));  | 
                                                        |
| 932 | 932 | |
| 933 | 933 | }/**/  | 
                                                        
| 934 | 934 | }  | 
                                                        
| 935 | - $templatefield_MTP_id = $reference_field . '-MTP_ID';  | 
                                                        |
| 936 | - $templatefield_templatename_id = $reference_field . '-name';  | 
                                                        |
| 935 | + $templatefield_MTP_id = $reference_field.'-MTP_ID';  | 
                                                        |
| 936 | + $templatefield_templatename_id = $reference_field.'-name';  | 
                                                        |
| 937 | 937 | |
| 938 | 938 | $template_form_fields[$templatefield_MTP_id] = array(  | 
                                                        
| 939 | - 'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',  | 
                                                        |
| 939 | + 'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',  | 
                                                        |
| 940 | 940 | 'label' => NULL,  | 
                                                        
| 941 | 941 | 'input' => 'hidden',  | 
                                                        
| 942 | 942 | 'type' => 'int',  | 
                                                        
| 943 | 943 | 'required' => FALSE,  | 
                                                        
| 944 | 944 | 'validation' => FALSE,  | 
                                                        
| 945 | - 'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',  | 
                                                        |
| 945 | + 'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',  | 
                                                        |
| 946 | 946 | 'css_class' => '',  | 
                                                        
| 947 | 947 | 'format' => '%d',  | 
                                                        
| 948 | 948 | 'db-col' => 'MTP_ID'  | 
                                                        
| 949 | 949 | );  | 
                                                        
| 950 | 950 | |
| 951 | 951 | $template_form_fields[$templatefield_templatename_id] = array(  | 
                                                        
| 952 | - 'name' => 'MTP_template_fields[' . $reference_field . '][name]',  | 
                                                        |
| 952 | + 'name' => 'MTP_template_fields['.$reference_field.'][name]',  | 
                                                        |
| 953 | 953 | 'label' => NULL,  | 
                                                        
| 954 | 954 | 'input' => 'hidden',  | 
                                                        
| 955 | 955 | 'type' => 'string',  | 
                                                        
@@ -963,10 +963,10 @@ discard block  | 
                                                    ||
| 963 | 963 | }  | 
                                                        
| 964 | 964 | continue; //skip the next stuff, we got the necessary fields here for this dataset.  | 
                                                        
| 965 | 965 |  				} else { | 
                                                        
| 966 | - $field_id = $template_field . '-content';  | 
                                                        |
| 966 | + $field_id = $template_field.'-content';  | 
                                                        |
| 967 | 967 | $template_form_fields[$field_id] = $field_setup_array;  | 
                                                        
| 968 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';  | 
                                                        |
| 969 | -					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : ''; | 
                                                        |
| 968 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';  | 
                                                        |
| 969 | +					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : ''; | 
                                                        |
| 970 | 970 | |
| 971 | 971 | //do we have a validator error for this field? if we do then we'll use that value instead  | 
                                                        
| 972 | 972 | $template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];  | 
                                                        
@@ -974,12 +974,12 @@ discard block  | 
                                                    ||
| 974 | 974 | |
| 975 | 975 | $template_form_fields[$field_id]['db-col'] = 'MTP_content';  | 
                                                        
| 976 | 976 | $css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';  | 
                                                        
| 977 | - $template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;  | 
                                                        |
| 977 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;  | 
                                                        |
| 978 | 978 | |
| 979 | 979 | //shortcode selector  | 
                                                        
| 980 | - $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $template_field, $field_id );  | 
                                                        |
| 980 | + $template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($template_field, $field_id);  | 
                                                        |
| 981 | 981 | |
| 982 | -					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) { | 
                                                        |
| 982 | +					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') { | 
                                                        |
| 983 | 983 | //we want to decode the entities  | 
                                                        
| 984 | 984 | $template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];  | 
                                                        
| 985 | 985 | }/**/  | 
                                                        
@@ -987,25 +987,25 @@ discard block  | 
                                                    ||
| 987 | 987 | |
| 988 | 988 | //k took care of content field(s) now let's take care of others.  | 
                                                        
| 989 | 989 | |
| 990 | - $templatefield_MTP_id = $template_field . '-MTP_ID';  | 
                                                        |
| 991 | - $templatefield_field_templatename_id = $template_field . '-name';  | 
                                                        |
| 990 | + $templatefield_MTP_id = $template_field.'-MTP_ID';  | 
                                                        |
| 991 | + $templatefield_field_templatename_id = $template_field.'-name';  | 
                                                        |
| 992 | 992 | |
| 993 | 993 | //foreach template field there are actually two form fields created  | 
                                                        
| 994 | 994 | $template_form_fields[$templatefield_MTP_id] = array(  | 
                                                        
| 995 | - 'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',  | 
                                                        |
| 995 | + 'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',  | 
                                                        |
| 996 | 996 | 'label' => NULL,  | 
                                                        
| 997 | 997 | 'input' => 'hidden',  | 
                                                        
| 998 | 998 | 'type' => 'int',  | 
                                                        
| 999 | 999 | 'required' => FALSE,  | 
                                                        
| 1000 | 1000 | 'validation' => TRUE,  | 
                                                        
| 1001 | - 'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',  | 
                                                        |
| 1001 | + 'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',  | 
                                                        |
| 1002 | 1002 | 'css_class' => '',  | 
                                                        
| 1003 | 1003 | 'format' => '%d',  | 
                                                        
| 1004 | 1004 | 'db-col' => 'MTP_ID'  | 
                                                        
| 1005 | 1005 | );  | 
                                                        
| 1006 | 1006 | |
| 1007 | 1007 | $template_form_fields[$templatefield_field_templatename_id] = array(  | 
                                                        
| 1008 | - 'name' => 'MTP_template_fields[' . $template_field . '][name]',  | 
                                                        |
| 1008 | + 'name' => 'MTP_template_fields['.$template_field.'][name]',  | 
                                                        |
| 1009 | 1009 | 'label' => NULL,  | 
                                                        
| 1010 | 1010 | 'input' => 'hidden',  | 
                                                        
| 1011 | 1011 | 'type' => 'string',  | 
                                                        
@@ -1149,15 +1149,15 @@ discard block  | 
                                                    ||
| 1149 | 1149 | 'value' => $GRP_ID  | 
                                                        
| 1150 | 1150 | );  | 
                                                        
| 1151 | 1151 | $sidebar_form_fields['ee-msg-evt-nonce'] = array(  | 
                                                        
| 1152 | - 'name' => $action . '_nonce',  | 
                                                        |
| 1152 | + 'name' => $action.'_nonce',  | 
                                                        |
| 1153 | 1153 | 'input' => 'hidden',  | 
                                                        
| 1154 | 1154 | 'type' => 'string',  | 
                                                        
| 1155 | - 'value' => wp_create_nonce( $action . '_nonce')  | 
                                                        |
| 1155 | + 'value' => wp_create_nonce($action.'_nonce')  | 
                                                        |
| 1156 | 1156 | );  | 
                                                        
| 1157 | 1157 | |
| 1158 | 1158 |  			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active'); | 
                                                        
| 1159 | 1159 | |
| 1160 | -			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) { | 
                                                        |
| 1160 | +			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) { | 
                                                        |
| 1161 | 1161 | $sidebar_form_fields['ee-msg-template-switch'] = array(  | 
                                                        
| 1162 | 1162 | 'name' => 'template_switch',  | 
                                                        
| 1163 | 1163 | 'input' => 'hidden',  | 
                                                        
@@ -1167,19 +1167,19 @@ discard block  | 
                                                    ||
| 1167 | 1167 | }  | 
                                                        
| 1168 | 1168 | |
| 1169 | 1169 | |
| 1170 | - $template_fields = $this->_generate_admin_form_fields( $template_form_fields );  | 
                                                        |
| 1171 | - $sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );  | 
                                                        |
| 1170 | + $template_fields = $this->_generate_admin_form_fields($template_form_fields);  | 
                                                        |
| 1171 | + $sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);  | 
                                                        |
| 1172 | 1172 | |
| 1173 | 1173 | |
| 1174 | 1174 | } //end if ( !empty($template_field_structure) )  | 
                                                        
| 1175 | 1175 | |
| 1176 | 1176 | //set extra content for publish box  | 
                                                        
| 1177 | 1177 | $this->_template_args['publish_box_extra_content'] = $sidebar_fields;  | 
                                                        
| 1178 | - $this->_set_publish_post_box_vars( 'id', $GRP_ID );  | 
                                                        |
| 1178 | +		$this->_set_publish_post_box_vars('id', $GRP_ID); | 
                                                        |
| 1179 | 1179 | |
| 1180 | 1180 | //add preview button  | 
                                                        
| 1181 | - $preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );  | 
                                                        |
| 1182 | -		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>'; | 
                                                        |
| 1181 | +		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url); | 
                                                        |
| 1182 | +		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>'; | 
                                                        |
| 1183 | 1183 | |
| 1184 | 1184 | |
| 1185 | 1185 | //setup context switcher  | 
                                                        
@@ -1206,16 +1206,16 @@ discard block  | 
                                                    ||
| 1206 | 1206 | $this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();  | 
                                                        
| 1207 | 1207 | $this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();  | 
                                                        
| 1208 | 1208 | |
| 1209 | - $this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';  | 
                                                        |
| 1209 | + $this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';  | 
                                                        |
| 1210 | 1210 | |
| 1211 | 1211 | //send along EE_Message_Template_Group object for further template use.  | 
                                                        
| 1212 | 1212 | $this->_template_args['MTP'] = $message_template_group;  | 
                                                        
| 1213 | 1213 | |
| 1214 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );  | 
                                                        |
| 1214 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);  | 
                                                        |
| 1215 | 1215 | |
| 1216 | 1216 | |
| 1217 | 1217 | //finally, let's set the admin_page title  | 
                                                        
| 1218 | -		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title ); | 
                                                        |
| 1218 | +		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title); | 
                                                        |
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | 1221 | //we need to take care of setting the shortcodes property for use elsewhere.  | 
                                                        
@@ -1228,7 +1228,7 @@ discard block  | 
                                                    ||
| 1228 | 1228 | }  | 
                                                        
| 1229 | 1229 | |
| 1230 | 1230 | |
| 1231 | -	public function filter_tinymce_init( $mceInit, $editor_id ) { | 
                                                        |
| 1231 | +	public function filter_tinymce_init($mceInit, $editor_id) { | 
                                                        |
| 1232 | 1232 | return $mceInit;  | 
                                                        
| 1233 | 1233 | }  | 
                                                        
| 1234 | 1234 | |
@@ -1239,7 +1239,7 @@ discard block  | 
                                                    ||
| 1239 | 1239 | }  | 
                                                        
| 1240 | 1240 | |
| 1241 | 1241 |  	public function _add_form_element_before() { | 
                                                        
| 1242 | - return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';  | 
                                                        |
| 1242 | + return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';  | 
                                                        |
| 1243 | 1243 | }  | 
                                                        
| 1244 | 1244 | |
| 1245 | 1245 |  	public function _add_form_element_after() { | 
                                                        
@@ -1257,32 +1257,32 @@ discard block  | 
                                                    ||
| 1257 | 1257 | * @return json json object  | 
                                                        
| 1258 | 1258 | */  | 
                                                        
| 1259 | 1259 |  	public function switch_template_pack() { | 
                                                        
| 1260 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 1261 | - $template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';  | 
                                                        |
| 1260 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 1261 | + $template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';  | 
                                                        |
| 1262 | 1262 | |
| 1263 | 1263 | //verify we have needed values.  | 
                                                        
| 1264 | -		if ( empty( $GRP_ID ) || empty( $template_pack ) ) { | 
                                                        |
| 1264 | +		if (empty($GRP_ID) || empty($template_pack)) { | 
                                                        |
| 1265 | 1265 | $this->_template_args['error'] = TRUE;  | 
                                                        
| 1266 | -			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  ); | 
                                                        |
| 1266 | +			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1267 | 1267 |  		} else { | 
                                                        
| 1268 | 1268 | //get template, set the new template_pack and then reset to default  | 
                                                        
| 1269 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );  | 
                                                        |
| 1269 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);  | 
                                                        |
| 1270 | 1270 | |
| 1271 | - $mtpg->set_template_pack_name( $template_pack );  | 
                                                        |
| 1271 | + $mtpg->set_template_pack_name($template_pack);  | 
                                                        |
| 1272 | 1272 | $this->_req_data['msgr'] = $mtpg->messenger();  | 
                                                        
| 1273 | 1273 | $this->_req_data['mt'] = $mtpg->message_type();  | 
                                                        
| 1274 | 1274 | |
| 1275 | 1275 | $query_args = $this->_reset_to_default_template();  | 
                                                        
| 1276 | 1276 | |
| 1277 | -			if ( empty( $query_args['id'] ) ) { | 
                                                        |
| 1278 | -				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1277 | +			if (empty($query_args['id'])) { | 
                                                        |
| 1278 | +				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1279 | 1279 | $this->_template_args['error'] = TRUE;  | 
                                                        
| 1280 | 1280 |  			} else { | 
                                                        
| 1281 | - $template_label =$mtpg->get_template_pack()->label;  | 
                                                        |
| 1281 | + $template_label = $mtpg->get_template_pack()->label;  | 
                                                        |
| 1282 | 1282 | $template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();  | 
                                                        
| 1283 | -				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) ); | 
                                                        |
| 1283 | +				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack)); | 
                                                        |
| 1284 | 1284 | //generate the redirect url for js.  | 
                                                        
| 1285 | - $url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );  | 
                                                        |
| 1285 | + $url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);  | 
                                                        |
| 1286 | 1286 | $this->_template_args['data']['redirect_url'] = $url;  | 
                                                        
| 1287 | 1287 | $this->_template_args['success'] = true;  | 
                                                        
| 1288 | 1288 | }  | 
                                                        
@@ -1303,56 +1303,56 @@ discard block  | 
                                                    ||
| 1303 | 1303 |  	protected function _reset_to_default_template() { | 
                                                        
| 1304 | 1304 | $success = TRUE;  | 
                                                        
| 1305 | 1305 | $templates = array();  | 
                                                        
| 1306 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 1306 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 1307 | 1307 | //we need to make sure we've got the info we need.  | 
                                                        
| 1308 | -		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) { | 
                                                        |
| 1309 | -			EE_Error::add_error( __('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1308 | +		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) { | 
                                                        |
| 1309 | +			EE_Error::add_error(__('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1310 | 1310 | $success = FALSE;  | 
                                                        
| 1311 | 1311 | }  | 
                                                        
| 1312 | 1312 | |
| 1313 | 1313 | //all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.  | 
                                                        
| 1314 | - $success = !empty( $GRP_ID ) ? TRUE : FALSE;  | 
                                                        |
| 1314 | + $success = ! empty($GRP_ID) ? TRUE : FALSE;  | 
                                                        |
| 1315 | 1315 | |
| 1316 | -		if ( $success ) { | 
                                                        |
| 1316 | +		if ($success) { | 
                                                        |
| 1317 | 1317 | |
| 1318 | 1318 | //let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.  | 
                                                        
| 1319 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );  | 
                                                        |
| 1319 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);  | 
                                                        |
| 1320 | 1320 | |
| 1321 | 1321 | |
| 1322 | 1322 | //note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.  | 
                                                        
| 1323 | - $success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );  | 
                                                        |
| 1323 | + $success = $this->_delete_mtp_permanently($GRP_ID, FALSE);  | 
                                                        |
| 1324 | 1324 | |
| 1325 | -			if ( $success ) { | 
                                                        |
| 1325 | +			if ($success) { | 
                                                        |
| 1326 | 1326 | //if successfully deleted, lets generate the new ones. Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration. This means that if a custom template is reset it resets to whatever the related global template is. HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.  | 
                                                        
| 1327 | - $templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );  | 
                                                        |
| 1327 | + $templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);  | 
                                                        |
| 1328 | 1328 | }  | 
                                                        
| 1329 | 1329 | |
| 1330 | 1330 | }  | 
                                                        
| 1331 | 1331 | |
| 1332 | 1332 | //any error messages?  | 
                                                        
| 1333 | -		if ( !$success ) { | 
                                                        |
| 1334 | -			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1333 | +		if ( ! $success) { | 
                                                        |
| 1334 | +			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1335 | 1335 | }  | 
                                                        
| 1336 | 1336 | |
| 1337 | 1337 | //all good, let's add a success message!  | 
                                                        
| 1338 | -		if ( $success && ! empty( $templates ) ) { | 
                                                        |
| 1338 | +		if ($success && ! empty($templates)) { | 
                                                        |
| 1339 | 1339 | $templates = $templates[0]; //the info for the template we generated is the first element in the returned array.  | 
                                                        
| 1340 | 1340 | EE_Error::overwrite_success();  | 
                                                        
| 1341 | -			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') ); | 
                                                        |
| 1341 | +			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso')); | 
                                                        |
| 1342 | 1342 | }  | 
                                                        
| 1343 | 1343 | |
| 1344 | 1344 | |
| 1345 | 1345 | $query_args = array(  | 
                                                        
| 1346 | - 'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,  | 
                                                        |
| 1347 | - 'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,  | 
                                                        |
| 1348 | - 'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'  | 
                                                        |
| 1346 | + 'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,  | 
                                                        |
| 1347 | + 'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,  | 
                                                        |
| 1348 | + 'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'  | 
                                                        |
| 1349 | 1349 | );  | 
                                                        
| 1350 | 1350 | |
| 1351 | 1351 | //if called via ajax then we return query args otherwise redirect  | 
                                                        
| 1352 | -		if ( defined('DOING_AJAX') && DOING_AJAX ) { | 
                                                        |
| 1352 | +		if (defined('DOING_AJAX') && DOING_AJAX) { | 
                                                        |
| 1353 | 1353 | return $query_args;  | 
                                                        
| 1354 | 1354 |  		} else { | 
                                                        
| 1355 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 1355 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 1356 | 1356 | }  | 
                                                        
| 1357 | 1357 | |
| 1358 | 1358 | }  | 
                                                        
@@ -1365,20 +1365,20 @@ discard block  | 
                                                    ||
| 1365 | 1365 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.  | 
                                                        
| 1366 | 1366 | * @return void  | 
                                                        
| 1367 | 1367 | */  | 
                                                        
| 1368 | -	public function _preview_message( $send = FALSE ) { | 
                                                        |
| 1368 | +	public function _preview_message($send = FALSE) { | 
                                                        |
| 1369 | 1369 | //first make sure we've got the necessary parameters  | 
                                                        
| 1370 | -		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) { | 
                                                        |
| 1371 | -			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1370 | +		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) { | 
                                                        |
| 1371 | +			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1372 | 1372 | }  | 
                                                        
| 1373 | 1373 | |
| 1374 | - EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );  | 
                                                        |
| 1374 | +		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']); | 
                                                        |
| 1375 | 1375 | |
| 1376 | 1376 | $MSG = new EE_messages();  | 
                                                        
| 1377 | 1377 | |
| 1378 | 1378 | //get the preview!  | 
                                                        
| 1379 | - $preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );  | 
                                                        |
| 1379 | + $preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);  | 
                                                        |
| 1380 | 1380 | |
| 1381 | -		if ( $send ) { | 
                                                        |
| 1381 | +		if ($send) { | 
                                                        |
| 1382 | 1382 | return $preview;  | 
                                                        
| 1383 | 1383 | }  | 
                                                        
| 1384 | 1384 | |
@@ -1388,16 +1388,16 @@ discard block  | 
                                                    ||
| 1388 | 1388 | 'context' => $this->_req_data['context'],  | 
                                                        
| 1389 | 1389 | 'action' => 'edit_message_template'  | 
                                                        
| 1390 | 1390 | );  | 
                                                        
| 1391 | - $go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );  | 
                                                        |
| 1392 | -		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>'; | 
                                                        |
| 1391 | + $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);  | 
                                                        |
| 1392 | +		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>'; | 
                                                        |
| 1393 | 1393 | |
| 1394 | 1394 | //let's provide a helpful title for context  | 
                                                        
| 1395 | -		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) ); | 
                                                        |
| 1395 | +		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular'])); | 
                                                        |
| 1396 | 1396 | |
| 1397 | 1397 | |
| 1398 | 1398 | //setup display of preview.  | 
                                                        
| 1399 | 1399 | $this->_admin_page_title = $preview_title;  | 
                                                        
| 1400 | - $this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);  | 
                                                        |
| 1400 | + $this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);  | 
                                                        |
| 1401 | 1401 | $this->_template_args['data']['force_json'] = TRUE;  | 
                                                        
| 1402 | 1402 | }  | 
                                                        
| 1403 | 1403 | |
@@ -1425,9 +1425,9 @@ discard block  | 
                                                    ||
| 1425 | 1425 | * @return void  | 
                                                        
| 1426 | 1426 | */  | 
                                                        
| 1427 | 1427 |  	protected function _register_edit_meta_boxes() { | 
                                                        
| 1428 | -		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' ); | 
                                                        |
| 1429 | -		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' ); | 
                                                        |
| 1430 | -		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' ); | 
                                                        |
| 1428 | +		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default'); | 
                                                        |
| 1429 | +		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high'); | 
                                                        |
| 1430 | +		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high'); | 
                                                        |
| 1431 | 1431 | }  | 
                                                        
| 1432 | 1432 | |
| 1433 | 1433 | |
@@ -1448,10 +1448,10 @@ discard block  | 
                                                    ||
| 1448 | 1448 | |
| 1449 | 1449 | $tp_select_values = array();  | 
                                                        
| 1450 | 1450 | |
| 1451 | -		foreach ( $template_packs as $tp ) { | 
                                                        |
| 1451 | +		foreach ($template_packs as $tp) { | 
                                                        |
| 1452 | 1452 | //only include template packs that support this messenger and message type!  | 
                                                        
| 1453 | 1453 | $supports = $tp->get_supports();  | 
                                                        
| 1454 | -			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) { | 
                                                        |
| 1454 | +			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) { | 
                                                        |
| 1455 | 1455 | //not supported  | 
                                                        
| 1456 | 1456 | continue;  | 
                                                        
| 1457 | 1457 | }  | 
                                                        
@@ -1463,7 +1463,7 @@ discard block  | 
                                                    ||
| 1463 | 1463 | }  | 
                                                        
| 1464 | 1464 | |
| 1465 | 1465 | //if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack. This still allows for the odd template pack to override.  | 
                                                        
| 1466 | -		if ( empty( $tp_select_values ) ) { | 
                                                        |
| 1466 | +		if (empty($tp_select_values)) { | 
                                                        |
| 1467 | 1467 | $tp_select_values[] = array(  | 
                                                        
| 1468 | 1468 |  				'text' => __('Default', 'event_espresso'), | 
                                                        
| 1469 | 1469 | 'id' => 'default'  | 
                                                        
@@ -1471,27 +1471,27 @@ discard block  | 
                                                    ||
| 1471 | 1471 | }  | 
                                                        
| 1472 | 1472 | |
| 1473 | 1473 | //setup variation select values for the currently selected template.  | 
                                                        
| 1474 | - $variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );  | 
                                                        |
| 1474 | + $variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());  | 
                                                        |
| 1475 | 1475 | $variations_select_values = array();  | 
                                                        
| 1476 | -		foreach ( $variations as $variation => $label ) { | 
                                                        |
| 1476 | +		foreach ($variations as $variation => $label) { | 
                                                        |
| 1477 | 1477 | $variations_select_values[] = array(  | 
                                                        
| 1478 | 1478 | 'text' => $label,  | 
                                                        
| 1479 | 1479 | 'id' => $variation  | 
                                                        
| 1480 | 1480 | );  | 
                                                        
| 1481 | 1481 | }  | 
                                                        
| 1482 | 1482 | |
| 1483 | - $template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();  | 
                                                        |
| 1483 | + $template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();  | 
                                                        |
| 1484 | 1484 | |
| 1485 | - $template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );  | 
                                                        |
| 1486 | - $template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );  | 
                                                        |
| 1485 | +		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name()); | 
                                                        |
| 1486 | +		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation()); | 
                                                        |
| 1487 | 1487 | $template_args['template_pack_label'] = $template_pack_labels->template_pack;  | 
                                                        
| 1488 | 1488 | $template_args['template_variation_label'] = $template_pack_labels->template_variation;  | 
                                                        
| 1489 | 1489 | $template_args['template_pack_description'] = $template_pack_labels->template_pack_description;  | 
                                                        
| 1490 | 1490 | $template_args['template_variation_description'] = $template_pack_labels->template_variation_description;  | 
                                                        
| 1491 | 1491 | |
| 1492 | - $template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';  | 
                                                        |
| 1492 | + $template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';  | 
                                                        |
| 1493 | 1493 | |
| 1494 | - EEH_Template::display_template( $template, $template_args );  | 
                                                        |
| 1494 | + EEH_Template::display_template($template, $template_args);  | 
                                                        |
| 1495 | 1495 | }  | 
                                                        
| 1496 | 1496 | |
| 1497 | 1497 | |
@@ -1512,52 +1512,52 @@ discard block  | 
                                                    ||
| 1512 | 1512 | 'GRP_ID' => $this->_message_template_group->GRP_ID()  | 
                                                        
| 1513 | 1513 | );  | 
                                                        
| 1514 | 1514 | |
| 1515 | - $button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );  | 
                                                        |
| 1515 | +		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button'); | 
                                                        |
| 1516 | 1516 | |
| 1517 | 1517 | |
| 1518 | 1518 | //test button  | 
                                                        
| 1519 | 1519 | //first we need to see if there are any fields  | 
                                                        
| 1520 | 1520 | $fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();  | 
                                                        
| 1521 | 1521 | |
| 1522 | -		if ( !empty( $fields ) ) { | 
                                                        |
| 1522 | +		if ( ! empty($fields)) { | 
                                                        |
| 1523 | 1523 | //yup there be fields  | 
                                                        
| 1524 | -			foreach ( $fields as $field => $config ) { | 
                                                        |
| 1525 | - $field_id = $this->_message_template_group->messenger() . '_' . $field;  | 
                                                        |
| 1524 | +			foreach ($fields as $field => $config) { | 
                                                        |
| 1525 | + $field_id = $this->_message_template_group->messenger().'_'.$field;  | 
                                                        |
| 1526 | 1526 | $existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();  | 
                                                        
| 1527 | - $default = isset( $config['default'] ) ? $config['default'] : '';  | 
                                                        |
| 1528 | - $default = isset( $config['value'] ) ? $config['value'] : $default;  | 
                                                        |
| 1527 | + $default = isset($config['default']) ? $config['default'] : '';  | 
                                                        |
| 1528 | + $default = isset($config['value']) ? $config['value'] : $default;  | 
                                                        |
| 1529 | 1529 | |
| 1530 | 1530 | //if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults  | 
                                                        
| 1531 | 1531 | $fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';  | 
                                                        
| 1532 | - $existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;  | 
                                                        |
| 1532 | + $existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;  | 
                                                        |
| 1533 | 1533 | |
| 1534 | 1534 | $template_form_fields[$field_id] = array(  | 
                                                        
| 1535 | - 'name' => 'test_settings_fld[' . $field . ']',  | 
                                                        |
| 1535 | + 'name' => 'test_settings_fld['.$field.']',  | 
                                                        |
| 1536 | 1536 | 'label' => $config['label'],  | 
                                                        
| 1537 | 1537 | 'input' => $config['input'],  | 
                                                        
| 1538 | 1538 | 'type' => $config['type'],  | 
                                                        
| 1539 | 1539 | 'required' => $config['required'],  | 
                                                        
| 1540 | 1540 | 'validation' => $config['validation'],  | 
                                                        
| 1541 | - 'value' => isset( $existing[$field] ) ? $existing[$field] : $default,  | 
                                                        |
| 1541 | + 'value' => isset($existing[$field]) ? $existing[$field] : $default,  | 
                                                        |
| 1542 | 1542 | 'css_class' => $config['css_class'],  | 
                                                        
| 1543 | - 'options' => isset( $config['options'] ) ? $config['options'] : array(),  | 
                                                        |
| 1543 | + 'options' => isset($config['options']) ? $config['options'] : array(),  | 
                                                        |
| 1544 | 1544 | 'default' => $default,  | 
                                                        
| 1545 | 1545 | 'format' => $config['format']  | 
                                                        
| 1546 | 1546 | );  | 
                                                        
| 1547 | 1547 | }  | 
                                                        
| 1548 | 1548 | }  | 
                                                        
| 1549 | 1549 | |
| 1550 | - $test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';  | 
                                                        |
| 1550 | + $test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';  | 
                                                        |
| 1551 | 1551 | |
| 1552 | 1552 | $test_settings_html = '';  | 
                                                        
| 1553 | 1553 | //print out $test_settings_fields  | 
                                                        
| 1554 | -		if ( !empty( $test_settings_fields ) ) { | 
                                                        |
| 1554 | +		if ( ! empty($test_settings_fields)) { | 
                                                        |
| 1555 | 1555 | echo $test_settings_fields;  | 
                                                        
| 1556 | -			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>'; | 
                                                        |
| 1556 | +			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>'; | 
                                                        |
| 1557 | 1557 | }  | 
                                                        
| 1558 | 1558 | |
| 1559 | 1559 | //and button  | 
                                                        
| 1560 | -		echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>'; | 
                                                        |
| 1560 | +		echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>'; | 
                                                        |
| 1561 | 1561 | }  | 
                                                        
| 1562 | 1562 | |
| 1563 | 1563 | |
@@ -1572,13 +1572,13 @@ discard block  | 
                                                    ||
| 1572 | 1572 | * @param string $linked_input_id The css id of the input that the shortcodes get added to.  | 
                                                        
| 1573 | 1573 | * @return string  | 
                                                        
| 1574 | 1574 | */  | 
                                                        
| 1575 | -	protected function _get_shortcode_selector( $field, $linked_input_id ) { | 
                                                        |
| 1575 | +	protected function _get_shortcode_selector($field, $linked_input_id) { | 
                                                        |
| 1576 | 1576 | $template_args = array(  | 
                                                        
| 1577 | - 'shortcodes' => $this->_get_shortcodes( array( $field ), true ),  | 
                                                        |
| 1577 | + 'shortcodes' => $this->_get_shortcodes(array($field), true),  | 
                                                        |
| 1578 | 1578 | 'fieldname' => $field,  | 
                                                        
| 1579 | 1579 | 'linked_input_id' => $linked_input_id  | 
                                                        
| 1580 | 1580 | );  | 
                                                        
| 1581 | - return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );  | 
                                                        |
| 1581 | + return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);  | 
                                                        |
| 1582 | 1582 | }  | 
                                                        
| 1583 | 1583 | |
| 1584 | 1584 | |
@@ -1592,13 +1592,13 @@ discard block  | 
                                                    ||
| 1592 | 1592 | $shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set  | 
                                                        
| 1593 | 1593 | $messenger = $this->_message_template_group->messenger_obj();  | 
                                                        
| 1594 | 1594 | //now let's set the content depending on the status of the shortcodes array  | 
                                                        
| 1595 | -		if ( empty( $shortcodes ) ) { | 
                                                        |
| 1596 | -			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>'; | 
                                                        |
| 1595 | +		if (empty($shortcodes)) { | 
                                                        |
| 1596 | +			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>'; | 
                                                        |
| 1597 | 1597 | echo $content;  | 
                                                        
| 1598 | 1598 |  		} else { | 
                                                        
| 1599 | 1599 | $alt = 0;  | 
                                                        
| 1600 | 1600 | ?>  | 
                                                        
| 1601 | -			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p> | 
                                                        |
| 1601 | +			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p> | 
                                                        |
| 1602 | 1602 | <?php  | 
                                                        
| 1603 | 1603 | }  | 
                                                        
| 1604 | 1604 | |
@@ -1615,7 +1615,7 @@ discard block  | 
                                                    ||
| 1615 | 1615 |  	protected function _set_shortcodes() { | 
                                                        
| 1616 | 1616 | |
| 1617 | 1617 | //no need to run this if the property is already set  | 
                                                        
| 1618 | - if ( !empty($this->_shortcodes ) ) return;  | 
                                                        |
| 1618 | + if ( ! empty($this->_shortcodes)) return;  | 
                                                        |
| 1619 | 1619 | |
| 1620 | 1620 | $this->_shortcodes = $this->_get_shortcodes();  | 
                                                        
| 1621 | 1621 | }  | 
                                                        
@@ -1632,14 +1632,14 @@ discard block  | 
                                                    ||
| 1632 | 1632 | * @param boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes  | 
                                                        
| 1633 | 1633 | * @return array Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true just an array of shortcode/label pairs.  | 
                                                        
| 1634 | 1634 | */  | 
                                                        
| 1635 | -	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) { | 
                                                        |
| 1635 | +	protected function _get_shortcodes($fields = array(), $merged = TRUE) { | 
                                                        |
| 1636 | 1636 | $this->_set_message_template_group();  | 
                                                        
| 1637 | 1637 | |
| 1638 | 1638 | //we need the messenger and message template to retrieve the valid shortcodes array.  | 
                                                        
| 1639 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;  | 
                                                        |
| 1640 | - $context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );  | 
                                                        |
| 1639 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;  | 
                                                        |
| 1640 | + $context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());  | 
                                                        |
| 1641 | 1641 | |
| 1642 | - return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();  | 
                                                        |
| 1642 | + return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();  | 
                                                        |
| 1643 | 1643 | }  | 
                                                        
| 1644 | 1644 | |
| 1645 | 1645 | |
@@ -1652,19 +1652,19 @@ discard block  | 
                                                    ||
| 1652 | 1652 | */  | 
                                                        
| 1653 | 1653 |  	protected function _set_message_template_group() { | 
                                                        
| 1654 | 1654 | |
| 1655 | - if ( !empty( $this->_message_template_group ) )  | 
                                                        |
| 1655 | + if ( ! empty($this->_message_template_group))  | 
                                                        |
| 1656 | 1656 | return; //get out if this is already set.  | 
                                                        
| 1657 | 1657 | |
| 1658 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;  | 
                                                        |
| 1659 | - $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;  | 
                                                        |
| 1658 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;  | 
                                                        |
| 1659 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;  | 
                                                        |
| 1660 | 1660 | |
| 1661 | 1661 | //let's get the message templates  | 
                                                        
| 1662 | 1662 | $MTP = EEM_Message_Template_Group::instance();  | 
                                                        
| 1663 | 1663 | |
| 1664 | - if ( empty($GRP_ID) )  | 
                                                        |
| 1664 | + if (empty($GRP_ID))  | 
                                                        |
| 1665 | 1665 | $this->_message_template_group = $MTP->create_default_object();  | 
                                                        
| 1666 | 1666 | else  | 
                                                        
| 1667 | - $this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );  | 
                                                        |
| 1667 | + $this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);  | 
                                                        |
| 1668 | 1668 | |
| 1669 | 1669 | $this->_template_pack = $this->_message_template_group->get_template_pack();  | 
                                                        
| 1670 | 1670 | $this->_variation = $this->_message_template_group->get_template_pack_variation();  | 
                                                        
@@ -1690,26 +1690,26 @@ discard block  | 
                                                    ||
| 1690 | 1690 | <div class="ee-msg-switcher-container">  | 
                                                        
| 1691 | 1691 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">  | 
                                                        
| 1692 | 1692 | <?php  | 
                                                        
| 1693 | -					foreach ( $args as $name => $value ) { | 
                                                        |
| 1694 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;  | 
                                                        |
| 1693 | +					foreach ($args as $name => $value) { | 
                                                        |
| 1694 | + if ($name == 'context' || empty($value) || $name == 'extra') continue;  | 
                                                        |
| 1695 | 1695 | ?>  | 
                                                        
| 1696 | 1696 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />  | 
                                                        
| 1697 | 1697 | <?php  | 
                                                        
| 1698 | 1698 | }  | 
                                                        
| 1699 | 1699 | //setup nonce_url  | 
                                                        
| 1700 | - wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);  | 
                                                        |
| 1700 | + wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);  | 
                                                        |
| 1701 | 1701 | ?>  | 
                                                        
| 1702 | 1702 | <select name="context">  | 
                                                        
| 1703 | 1703 | <?php  | 
                                                        
| 1704 | 1704 | $context_templates = $template_group_object->context_templates();  | 
                                                        
| 1705 | - if ( is_array($context_templates) ) :  | 
                                                        |
| 1706 | - foreach ( $context_templates as $context => $template_fields ) :  | 
                                                        |
| 1705 | + if (is_array($context_templates)) :  | 
                                                        |
| 1706 | + foreach ($context_templates as $context => $template_fields) :  | 
                                                        |
| 1707 | 1707 | $checked = ($context == $args['context']) ? 'selected="selected"' : '';  | 
                                                        
| 1708 | 1708 | ?>  | 
                                                        
| 1709 | 1709 | <option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>  | 
                                                        
| 1710 | 1710 | <?php endforeach; endif; ?>  | 
                                                        
| 1711 | 1711 | </select>  | 
                                                        
| 1712 | -				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?> | 
                                                        |
| 1712 | +				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?> | 
                                                        |
| 1713 | 1713 | <input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">  | 
                                                        
| 1714 | 1714 | </form>  | 
                                                        
| 1715 | 1715 | <?php echo $args['extra']; ?>  | 
                                                        
@@ -1733,8 +1733,8 @@ discard block  | 
                                                    ||
| 1733 | 1733 | * @param int $index This helps us know which template field to select from the request array.  | 
                                                        
| 1734 | 1734 | */  | 
                                                        
| 1735 | 1735 |  	protected function _set_message_template_column_values($index) { | 
                                                        
| 1736 | -		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) { | 
                                                        |
| 1737 | -			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) { | 
                                                        |
| 1736 | +		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) { | 
                                                        |
| 1737 | +			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) { | 
                                                        |
| 1738 | 1738 | $this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;  | 
                                                        
| 1739 | 1739 | }  | 
                                                        
| 1740 | 1740 |  		} else { | 
                                                        
@@ -1766,27 +1766,27 @@ discard block  | 
                                                    ||
| 1766 | 1766 | |
| 1767 | 1767 | |
| 1768 | 1768 | |
| 1769 | -	protected function _insert_or_update_message_template($new = FALSE ) { | 
                                                        |
| 1769 | +	protected function _insert_or_update_message_template($new = FALSE) { | 
                                                        |
| 1770 | 1770 | |
| 1771 | - do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');  | 
                                                        |
| 1771 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 1772 | 1772 | $success = 0;  | 
                                                        
| 1773 | 1773 | $override = FALSE;  | 
                                                        
| 1774 | 1774 | |
| 1775 | 1775 | //setup notices description  | 
                                                        
| 1776 | -		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false; | 
                                                        |
| 1777 | -		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false; | 
                                                        |
| 1778 | -		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false; | 
                                                        |
| 1776 | +		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false; | 
                                                        |
| 1777 | +		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false; | 
                                                        |
| 1778 | +		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false; | 
                                                        |
| 1779 | 1779 | |
| 1780 | - $item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';  | 
                                                        |
| 1780 | + $item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';  | 
                                                        |
| 1781 | 1781 | $item_desc .= 'Message Template';  | 
                                                        
| 1782 | 1782 | $query_args = array();  | 
                                                        
| 1783 | 1783 | $validates = '';  | 
                                                        
| 1784 | 1784 | |
| 1785 | 1785 | //if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.  | 
                                                        
| 1786 | -		if ( $new ) { | 
                                                        |
| 1787 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 1788 | -			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) { | 
                                                        |
| 1789 | -				if ( empty($edit_array) ) { | 
                                                        |
| 1786 | +		if ($new) { | 
                                                        |
| 1787 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;  | 
                                                        |
| 1788 | +			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) { | 
                                                        |
| 1789 | +				if (empty($edit_array)) { | 
                                                        |
| 1790 | 1790 | $success = 0;  | 
                                                        
| 1791 | 1791 |  				} else { | 
                                                        
| 1792 | 1792 | $success = 1;  | 
                                                        
@@ -1805,34 +1805,34 @@ discard block  | 
                                                    ||
| 1805 | 1805 | |
| 1806 | 1806 | |
| 1807 | 1807 | //run update for each template field in displayed context  | 
                                                        
| 1808 | -			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) { | 
                                                        |
| 1809 | -				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1808 | +			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) { | 
                                                        |
| 1809 | +				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1810 | 1810 | $success = 0;  | 
                                                        
| 1811 | 1811 | $action_desc = '';  | 
                                                        
| 1812 | 1812 | |
| 1813 | 1813 |  			} else { | 
                                                        
| 1814 | 1814 | //first validate all fields!  | 
                                                        
| 1815 | - $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);  | 
                                                        |
| 1815 | + $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);  | 
                                                        |
| 1816 | 1816 | |
| 1817 | 1817 | //if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array. WE need to make sure there is no actual error messages in validates.  | 
                                                        
| 1818 | -				if ( is_array($validates) && !empty($validates) ) { | 
                                                        |
| 1818 | +				if (is_array($validates) && ! empty($validates)) { | 
                                                        |
| 1819 | 1819 | //add the transient so when the form loads we know which fields to highlight  | 
                                                        
| 1820 | - $this->_add_transient( 'edit_message_template', $validates );  | 
                                                        |
| 1820 | +					$this->_add_transient('edit_message_template', $validates); | 
                                                        |
| 1821 | 1821 | |
| 1822 | 1822 | $success = 0;  | 
                                                        
| 1823 | - $action_desc ='';  | 
                                                        |
| 1823 | + $action_desc = '';  | 
                                                        |
| 1824 | 1824 | |
| 1825 | 1825 | //setup notices  | 
                                                        
| 1826 | -					foreach ( $validates as $field => $error ) { | 
                                                        |
| 1827 | - if ( isset($error['msg'] ) )  | 
                                                        |
| 1828 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 1826 | +					foreach ($validates as $field => $error) { | 
                                                        |
| 1827 | + if (isset($error['msg']))  | 
                                                        |
| 1828 | + EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 1829 | 1829 | }  | 
                                                        
| 1830 | 1830 | |
| 1831 | 1831 |  				} else { | 
                                                        
| 1832 | -					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) { | 
                                                        |
| 1832 | +					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) { | 
                                                        |
| 1833 | 1833 | $set_column_values = $this->_set_message_template_column_values($template_field);  | 
                                                        
| 1834 | 1834 | |
| 1835 | - $where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);  | 
                                                        |
| 1835 | +						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']); | 
                                                        |
| 1836 | 1836 | |
| 1837 | 1837 | $message_template_fields = array(  | 
                                                        
| 1838 | 1838 | 'GRP_ID' => $set_column_values['GRP_ID'],  | 
                                                        
@@ -1840,10 +1840,10 @@ discard block  | 
                                                    ||
| 1840 | 1840 | 'MTP_context' => $set_column_values['MTP_context'],  | 
                                                        
| 1841 | 1841 | 'MTP_content' => $set_column_values['MTP_content']  | 
                                                        
| 1842 | 1842 | );  | 
                                                        
| 1843 | -						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) { | 
                                                        |
| 1844 | -							if ( $updated === FALSE ) { | 
                                                        |
| 1845 | -								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field ); | 
                                                        |
| 1846 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 1843 | +						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) { | 
                                                        |
| 1844 | +							if ($updated === FALSE) { | 
                                                        |
| 1845 | +								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field); | 
                                                        |
| 1846 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 1847 | 1847 |  							} else { | 
                                                        
| 1848 | 1848 | $success = 1;  | 
                                                        
| 1849 | 1849 | }  | 
                                                        
@@ -1860,24 +1860,24 @@ discard block  | 
                                                    ||
| 1860 | 1860 | 'MTP_is_override' => $set_column_values['MTP_is_override'],  | 
                                                        
| 1861 | 1861 | 'MTP_deleted' => $set_column_values['MTP_deleted'],  | 
                                                        
| 1862 | 1862 | 'MTP_is_active' => $set_column_values['MTP_is_active'],  | 
                                                        
| 1863 | - 'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',  | 
                                                        |
| 1864 | - 'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''  | 
                                                        |
| 1863 | + 'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',  | 
                                                        |
| 1864 | + 'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''  | 
                                                        |
| 1865 | 1865 | );  | 
                                                        
| 1866 | 1866 | |
| 1867 | -					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] ); | 
                                                        |
| 1868 | - $updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );  | 
                                                        |
| 1867 | +					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']); | 
                                                        |
| 1868 | + $updated = $MTPG->update($mtpg_fields, array($mtpg_where));  | 
                                                        |
| 1869 | 1869 | |
| 1870 | -					if ( $updated === FALSE ) { | 
                                                        |
| 1871 | -						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] ); | 
                                                        |
| 1872 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 1870 | +					if ($updated === FALSE) { | 
                                                        |
| 1871 | +						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']); | 
                                                        |
| 1872 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 1873 | 1873 |  					} else { | 
                                                        
| 1874 | 1874 | //k now we need to ensure the template_pack and template_variation fields are set.  | 
                                                        
| 1875 | - $template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';  | 
                                                        |
| 1876 | - $template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';  | 
                                                        |
| 1877 | - $mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );  | 
                                                        |
| 1878 | -						if ( $mtpg_obj instanceof EE_Message_Template_Group ) { | 
                                                        |
| 1879 | - $mtpg_obj->set_template_pack_name( $template_pack );  | 
                                                        |
| 1880 | - $mtpg_obj->set_template_pack_variation( $template_variation );  | 
                                                        |
| 1875 | + $template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';  | 
                                                        |
| 1876 | + $template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';  | 
                                                        |
| 1877 | + $mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);  | 
                                                        |
| 1878 | +						if ($mtpg_obj instanceof EE_Message_Template_Group) { | 
                                                        |
| 1879 | + $mtpg_obj->set_template_pack_name($template_pack);  | 
                                                        |
| 1880 | + $mtpg_obj->set_template_pack_variation($template_variation);  | 
                                                        |
| 1881 | 1881 | }  | 
                                                        
| 1882 | 1882 | $success = 1;  | 
                                                        
| 1883 | 1883 | }  | 
                                                        
@@ -1887,7 +1887,7 @@ discard block  | 
                                                    ||
| 1887 | 1887 | }  | 
                                                        
| 1888 | 1888 | |
| 1889 | 1889 | //we return things differently if doing ajax  | 
                                                        
| 1890 | -		if ( defined('DOING_AJAX') && DOING_AJAX ) { | 
                                                        |
| 1890 | +		if (defined('DOING_AJAX') && DOING_AJAX) { | 
                                                        |
| 1891 | 1891 | $this->_template_args['success'] = $success;  | 
                                                        
| 1892 | 1892 | $this->_template_args['error'] = ! $success ? TRUE : FALSE;  | 
                                                        
| 1893 | 1893 | $this->_template_args['content'] = '';  | 
                                                        
@@ -1895,9 +1895,9 @@ discard block  | 
                                                    ||
| 1895 | 1895 | 'grpID' => $edit_array['GRP_ID'],  | 
                                                        
| 1896 | 1896 | 'templateName' => $edit_array['template_name']  | 
                                                        
| 1897 | 1897 | );  | 
                                                        
| 1898 | -			if ( $success ) { | 
                                                        |
| 1898 | +			if ($success) { | 
                                                        |
| 1899 | 1899 | EE_Error::overwrite_success();  | 
                                                        
| 1900 | -				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') ); | 
                                                        |
| 1900 | +				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso')); | 
                                                        |
| 1901 | 1901 | }  | 
                                                        
| 1902 | 1902 | |
| 1903 | 1903 | $this->_return_json();  | 
                                                        
@@ -1905,13 +1905,13 @@ discard block  | 
                                                    ||
| 1905 | 1905 | |
| 1906 | 1906 | |
| 1907 | 1907 | //was a test send triggered?  | 
                                                        
| 1908 | -		if ( isset( $this->_req_data['test_button'] ) ) { | 
                                                        |
| 1908 | +		if (isset($this->_req_data['test_button'])) { | 
                                                        |
| 1909 | 1909 | EE_Error::overwrite_success();  | 
                                                        
| 1910 | - $this->_do_test_send( $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );  | 
                                                        |
| 1910 | + $this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);  | 
                                                        |
| 1911 | 1911 | $override = TRUE;  | 
                                                        
| 1912 | 1912 | }  | 
                                                        
| 1913 | 1913 | |
| 1914 | -		if ( empty( $query_args ) ) { | 
                                                        |
| 1914 | +		if (empty($query_args)) { | 
                                                        |
| 1915 | 1915 | $query_args = array(  | 
                                                        
| 1916 | 1916 | 'id' => $this->_req_data['GRP_ID'],  | 
                                                        
| 1917 | 1917 | 'context' => $this->_req_data['MTP_context'],  | 
                                                        
@@ -1919,7 +1919,7 @@ discard block  | 
                                                    ||
| 1919 | 1919 | );  | 
                                                        
| 1920 | 1920 | }  | 
                                                        
| 1921 | 1921 | |
| 1922 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );  | 
                                                        |
| 1922 | + $this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);  | 
                                                        |
| 1923 | 1923 | }  | 
                                                        
| 1924 | 1924 | |
| 1925 | 1925 | |
@@ -1932,24 +1932,24 @@ discard block  | 
                                                    ||
| 1932 | 1932 | * @param string $message_type message type being tested  | 
                                                        
| 1933 | 1933 | * @return void  | 
                                                        
| 1934 | 1934 | */  | 
                                                        
| 1935 | -	protected function _do_test_send( $context, $messenger, $message_type ) { | 
                                                        |
| 1935 | +	protected function _do_test_send($context, $messenger, $message_type) { | 
                                                        |
| 1936 | 1936 | //set things up for preview  | 
                                                        
| 1937 | 1937 | $this->_req_data['messenger'] = $messenger;  | 
                                                        
| 1938 | 1938 | $this->_req_data['message_type'] = $message_type;  | 
                                                        
| 1939 | 1939 | $this->_req_data['context'] = $context;  | 
                                                        
| 1940 | - $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';  | 
                                                        |
| 1940 | + $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';  | 
                                                        |
| 1941 | 1941 | |
| 1942 | 1942 | //let's save any existing fields that might be required by the messenger  | 
                                                        
| 1943 | -		if ( isset( $this->_req_data['test_settings_fld'] ) ) { | 
                                                        |
| 1944 | - $this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );  | 
                                                        |
| 1943 | +		if (isset($this->_req_data['test_settings_fld'])) { | 
                                                        |
| 1944 | + $this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);  | 
                                                        |
| 1945 | 1945 | }  | 
                                                        
| 1946 | 1946 | |
| 1947 | 1947 | $success = $this->_preview_message(TRUE);  | 
                                                        
| 1948 | 1948 | |
| 1949 | -		if ( $success ) { | 
                                                        |
| 1950 | -			EE_Error::add_success( __('Test message sent', 'event_espresso') ); | 
                                                        |
| 1949 | +		if ($success) { | 
                                                        |
| 1950 | +			EE_Error::add_success(__('Test message sent', 'event_espresso')); | 
                                                        |
| 1951 | 1951 |  		} else { | 
                                                        
| 1952 | -			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1952 | +			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1953 | 1953 | }  | 
                                                        
| 1954 | 1954 | }  | 
                                                        
| 1955 | 1955 | |
@@ -1971,12 +1971,12 @@ discard block  | 
                                                    ||
| 1971 | 1971 |  	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) { | 
                                                        
| 1972 | 1972 | |
| 1973 | 1973 | //if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.  | 
                                                        
| 1974 | - if ( empty( $message_types ) )  | 
                                                        |
| 1974 | + if (empty($message_types))  | 
                                                        |
| 1975 | 1975 | return true;  | 
                                                        
| 1976 | 1976 | |
| 1977 | - EE_Registry::instance()->load_helper( 'MSG_Template' );  | 
                                                        |
| 1977 | +		EE_Registry::instance()->load_helper('MSG_Template'); | 
                                                        |
| 1978 | 1978 | |
| 1979 | - return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);  | 
                                                        |
| 1979 | + return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);  | 
                                                        |
| 1980 | 1980 | |
| 1981 | 1981 | }  | 
                                                        
| 1982 | 1982 | |
@@ -1992,33 +1992,33 @@ discard block  | 
                                                    ||
| 1992 | 1992 | * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).  | 
                                                        
| 1993 | 1993 | * @return void  | 
                                                        
| 1994 | 1994 | */  | 
                                                        
| 1995 | -	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) { | 
                                                        |
| 1996 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 1995 | +	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) { | 
                                                        |
| 1996 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 1997 | 1997 | $MTP = EEM_Message_Template_Group::instance();  | 
                                                        
| 1998 | 1998 | |
| 1999 | 1999 | $success = 1;  | 
                                                        
| 2000 | 2000 | |
| 2001 | 2001 | //incoming GRP_IDs  | 
                                                        
| 2002 | -		if ( $all ) { | 
                                                        |
| 2002 | +		if ($all) { | 
                                                        |
| 2003 | 2003 | //Checkboxes  | 
                                                        
| 2004 | -			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) { | 
                                                        |
| 2004 | +			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 2005 | 2005 | //if array has more than one element then success message should be plural.  | 
                                                        
| 2006 | 2006 | //todo: what about nonce?  | 
                                                        
| 2007 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;  | 
                                                        |
| 2007 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;  | 
                                                        |
| 2008 | 2008 | |
| 2009 | 2009 | //cycle through checkboxes  | 
                                                        
| 2010 | -				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) { | 
                                                        |
| 2011 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );  | 
                                                        |
| 2012 | -					if ( ! $trashed_or_restored ) { | 
                                                        |
| 2010 | +				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 2011 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);  | 
                                                        |
| 2012 | +					if ( ! $trashed_or_restored) { | 
                                                        |
| 2013 | 2013 | $success = 0;  | 
                                                        
| 2014 | 2014 | }  | 
                                                        
| 2015 | 2015 | }  | 
                                                        
| 2016 | 2016 |  			} else { | 
                                                        
| 2017 | 2017 | //grab single GRP_ID and handle  | 
                                                        
| 2018 | - $GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;  | 
                                                        |
| 2019 | -				if ( ! empty( $GRP_ID ) ) { | 
                                                        |
| 2020 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );  | 
                                                        |
| 2021 | -					if ( ! $trashed_or_restored ) { | 
                                                        |
| 2018 | + $GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;  | 
                                                        |
| 2019 | +				if ( ! empty($GRP_ID)) { | 
                                                        |
| 2020 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);  | 
                                                        |
| 2021 | +					if ( ! $trashed_or_restored) { | 
                                                        |
| 2022 | 2022 | $success = 0;  | 
                                                        
| 2023 | 2023 | }  | 
                                                        
| 2024 | 2024 |  				} else { | 
                                                        
@@ -2030,13 +2030,13 @@ discard block  | 
                                                    ||
| 2030 | 2030 | |
| 2031 | 2031 |  		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); | 
                                                        
| 2032 | 2032 | |
| 2033 | -		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc; | 
                                                        |
| 2033 | +		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc; | 
                                                        |
| 2034 | 2034 | |
| 2035 | 2035 |  		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso'); | 
                                                        
| 2036 | 2036 | |
| 2037 | -		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; | 
                                                        |
| 2037 | +		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; | 
                                                        |
| 2038 | 2038 | |
| 2039 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, array() );  | 
                                                        |
| 2039 | + $this->_redirect_after_action($success, $item_desc, $action_desc, array());  | 
                                                        |
| 2040 | 2040 | |
| 2041 | 2041 | }  | 
                                                        
| 2042 | 2042 | |
@@ -2052,26 +2052,26 @@ discard block  | 
                                                    ||
| 2052 | 2052 | * @return void  | 
                                                        
| 2053 | 2053 | */  | 
                                                        
| 2054 | 2054 |  	protected function _delete_message_template() { | 
                                                        
| 2055 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 2055 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 2056 | 2056 | |
| 2057 | 2057 | $success = 1;  | 
                                                        
| 2058 | 2058 | |
| 2059 | 2059 | //checkboxes  | 
                                                        
| 2060 | -		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) { | 
                                                        |
| 2060 | +		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 2061 | 2061 | //if array has more than one element then success message should be plural  | 
                                                        
| 2062 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;  | 
                                                        |
| 2062 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;  | 
                                                        |
| 2063 | 2063 | |
| 2064 | 2064 | //cycle through bulk action checkboxes  | 
                                                        
| 2065 | -			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) { | 
                                                        |
| 2066 | - $success = $this->_delete_mtp_permanently( $GRP_ID );  | 
                                                        |
| 2065 | +			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 2066 | + $success = $this->_delete_mtp_permanently($GRP_ID);  | 
                                                        |
| 2067 | 2067 | }  | 
                                                        
| 2068 | 2068 |  		} else { | 
                                                        
| 2069 | 2069 | //grab single grp_id and delete  | 
                                                        
| 2070 | - $GRP_ID = absint($this->_req_data['id'] );  | 
                                                        |
| 2071 | - $success = $this->_delete_mtp_permanently( $GRP_ID );  | 
                                                        |
| 2070 | + $GRP_ID = absint($this->_req_data['id']);  | 
                                                        |
| 2071 | + $success = $this->_delete_mtp_permanently($GRP_ID);  | 
                                                        |
| 2072 | 2072 | }  | 
                                                        
| 2073 | 2073 | |
| 2074 | - $this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );  | 
                                                        |
| 2074 | + $this->_redirect_after_action($success, 'Message Templates', 'deleted', array());  | 
                                                        |
| 2075 | 2075 | |
| 2076 | 2076 | }  | 
                                                        
| 2077 | 2077 | |
@@ -2084,20 +2084,20 @@ discard block  | 
                                                    ||
| 2084 | 2084 | * @param bool $include_group whether to delete the Message Template Group as well.  | 
                                                        
| 2085 | 2085 | * @return success boolean to indicate the success of the deletes or not.  | 
                                                        
| 2086 | 2086 | */  | 
                                                        
| 2087 | -	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) { | 
                                                        |
| 2087 | +	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) { | 
                                                        |
| 2088 | 2088 | $success = 1;  | 
                                                        
| 2089 | 2089 | $MTPG = EEM_Message_Template_Group::instance();  | 
                                                        
| 2090 | 2090 | //first let's GET this group  | 
                                                        
| 2091 | - $MTG = $MTPG->get_one_by_ID( $GRP_ID );  | 
                                                        |
| 2091 | + $MTG = $MTPG->get_one_by_ID($GRP_ID);  | 
                                                        |
| 2092 | 2092 | //then delete permanently all the related Message Templates  | 
                                                        
| 2093 | - $deleted = $MTG->delete_related_permanently( 'Message_Template' );  | 
                                                        |
| 2093 | +		$deleted = $MTG->delete_related_permanently('Message_Template'); | 
                                                        |
| 2094 | 2094 | |
| 2095 | - if ( $deleted === 0 )  | 
                                                        |
| 2095 | + if ($deleted === 0)  | 
                                                        |
| 2096 | 2096 | $success = 0;  | 
                                                        
| 2097 | 2097 | |
| 2098 | 2098 | //now delete permanently this particular group  | 
                                                        
| 2099 | 2099 | |
| 2100 | -		if ( $include_group && ! $MTG->delete_permanently() ) { | 
                                                        |
| 2100 | +		if ($include_group && ! $MTG->delete_permanently()) { | 
                                                        |
| 2101 | 2101 | $success = 0;  | 
                                                        
| 2102 | 2102 | }  | 
                                                        
| 2103 | 2103 | return $success;  | 
                                                        
@@ -2115,7 +2115,7 @@ discard block  | 
                                                    ||
| 2115 | 2115 | * @return string  | 
                                                        
| 2116 | 2116 | */  | 
                                                        
| 2117 | 2117 |  	protected function _learn_more_about_message_templates_link() { | 
                                                        
| 2118 | -		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; | 
                                                        |
| 2118 | +		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>'; | 
                                                        |
| 2119 | 2119 | }  | 
                                                        
| 2120 | 2120 | |
| 2121 | 2121 | |
@@ -2129,14 +2129,14 @@ discard block  | 
                                                    ||
| 2129 | 2129 | */  | 
                                                        
| 2130 | 2130 |  	protected function _settings() { | 
                                                        
| 2131 | 2131 | |
| 2132 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' );  | 
                                                        |
| 2132 | +		EE_Registry::instance()->load_helper('Tabbed_Content'); | 
                                                        |
| 2133 | 2133 | |
| 2134 | 2134 | $this->_set_m_mt_settings();  | 
                                                        
| 2135 | 2135 | |
| 2136 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';  | 
                                                        |
| 2136 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';  | 
                                                        |
| 2137 | 2137 | |
| 2138 | 2138 | //let's setup the messenger tabs  | 
                                                        
| 2139 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );  | 
                                                        |
| 2139 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);  | 
                                                        |
| 2140 | 2140 | $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';  | 
                                                        
| 2141 | 2141 | $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';  | 
                                                        
| 2142 | 2142 | |
@@ -2155,10 +2155,10 @@ discard block  | 
                                                    ||
| 2155 | 2155 | */  | 
                                                        
| 2156 | 2156 |  	protected function _set_m_mt_settings() { | 
                                                        
| 2157 | 2157 | //first if this is already set then lets get out no need to regenerate data.  | 
                                                        
| 2158 | - if ( !empty($this->_m_mt_settings) )  | 
                                                        |
| 2158 | + if ( ! empty($this->_m_mt_settings))  | 
                                                        |
| 2159 | 2159 | return;  | 
                                                        
| 2160 | 2160 | |
| 2161 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';  | 
                                                        |
| 2161 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';  | 
                                                        |
| 2162 | 2162 | |
| 2163 | 2163 | //get all installed messengers and message_types  | 
                                                        
| 2164 | 2164 | $installed_message_objects = $this->_get_installed_message_objects();  | 
                                                        
@@ -2168,10 +2168,10 @@ discard block  | 
                                                    ||
| 2168 | 2168 | |
| 2169 | 2169 | //assemble the array for the _tab_text_links helper  | 
                                                        
| 2170 | 2170 | |
| 2171 | -		foreach ( $messengers as $messenger ) { | 
                                                        |
| 2171 | +		foreach ($messengers as $messenger) { | 
                                                        |
| 2172 | 2172 | $this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(  | 
                                                        
| 2173 | 2173 | 'label' => ucwords($messenger->label['singular']),  | 
                                                        
| 2174 | - 'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',  | 
                                                        |
| 2174 | + 'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',  | 
                                                        |
| 2175 | 2175 | 'href' => $messenger->name,  | 
                                                        
| 2176 | 2176 |  				'title' => __('Modify this Messenger', 'event_espresso'), | 
                                                        
| 2177 | 2177 | 'slug' => $messenger->name,  | 
                                                        
@@ -2181,23 +2181,23 @@ discard block  | 
                                                    ||
| 2181 | 2181 | $message_types_for_messenger = $messenger->get_valid_message_types();  | 
                                                        
| 2182 | 2182 | |
| 2183 | 2183 | //assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.  | 
                                                        
| 2184 | - $selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();  | 
                                                        |
| 2185 | -			foreach ( $message_types as $message_type ) { | 
                                                        |
| 2184 | + $selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();  | 
                                                        |
| 2185 | +			foreach ($message_types as $message_type) { | 
                                                        |
| 2186 | 2186 | //first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.  | 
                                                        
| 2187 | -				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) { | 
                                                        |
| 2187 | +				if ( ! in_array($message_type->name, $message_types_for_messenger)) { | 
                                                        |
| 2188 | 2188 | continue;  | 
                                                        
| 2189 | 2189 | }  | 
                                                        
| 2190 | 2190 | |
| 2191 | - $a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';  | 
                                                        |
| 2191 | + $a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';  | 
                                                        |
| 2192 | 2192 | |
| 2193 | 2193 | $this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(  | 
                                                        
| 2194 | 2194 | 'label' => ucwords($message_type->label['singular']),  | 
                                                        
| 2195 | - 'class' => 'message-type-' . $a_or_i,  | 
                                                        |
| 2196 | - 'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,  | 
                                                        |
| 2197 | - 'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),  | 
                                                        |
| 2198 | - 'href' => 'espresso_' . $message_type->name . '_message_type_settings',  | 
                                                        |
| 2195 | + 'class' => 'message-type-'.$a_or_i,  | 
                                                        |
| 2196 | + 'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,  | 
                                                        |
| 2197 | + 'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),  | 
                                                        |
| 2198 | + 'href' => 'espresso_'.$message_type->name.'_message_type_settings',  | 
                                                        |
| 2199 | 2199 |  						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'), | 
                                                        
| 2200 | - 'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),  | 
                                                        |
| 2200 | + 'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),  | 
                                                        |
| 2201 | 2201 | 'slug' => $message_type->name,  | 
                                                        
| 2202 | 2202 | 'active' => $a_or_i == 'active' ? TRUE : FALSE,  | 
                                                        
| 2203 | 2203 | 'obj' => $message_type  | 
                                                        
@@ -2214,34 +2214,34 @@ discard block  | 
                                                    ||
| 2214 | 2214 | * @param boolean $active Whether the message type is active or not  | 
                                                        
| 2215 | 2215 | * @return string html output for the content  | 
                                                        
| 2216 | 2216 | */  | 
                                                        
| 2217 | -	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) { | 
                                                        |
| 2217 | +	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) { | 
                                                        |
| 2218 | 2218 | //get message type fields  | 
                                                        
| 2219 | 2219 | $fields = $message_type->get_admin_settings_fields();  | 
                                                        
| 2220 | - $settings_template_args['template_form_fields']= '';  | 
                                                        |
| 2220 | + $settings_template_args['template_form_fields'] = '';  | 
                                                        |
| 2221 | 2221 | |
| 2222 | -		if ( !empty( $fields ) && $active ) { | 
                                                        |
| 2222 | +		if ( ! empty($fields) && $active) { | 
                                                        |
| 2223 | 2223 | |
| 2224 | - $existing_settings = $message_type->get_existing_admin_settings( $messenger->name );  | 
                                                        |
| 2224 | + $existing_settings = $message_type->get_existing_admin_settings($messenger->name);  | 
                                                        |
| 2225 | 2225 | |
| 2226 | -			foreach( $fields as $fldname => $fldprops ) { | 
                                                        |
| 2227 | - $field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;  | 
                                                        |
| 2226 | +			foreach ($fields as $fldname => $fldprops) { | 
                                                        |
| 2227 | + $field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;  | 
                                                        |
| 2228 | 2228 | $template_form_field[$field_id] = array(  | 
                                                        
| 2229 | - 'name' => 'message_type_settings[' . $fldname . ']',  | 
                                                        |
| 2229 | + 'name' => 'message_type_settings['.$fldname.']',  | 
                                                        |
| 2230 | 2230 | 'label' => $fldprops['label'],  | 
                                                        
| 2231 | 2231 | 'input' => $fldprops['field_type'],  | 
                                                        
| 2232 | 2232 | 'type' => $fldprops['value_type'],  | 
                                                        
| 2233 | 2233 | 'required' => $fldprops['required'],  | 
                                                        
| 2234 | 2234 | 'validation' => $fldprops['validation'],  | 
                                                        
| 2235 | - 'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],  | 
                                                        |
| 2236 | - 'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),  | 
                                                        |
| 2237 | - 'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],  | 
                                                        |
| 2235 | + 'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],  | 
                                                        |
| 2236 | + 'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),  | 
                                                        |
| 2237 | + 'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],  | 
                                                        |
| 2238 | 2238 | 'css_class' => 'no-drag',  | 
                                                        
| 2239 | 2239 | 'format' => $fldprops['format']  | 
                                                        
| 2240 | 2240 | );  | 
                                                        
| 2241 | 2241 | }  | 
                                                        
| 2242 | 2242 | |
| 2243 | 2243 | |
| 2244 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';  | 
                                                        |
| 2244 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';  | 
                                                        |
| 2245 | 2245 | }  | 
                                                        
| 2246 | 2246 | |
| 2247 | 2247 | $settings_template_args['description'] = $message_type->description;  | 
                                                        
@@ -2261,13 +2261,13 @@ discard block  | 
                                                    ||
| 2261 | 2261 | )  | 
                                                        
| 2262 | 2262 | );  | 
                                                        
| 2263 | 2263 | |
| 2264 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );  | 
                                                        |
| 2265 | - $settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';  | 
                                                        |
| 2264 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');  | 
                                                        |
| 2265 | + $settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';  | 
                                                        |
| 2266 | 2266 | |
| 2267 | 2267 | |
| 2268 | 2268 | |
| 2269 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';  | 
                                                        |
| 2270 | - $content = EEH_Template::display_template( $template, $settings_template_args, TRUE );  | 
                                                        |
| 2269 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';  | 
                                                        |
| 2270 | + $content = EEH_Template::display_template($template, $settings_template_args, TRUE);  | 
                                                        |
| 2271 | 2271 | return $content;  | 
                                                        
| 2272 | 2272 | }  | 
                                                        
| 2273 | 2273 | |
@@ -2284,21 +2284,21 @@ discard block  | 
                                                    ||
| 2284 | 2284 | $m_boxes = $mt_boxes = array();  | 
                                                        
| 2285 | 2285 | $m_template_args = $mt_template_args = array();  | 
                                                        
| 2286 | 2286 | |
| 2287 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';  | 
                                                        |
| 2287 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';  | 
                                                        |
| 2288 | 2288 | |
| 2289 | -		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) { | 
                                                        |
| 2289 | +		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) { | 
                                                        |
| 2290 | 2290 | |
| 2291 | - $hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';  | 
                                                        |
| 2292 | - $hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';  | 
                                                        |
| 2291 | + $hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';  | 
                                                        |
| 2292 | + $hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';  | 
                                                        |
| 2293 | 2293 | |
| 2294 | 2294 | //messenger meta boxes  | 
                                                        
| 2295 | 2295 | $active = $selected_messenger == $messenger ? TRUE : FALSE;  | 
                                                        
| 2296 | - $active_mt_tabs = isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';  | 
                                                        |
| 2297 | -			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] ); | 
                                                        |
| 2298 | - $m_template_args[$messenger . '_a_box'] = array(  | 
                                                        |
| 2299 | - 'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',  | 
                                                        |
| 2300 | - 'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',  | 
                                                        |
| 2301 | - 'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),  | 
                                                        |
| 2296 | + $active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';  | 
                                                        |
| 2297 | +			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']); | 
                                                        |
| 2298 | + $m_template_args[$messenger.'_a_box'] = array(  | 
                                                        |
| 2299 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',  | 
                                                        |
| 2300 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',  | 
                                                        |
| 2301 | + 'content' => $this->_get_messenger_box_content($tab_array['obj']),  | 
                                                        |
| 2302 | 2302 | 'hidden' => $active ? '' : ' hidden',  | 
                                                        
| 2303 | 2303 | 'hide_on_message' => $hide_on_message,  | 
                                                        
| 2304 | 2304 | 'messenger' => $messenger,  | 
                                                        
@@ -2307,10 +2307,10 @@ discard block  | 
                                                    ||
| 2307 | 2307 | |
| 2308 | 2308 | |
| 2309 | 2309 | //message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)  | 
                                                        
| 2310 | -			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso'); | 
                                                        |
| 2311 | - $mt_template_args[$messenger . '_i_box'] = array(  | 
                                                        |
| 2312 | - 'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',  | 
                                                        |
| 2313 | - 'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',  | 
                                                        |
| 2310 | +			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso'); | 
                                                        |
| 2311 | + $mt_template_args[$messenger.'_i_box'] = array(  | 
                                                        |
| 2312 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',  | 
                                                        |
| 2313 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',  | 
                                                        |
| 2314 | 2314 | 'hidden' => $active ? '' : ' hidden',  | 
                                                        
| 2315 | 2315 | 'hide_on_message' => $hide_on_message,  | 
                                                        
| 2316 | 2316 | 'hide_off_message' => $hide_off_message,  | 
                                                        
@@ -2320,19 +2320,19 @@ discard block  | 
                                                    ||
| 2320 | 2320 | }  | 
                                                        
| 2321 | 2321 | |
| 2322 | 2322 | //register messenger metaboxes  | 
                                                        
| 2323 | - $m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';  | 
                                                        |
| 2324 | -		foreach ( $m_boxes as $box => $label ) { | 
                                                        |
| 2325 | - $callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );  | 
                                                        |
| 2326 | - $msgr = str_replace( '_a_box', '', $box );  | 
                                                        |
| 2327 | -			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args ); | 
                                                        |
| 2323 | + $m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';  | 
                                                        |
| 2324 | +		foreach ($m_boxes as $box => $label) { | 
                                                        |
| 2325 | +			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]); | 
                                                        |
| 2326 | +			$msgr = str_replace('_a_box', '', $box); | 
                                                        |
| 2327 | +			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); | 
                                                        |
| 2328 | 2328 | }  | 
                                                        
| 2329 | 2329 | |
| 2330 | 2330 | //register message type metaboxes  | 
                                                        
| 2331 | - $mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';  | 
                                                        |
| 2332 | -		foreach ( $mt_boxes as $box => $label ) { | 
                                                        |
| 2333 | - $callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );  | 
                                                        |
| 2334 | - $mt = str_replace( '_i_box', '', $box );  | 
                                                        |
| 2335 | -			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args ); | 
                                                        |
| 2331 | + $mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';  | 
                                                        |
| 2332 | +		foreach ($mt_boxes as $box => $label) { | 
                                                        |
| 2333 | +			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]); | 
                                                        |
| 2334 | +			$mt = str_replace('_i_box', '', $box); | 
                                                        |
| 2335 | +			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args); | 
                                                        |
| 2336 | 2336 | }  | 
                                                        
| 2337 | 2337 | |
| 2338 | 2338 | }  | 
                                                        
@@ -2343,13 +2343,13 @@ discard block  | 
                                                    ||
| 2343 | 2343 | * @param array $tab_array This is an array of message type tab details used to generate the tabs  | 
                                                        
| 2344 | 2344 | * @return string html formatted tabs  | 
                                                        
| 2345 | 2345 | */  | 
                                                        
| 2346 | -	protected function _get_mt_tabs( $tab_array ) { | 
                                                        |
| 2346 | +	protected function _get_mt_tabs($tab_array) { | 
                                                        |
| 2347 | 2347 | $tab_array = (array) $tab_array;  | 
                                                        
| 2348 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';  | 
                                                        |
| 2348 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';  | 
                                                        |
| 2349 | 2349 | $tabs = '';  | 
                                                        
| 2350 | 2350 | |
| 2351 | -		foreach ( $tab_array as $tab ) { | 
                                                        |
| 2352 | - $tabs .= EEH_Template::display_template( $template, $tab, TRUE );  | 
                                                        |
| 2351 | +		foreach ($tab_array as $tab) { | 
                                                        |
| 2352 | + $tabs .= EEH_Template::display_template($template, $tab, TRUE);  | 
                                                        |
| 2353 | 2353 | }  | 
                                                        
| 2354 | 2354 | |
| 2355 | 2355 | return $tabs;  | 
                                                        
@@ -2363,7 +2363,7 @@ discard block  | 
                                                    ||
| 2363 | 2363 | * @param object $messenger The messenger we're setting up content for  | 
                                                        
| 2364 | 2364 | * @return string html formatted content  | 
                                                        
| 2365 | 2365 | */  | 
                                                        
| 2366 | -	protected function _get_messenger_box_content( $messenger ) { | 
                                                        |
| 2366 | +	protected function _get_messenger_box_content($messenger) { | 
                                                        |
| 2367 | 2367 | |
| 2368 | 2368 | $fields = $messenger->get_admin_settings_fields();  | 
                                                        
| 2369 | 2369 | $settings_template_args['template_form_fields'] = '';  | 
                                                        
@@ -2372,27 +2372,27 @@ discard block  | 
                                                    ||
| 2372 | 2372 | $settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;  | 
                                                        
| 2373 | 2373 | |
| 2374 | 2374 | |
| 2375 | -		if ( !empty( $fields ) ) { | 
                                                        |
| 2375 | +		if ( ! empty($fields)) { | 
                                                        |
| 2376 | 2376 | |
| 2377 | 2377 | $existing_settings = $messenger->get_existing_admin_settings();  | 
                                                        
| 2378 | 2378 | |
| 2379 | -			foreach( $fields as $fldname => $fldprops ) { | 
                                                        |
| 2380 | - $field_id = $messenger->name . '-' . $fldname;  | 
                                                        |
| 2379 | +			foreach ($fields as $fldname => $fldprops) { | 
                                                        |
| 2380 | + $field_id = $messenger->name.'-'.$fldname;  | 
                                                        |
| 2381 | 2381 | $template_form_field[$field_id] = array(  | 
                                                        
| 2382 | - 'name' => 'messenger_settings[' . $field_id . ']',  | 
                                                        |
| 2382 | + 'name' => 'messenger_settings['.$field_id.']',  | 
                                                        |
| 2383 | 2383 | 'label' => $fldprops['label'],  | 
                                                        
| 2384 | 2384 | 'input' => $fldprops['field_type'],  | 
                                                        
| 2385 | 2385 | 'type' => $fldprops['value_type'],  | 
                                                        
| 2386 | 2386 | 'required' => $fldprops['required'],  | 
                                                        
| 2387 | 2387 | 'validation' => $fldprops['validation'],  | 
                                                        
| 2388 | - 'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],  | 
                                                        |
| 2388 | + 'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],  | 
                                                        |
| 2389 | 2389 | 'css_class' => '',  | 
                                                        
| 2390 | 2390 | 'format' => $fldprops['format']  | 
                                                        
| 2391 | 2391 | );  | 
                                                        
| 2392 | 2392 | }  | 
                                                        
| 2393 | 2393 | |
| 2394 | 2394 | |
| 2395 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';  | 
                                                        |
| 2395 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';  | 
                                                        |
| 2396 | 2396 | }  | 
                                                        
| 2397 | 2397 | |
| 2398 | 2398 | //we also need some hidden fields  | 
                                                        
@@ -2408,8 +2408,8 @@ discard block  | 
                                                    ||
| 2408 | 2408 | );  | 
                                                        
| 2409 | 2409 | |
| 2410 | 2410 | //make sure any active message types that are existing are included in the hidden fields  | 
                                                        
| 2411 | -		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) { | 
                                                        |
| 2412 | -			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) { | 
                                                        |
| 2411 | +		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) { | 
                                                        |
| 2412 | +			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) { | 
                                                        |
| 2413 | 2413 | $settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(  | 
                                                        
| 2414 | 2414 | 'type' => 'hidden',  | 
                                                        
| 2415 | 2415 | 'value' => $mt  | 
                                                        
@@ -2417,25 +2417,25 @@ discard block  | 
                                                    ||
| 2417 | 2417 | }  | 
                                                        
| 2418 | 2418 | }  | 
                                                        
| 2419 | 2419 | |
| 2420 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );  | 
                                                        |
| 2420 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');  | 
                                                        |
| 2421 | 2421 | |
| 2422 | - $active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;  | 
                                                        |
| 2422 | + $active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;  | 
                                                        |
| 2423 | 2423 | |
| 2424 | 2424 | $settings_template_args['messenger'] = $messenger->name;  | 
                                                        
| 2425 | 2425 | $settings_template_args['description'] = $messenger->description;  | 
                                                        
| 2426 | 2426 | $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';  | 
                                                        
| 2427 | 2427 | |
| 2428 | 2428 | |
| 2429 | - $settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';  | 
                                                        |
| 2429 | + $settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';  | 
                                                        |
| 2430 | 2430 | |
| 2431 | - $settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];  | 
                                                        |
| 2431 | + $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];  | 
                                                        |
| 2432 | 2432 | |
| 2433 | 2433 | |
| 2434 | 2434 | $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';  | 
                                                        
| 2435 | -		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce'); | 
                                                        |
| 2435 | +		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce'); | 
                                                        |
| 2436 | 2436 | $settings_template_args['on_off_status'] = $active ? true : false;  | 
                                                        
| 2437 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';  | 
                                                        |
| 2438 | - $content = EEH_Template::display_template( $template, $settings_template_args, TRUE);  | 
                                                        |
| 2437 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';  | 
                                                        |
| 2438 | + $content = EEH_Template::display_template($template, $settings_template_args, TRUE);  | 
                                                        |
| 2439 | 2439 | return $content;  | 
                                                        
| 2440 | 2440 | }  | 
                                                        
| 2441 | 2441 | |
@@ -2449,39 +2449,39 @@ discard block  | 
                                                    ||
| 2449 | 2449 |  	public function activate_messenger_toggle() { | 
                                                        
| 2450 | 2450 | $success = TRUE;  | 
                                                        
| 2451 | 2451 | //let's check that we have required data  | 
                                                        
| 2452 | -		if ( !isset( $this->_req_data[ 'messenger' ] ) ) { | 
                                                        |
| 2453 | -			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2452 | +		if ( ! isset($this->_req_data['messenger'])) { | 
                                                        |
| 2453 | +			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2454 | 2454 | $success = FALSE;  | 
                                                        
| 2455 | 2455 | }  | 
                                                        
| 2456 | 2456 | |
| 2457 | 2457 | //do a nonce check here since we're not arriving via a normal route  | 
                                                        
| 2458 | - $nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';  | 
                                                        |
| 2459 | - $nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';  | 
                                                        |
| 2458 | + $nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';  | 
                                                        |
| 2459 | + $nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';  | 
                                                        |
| 2460 | 2460 | |
| 2461 | - $this->_verify_nonce( $nonce, $nonce_ref );  | 
                                                        |
| 2461 | + $this->_verify_nonce($nonce, $nonce_ref);  | 
                                                        |
| 2462 | 2462 | |
| 2463 | 2463 | |
| 2464 | 2464 | |
| 2465 | -		if ( !isset( $this->_req_data[ 'status' ])) { | 
                                                        |
| 2466 | -			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2465 | +		if ( ! isset($this->_req_data['status'])) { | 
                                                        |
| 2466 | +			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2467 | 2467 | $success = FALSE;  | 
                                                        
| 2468 | 2468 | }  | 
                                                        
| 2469 | 2469 | |
| 2470 | 2470 | //do check to verify we have a valid status.  | 
                                                        
| 2471 | 2471 | $status = $this->_req_data['status'];  | 
                                                        
| 2472 | 2472 | |
| 2473 | -		if ( $status != 'off' && $status != 'on' ) { | 
                                                        |
| 2474 | -			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2473 | +		if ($status != 'off' && $status != 'on') { | 
                                                        |
| 2474 | +			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2475 | 2475 | $success = FALSE;  | 
                                                        
| 2476 | 2476 | }  | 
                                                        
| 2477 | 2477 | |
| 2478 | -		if ( $success ) { | 
                                                        |
| 2478 | +		if ($success) { | 
                                                        |
| 2479 | 2479 | //made it here? Stop dawdling then!!  | 
                                                        
| 2480 | -			if ( $status == 'off' ) { | 
                                                        |
| 2480 | +			if ($status == 'off') { | 
                                                        |
| 2481 | 2481 | //off = deactivate. get it?  | 
                                                        
| 2482 | - $success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );  | 
                                                        |
| 2482 | + $success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);  | 
                                                        |
| 2483 | 2483 |  			} else { | 
                                                        
| 2484 | - $success = $this->_activate_messenger( $this->_req_data['messenger'] );  | 
                                                        |
| 2484 | + $success = $this->_activate_messenger($this->_req_data['messenger']);  | 
                                                        |
| 2485 | 2485 | }  | 
                                                        
| 2486 | 2486 | }  | 
                                                        
| 2487 | 2487 | |
@@ -2507,26 +2507,26 @@ discard block  | 
                                                    ||
| 2507 | 2507 | |
| 2508 | 2508 | |
| 2509 | 2509 | //let's make sure we have the necessary data  | 
                                                        
| 2510 | -		if ( !isset( $this->_req_data[ 'message_type' ] ) ) { | 
                                                        |
| 2511 | -			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2510 | +		if ( ! isset($this->_req_data['message_type'])) { | 
                                                        |
| 2511 | +			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2512 | 2512 | $success = FALSE;  | 
                                                        
| 2513 | 2513 | }  | 
                                                        
| 2514 | 2514 | |
| 2515 | 2515 | |
| 2516 | 2516 | //do a nonce check here since we're not arriving via a normal route  | 
                                                        
| 2517 | - $nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';  | 
                                                        |
| 2518 | - $nonce_ref = $this->_req_data['message_type'] . '_nonce';  | 
                                                        |
| 2517 | + $nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';  | 
                                                        |
| 2518 | + $nonce_ref = $this->_req_data['message_type'].'_nonce';  | 
                                                        |
| 2519 | 2519 | |
| 2520 | - $this->_verify_nonce( $nonce, $nonce_ref );  | 
                                                        |
| 2520 | + $this->_verify_nonce($nonce, $nonce_ref);  | 
                                                        |
| 2521 | 2521 | |
| 2522 | 2522 | |
| 2523 | -		if ( !isset( $this->_req_data[ 'messenger' ] ) ) { | 
                                                        |
| 2524 | -			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2523 | +		if ( ! isset($this->_req_data['messenger'])) { | 
                                                        |
| 2524 | +			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2525 | 2525 | $success = FALSE;  | 
                                                        
| 2526 | 2526 | }  | 
                                                        
| 2527 | 2527 | |
| 2528 | -		if ( !isset( $this->_req_data[ 'status' ])) { | 
                                                        |
| 2529 | -			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2528 | +		if ( ! isset($this->_req_data['status'])) { | 
                                                        |
| 2529 | +			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2530 | 2530 | $success = FALSE;  | 
                                                        
| 2531 | 2531 | }  | 
                                                        
| 2532 | 2532 | |
@@ -2534,16 +2534,16 @@ discard block  | 
                                                    ||
| 2534 | 2534 | //do check to verify we have a valid status.  | 
                                                        
| 2535 | 2535 | $status = $this->_req_data['status'];  | 
                                                        
| 2536 | 2536 | |
| 2537 | -		if ( $status != 'activate' && $status != 'deactivate' ) { | 
                                                        |
| 2538 | -			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2537 | +		if ($status != 'activate' && $status != 'deactivate') { | 
                                                        |
| 2538 | +			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2539 | 2539 | $success = FALSE;  | 
                                                        
| 2540 | 2540 | }  | 
                                                        
| 2541 | 2541 | |
| 2542 | 2542 | |
| 2543 | -		if ( $success ) { | 
                                                        |
| 2543 | +		if ($success) { | 
                                                        |
| 2544 | 2544 | //made it here? um, what are you waiting for then?  | 
                                                        
| 2545 | 2545 | $deactivate = $status == 'deactivate' ? TRUE : FALSE;  | 
                                                        
| 2546 | - $success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );  | 
                                                        |
| 2546 | + $success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);  | 
                                                        |
| 2547 | 2547 | }  | 
                                                        
| 2548 | 2548 | |
| 2549 | 2549 | $this->_template_args['success'] = $success;  | 
                                                        
@@ -2570,28 +2570,28 @@ discard block  | 
                                                    ||
| 2570 | 2570 | $templates = TRUE;  | 
                                                        
| 2571 | 2571 | $this->_set_m_mt_settings();  | 
                                                        
| 2572 | 2572 | |
| 2573 | -		if ( !$deactivate ) { | 
                                                        |
| 2573 | +		if ( ! $deactivate) { | 
                                                        |
| 2574 | 2574 | |
| 2575 | 2575 | |
| 2576 | 2576 | //we are activating. we can use $this->_m_mt_settings to get all the installed messengers  | 
                                                        
| 2577 | - $this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];  | 
                                                        |
| 2577 | + $this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];  | 
                                                        |
| 2578 | 2578 | $this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];  | 
                                                        
| 2579 | 2579 | |
| 2580 | 2580 | //get has_active so we can sure its kept up to date.  | 
                                                        
| 2581 | - $has_activated = get_option( 'ee_has_activated_messages' );  | 
                                                        |
| 2581 | +			$has_activated = get_option('ee_has_activated_messages'); | 
                                                        |
| 2582 | 2582 | |
| 2583 | -			if ( empty( $has_activated[$messenger] ) ) { | 
                                                        |
| 2583 | +			if (empty($has_activated[$messenger])) { | 
                                                        |
| 2584 | 2584 | $has_activated[$messenger] = array();  | 
                                                        
| 2585 | 2585 | }  | 
                                                        
| 2586 | 2586 | |
| 2587 | 2587 | //k we need to get what default message types are to be associated with the messenger that's been activated.  | 
                                                        
| 2588 | 2588 | $default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();  | 
                                                        
| 2589 | 2589 | |
| 2590 | -			foreach ( $default_types as $type ) { | 
                                                        |
| 2590 | +			foreach ($default_types as $type) { | 
                                                        |
| 2591 | 2591 | $settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();  | 
                                                        
| 2592 | -				if ( !empty( $settings_fields ) ) { | 
                                                        |
| 2592 | +				if ( ! empty($settings_fields)) { | 
                                                        |
| 2593 | 2593 | //we have fields for this message type so let's get the defaults for saving.  | 
                                                        
| 2594 | -					foreach ( $settings_fields as $field => $values ) { | 
                                                        |
| 2594 | +					foreach ($settings_fields as $field => $values) { | 
                                                        |
| 2595 | 2595 | $settings[$field] = $values['default'];  | 
                                                        
| 2596 | 2596 | }  | 
                                                        
| 2597 | 2597 | //let's set the data for reloading this message type form in ajax  | 
                                                        
@@ -2599,9 +2599,9 @@ discard block  | 
                                                    ||
| 2599 | 2599 |  				} else { | 
                                                        
| 2600 | 2600 | $settings = array();  | 
                                                        
| 2601 | 2601 | }  | 
                                                        
| 2602 | - $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] = $settings;  | 
                                                        |
| 2602 | + $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;  | 
                                                        |
| 2603 | 2603 | |
| 2604 | -				if ( ! in_array( $type, $has_activated[$messenger] ) ) { | 
                                                        |
| 2604 | +				if ( ! in_array($type, $has_activated[$messenger])) { | 
                                                        |
| 2605 | 2605 | $has_activated[$messenger][] = $type;  | 
                                                        
| 2606 | 2606 | }  | 
                                                        
| 2607 | 2607 | }  | 
                                                        
@@ -2609,41 +2609,41 @@ discard block  | 
                                                    ||
| 2609 | 2609 | //any default settings for the messenger?  | 
                                                        
| 2610 | 2610 | $msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();  | 
                                                        
| 2611 | 2611 | |
| 2612 | -			if ( !empty( $msgr_settings ) ) { | 
                                                        |
| 2613 | -				foreach ( $msgr_settings as $field => $value ) { | 
                                                        |
| 2612 | +			if ( ! empty($msgr_settings)) { | 
                                                        |
| 2613 | +				foreach ($msgr_settings as $field => $value) { | 
                                                        |
| 2614 | 2614 | $this->_active_messengers[$messenger]['settings'][$field] = $value;  | 
                                                        
| 2615 | 2615 | }  | 
                                                        
| 2616 | 2616 | }  | 
                                                        
| 2617 | 2617 | |
| 2618 | 2618 | //update settings in database  | 
                                                        
| 2619 | - EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );  | 
                                                        |
| 2620 | - update_option( 'ee_has_activated_messages', $has_activated );  | 
                                                        |
| 2619 | + EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);  | 
                                                        |
| 2620 | +			update_option('ee_has_activated_messages', $has_activated); | 
                                                        |
| 2621 | 2621 | |
| 2622 | 2622 | |
| 2623 | 2623 | //generate new templates (if necessary)  | 
                                                        
| 2624 | - $templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );  | 
                                                        |
| 2624 | + $templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);  | 
                                                        |
| 2625 | 2625 | |
| 2626 | 2626 | EE_Error::overwrite_success();  | 
                                                        
| 2627 | 2627 | |
| 2628 | 2628 | //if generation failed then we need to remove the active messenger.  | 
                                                        
| 2629 | -			if ( !$templates ) { | 
                                                        |
| 2629 | +			if ( ! $templates) { | 
                                                        |
| 2630 | 2630 | unset($this->_active_messengers[$messenger]);  | 
                                                        
| 2631 | - EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );  | 
                                                        |
| 2631 | + EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);  | 
                                                        |
| 2632 | 2632 |  			} else { | 
                                                        
| 2633 | 2633 | //all is good let's do a success message  | 
                                                        
| 2634 | -				if ( $message_type ) { | 
                                                        |
| 2635 | -					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) ); | 
                                                        |
| 2634 | +				if ($message_type) { | 
                                                        |
| 2635 | +					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular']))); | 
                                                        |
| 2636 | 2636 | |
| 2637 | 2637 | //if message type was invoice then let's make sure we activate the invoice payment method.  | 
                                                        
| 2638 | -					if ( $message_type == 'invoice' ) { | 
                                                        |
| 2639 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );  | 
                                                        |
| 2640 | - $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );  | 
                                                        |
| 2641 | -						if ( $pm instanceof EE_Payment_Method ) { | 
                                                        |
| 2642 | -							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) ); | 
                                                        |
| 2638 | +					if ($message_type == 'invoice') { | 
                                                        |
| 2639 | +						EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        |
| 2640 | +						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); | 
                                                        |
| 2641 | +						if ($pm instanceof EE_Payment_Method) { | 
                                                        |
| 2642 | +							EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso')); | 
                                                        |
| 2643 | 2643 | }  | 
                                                        
| 2644 | 2644 | }  | 
                                                        
| 2645 | 2645 |  				} else { | 
                                                        
| 2646 | -					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) ); | 
                                                        |
| 2646 | +					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular']))); | 
                                                        |
| 2647 | 2647 | }  | 
                                                        
| 2648 | 2648 | }  | 
                                                        
| 2649 | 2649 | |
@@ -2659,36 +2659,36 @@ discard block  | 
                                                    ||
| 2659 | 2659 | $update_array = array(  | 
                                                        
| 2660 | 2660 | 'MTP_messenger' => $messenger);  | 
                                                        
| 2661 | 2661 | |
| 2662 | -			if ( $message_type ) { | 
                                                        |
| 2662 | +			if ($message_type) { | 
                                                        |
| 2663 | 2663 | $update_array['MTP_message_type'] = $message_type;  | 
                                                        
| 2664 | 2664 | }  | 
                                                        
| 2665 | 2665 | |
| 2666 | - $success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );  | 
                                                        |
| 2666 | +			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array)); | 
                                                        |
| 2667 | 2667 | |
| 2668 | 2668 | $messenger_obj = $this->_active_messengers[$messenger]['obj'];  | 
                                                        
| 2669 | 2669 | |
| 2670 | 2670 | //if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger  | 
                                                        
| 2671 | -			if ( $message_type ) { | 
                                                        |
| 2672 | - unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );  | 
                                                        |
| 2671 | +			if ($message_type) { | 
                                                        |
| 2672 | + unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);  | 
                                                        |
| 2673 | 2673 |  			} else { | 
                                                        
| 2674 | - unset( $this->_active_messengers[$messenger] );  | 
                                                        |
| 2674 | + unset($this->_active_messengers[$messenger]);  | 
                                                        |
| 2675 | 2675 | }  | 
                                                        
| 2676 | 2676 | |
| 2677 | - EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );  | 
                                                        |
| 2677 | + EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);  | 
                                                        |
| 2678 | 2678 | EE_Error::overwrite_success();  | 
                                                        
| 2679 | -			if ( $message_type ) { | 
                                                        |
| 2680 | -				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) ); | 
                                                        |
| 2679 | +			if ($message_type) { | 
                                                        |
| 2680 | +				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']))); | 
                                                        |
| 2681 | 2681 |  			} else { | 
                                                        
| 2682 | -				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) ); | 
                                                        |
| 2682 | +				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular']))); | 
                                                        |
| 2683 | 2683 | }  | 
                                                        
| 2684 | 2684 | |
| 2685 | 2685 | //if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.  | 
                                                        
| 2686 | -			if ( $messenger == 'html'  || $message_type == 'invoice') { | 
                                                        |
| 2687 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );  | 
                                                        |
| 2688 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );  | 
                                                        |
| 2689 | -				if ( $count_updated > 0 ) { | 
                                                        |
| 2690 | -					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ); | 
                                                        |
| 2691 | - EE_Error::add_attention( $msg );  | 
                                                        |
| 2686 | +			if ($messenger == 'html' || $message_type == 'invoice') { | 
                                                        |
| 2687 | +				EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        |
| 2688 | +				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice'); | 
                                                        |
| 2689 | +				if ($count_updated > 0) { | 
                                                        |
| 2690 | +					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso'); | 
                                                        |
| 2691 | + EE_Error::add_attention($msg);  | 
                                                        |
| 2692 | 2692 | }  | 
                                                        
| 2693 | 2693 | }  | 
                                                        
| 2694 | 2694 | |
@@ -2705,8 +2705,8 @@ discard block  | 
                                                    ||
| 2705 | 2705 | * @return string html data  | 
                                                        
| 2706 | 2706 | */  | 
                                                        
| 2707 | 2707 |  	public function update_mt_form() { | 
                                                        
| 2708 | -		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) { | 
                                                        |
| 2709 | -			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2708 | +		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) { | 
                                                        |
| 2709 | +			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2710 | 2710 | $this->_return_json();  | 
                                                        
| 2711 | 2711 | }  | 
                                                        
| 2712 | 2712 | |
@@ -2715,7 +2715,7 @@ discard block  | 
                                                    ||
| 2715 | 2715 | $message_type = $message_types[$this->_req_data['message_type']]['obj'];  | 
                                                        
| 2716 | 2716 | $messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];  | 
                                                        
| 2717 | 2717 | |
| 2718 | - $content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );  | 
                                                        |
| 2718 | + $content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);  | 
                                                        |
| 2719 | 2719 | $this->_template_args['success'] = true;  | 
                                                        
| 2720 | 2720 | $this->_template_args['content'] = $content;  | 
                                                        
| 2721 | 2721 | $this->_return_json();  | 
                                                        
@@ -2729,36 +2729,36 @@ discard block  | 
                                                    ||
| 2729 | 2729 | * @return json success or fail message  | 
                                                        
| 2730 | 2730 | */  | 
                                                        
| 2731 | 2731 |  	public function save_settings() { | 
                                                        
| 2732 | -		if ( !isset( $this->_req_data['type'] ) ) { | 
                                                        |
| 2733 | -			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2732 | +		if ( ! isset($this->_req_data['type'])) { | 
                                                        |
| 2733 | +			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2734 | 2734 | $this->_template_args['error'] = TRUE;  | 
                                                        
| 2735 | 2735 | $this->_return_json();  | 
                                                        
| 2736 | 2736 | }  | 
                                                        
| 2737 | 2737 | |
| 2738 | 2738 | |
| 2739 | -		if ( $this->_req_data['type'] == 'messenger' ) { | 
                                                        |
| 2739 | +		if ($this->_req_data['type'] == 'messenger') { | 
                                                        |
| 2740 | 2740 | $settings = $this->_req_data['messenger_settings']; //this should be an array.  | 
                                                        
| 2741 | 2741 | $messenger = $settings['messenger'];  | 
                                                        
| 2742 | 2742 | //let's setup the settings data  | 
                                                        
| 2743 | -			foreach ( $settings as $key => $value ) { | 
                                                        |
| 2744 | -				switch ( $key ) { | 
                                                        |
| 2743 | +			foreach ($settings as $key => $value) { | 
                                                        |
| 2744 | +				switch ($key) { | 
                                                        |
| 2745 | 2745 | case 'messenger' :  | 
                                                        
| 2746 | - unset( $settings['messenger'] );  | 
                                                        |
| 2746 | + unset($settings['messenger']);  | 
                                                        |
| 2747 | 2747 | break;  | 
                                                        
| 2748 | 2748 | case 'message_types' :  | 
                                                        
| 2749 | -						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) { | 
                                                        |
| 2750 | -							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) { | 
                                                        |
| 2751 | - if ( isset( $settings['message_types'][$mt] ) )  | 
                                                        |
| 2752 | - $settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();  | 
                                                        |
| 2749 | +						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) { | 
                                                        |
| 2750 | +							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) { | 
                                                        |
| 2751 | + if (isset($settings['message_types'][$mt]))  | 
                                                        |
| 2752 | + $settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array();  | 
                                                        |
| 2753 | 2753 | }  | 
                                                        
| 2754 | 2754 |  						} else { | 
                                                        
| 2755 | -							foreach ( $value as $mt => $v ) { | 
                                                        |
| 2755 | +							foreach ($value as $mt => $v) { | 
                                                        |
| 2756 | 2756 | //let's see if this message type is already present and has settings.  | 
                                                        
| 2757 | - $settings[$messenger . '-message_types'][$mt]['settings'] = array();  | 
                                                        |
| 2757 | + $settings[$messenger.'-message_types'][$mt]['settings'] = array();  | 
                                                        |
| 2758 | 2758 | }  | 
                                                        
| 2759 | 2759 | }  | 
                                                        
| 2760 | 2760 | //k settings are set let's get rid of the message types index  | 
                                                        
| 2761 | - unset( $settings['message_types'] );  | 
                                                        |
| 2761 | + unset($settings['message_types']);  | 
                                                        |
| 2762 | 2762 | break;  | 
                                                        
| 2763 | 2763 | default :  | 
                                                        
| 2764 | 2764 | $settings[$key] = $value;  | 
                                                        
@@ -2768,36 +2768,36 @@ discard block  | 
                                                    ||
| 2768 | 2768 | $this->_active_messengers[$messenger]['settings'] = $settings;  | 
                                                        
| 2769 | 2769 | }  | 
                                                        
| 2770 | 2770 | |
| 2771 | -		else if ( $this->_req_data['type'] == 'message_type' ) { | 
                                                        |
| 2771 | +		else if ($this->_req_data['type'] == 'message_type') { | 
                                                        |
| 2772 | 2772 | $settings = $this->_req_data['message_type_settings'];  | 
                                                        
| 2773 | 2773 | $messenger = $settings['messenger'];  | 
                                                        
| 2774 | 2774 | $message_type = $settings['message_type'];  | 
                                                        
| 2775 | 2775 | |
| 2776 | -			foreach ( $settings as $key => $value ) { | 
                                                        |
| 2777 | -				switch ( $key ) { | 
                                                        |
| 2776 | +			foreach ($settings as $key => $value) { | 
                                                        |
| 2777 | +				switch ($key) { | 
                                                        |
| 2778 | 2778 | case 'messenger' :  | 
                                                        
| 2779 | - unset( $settings['messenger'] );  | 
                                                        |
| 2779 | + unset($settings['messenger']);  | 
                                                        |
| 2780 | 2780 | break;  | 
                                                        
| 2781 | 2781 | case 'message_type' :  | 
                                                        
| 2782 | - unset( $settings['message_type'] );  | 
                                                        |
| 2782 | + unset($settings['message_type']);  | 
                                                        |
| 2783 | 2783 | break;  | 
                                                        
| 2784 | 2784 | default :  | 
                                                        
| 2785 | 2785 | $settings['settings'][$key] = $value;  | 
                                                        
| 2786 | - unset( $settings[$key] );  | 
                                                        |
| 2786 | + unset($settings[$key]);  | 
                                                        |
| 2787 | 2787 | break;  | 
                                                        
| 2788 | 2788 | }  | 
                                                        
| 2789 | 2789 | }  | 
                                                        
| 2790 | 2790 | |
| 2791 | - $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;  | 
                                                        |
| 2791 | + $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;  | 
                                                        |
| 2792 | 2792 | }  | 
                                                        
| 2793 | 2793 | |
| 2794 | 2794 | //okay we should have the data all setup. Now we just update!  | 
                                                        
| 2795 | - $success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );  | 
                                                        |
| 2795 | + $success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);  | 
                                                        |
| 2796 | 2796 | |
| 2797 | -		if ( $success ) { | 
                                                        |
| 2798 | -			EE_Error::add_success( __('Settings updated', 'event_espresso') ); | 
                                                        |
| 2797 | +		if ($success) { | 
                                                        |
| 2798 | +			EE_Error::add_success(__('Settings updated', 'event_espresso')); | 
                                                        |
| 2799 | 2799 |  		} else { | 
                                                        
| 2800 | -			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2800 | +			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2801 | 2801 | }  | 
                                                        
| 2802 | 2802 | |
| 2803 | 2803 | $this->_template_args['success'] = $success;  | 
                                                        
@@ -421,7 +421,7 @@ discard block  | 
                                                    ||
| 421 | 421 | *  | 
                                                        
| 422 | 422 | * @access protected  | 
                                                        
| 423 | 423 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 424 | - * @return \EE_Form_Section_Proper  | 
                                                        |
| 424 | + * @return EE_Form_Section_HTML  | 
                                                        |
| 425 | 425 | */  | 
                                                        
| 426 | 426 |  	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { | 
                                                        
| 427 | 427 |  		if ( $payment_method->type_obj()->requires_https() ) { | 
                                                        
@@ -451,7 +451,7 @@ discard block  | 
                                                    ||
| 451 | 451 | *  | 
                                                        
| 452 | 452 | * @access protected  | 
                                                        
| 453 | 453 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 454 | - * @return \EE_Form_Section_Proper  | 
                                                        |
| 454 | + * @return EE_Form_Section_HTML  | 
                                                        |
| 455 | 455 | */  | 
                                                        
| 456 | 456 |  	protected function _currency_support( EE_Payment_Method $payment_method ) { | 
                                                        
| 457 | 457 |  		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { | 
                                                        
@@ -483,7 +483,7 @@ discard block  | 
                                                    ||
| 483 | 483 | *  | 
                                                        
| 484 | 484 | * @access protected  | 
                                                        
| 485 | 485 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 486 | - * @return \EE_Form_Section_HTML  | 
                                                        |
| 486 | + * @return EE_Payment_Method_Form  | 
                                                        |
| 487 | 487 | */  | 
                                                        
| 488 | 488 |  	protected function _payment_method_settings( EE_Payment_Method $payment_method ) { | 
                                                        
| 489 | 489 | //modify the form so we only have/show fields that will be implemented for this version  | 
                                                        
@@ -551,7 +551,7 @@ discard block  | 
                                                    ||
| 551 | 551 | *  | 
                                                        
| 552 | 552 | * @access protected  | 
                                                        
| 553 | 553 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 554 | - * @return \EE_Form_Section_Proper  | 
                                                        |
| 554 | + * @return EE_Form_Section_HTML  | 
                                                        |
| 555 | 555 | */  | 
                                                        
| 556 | 556 |  	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { | 
                                                        
| 557 | 557 | $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );  | 
                                                        
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 | *  | 
                                                        
| 84 | 84 | * When cap mapping is implemented, some routes will need to use the singular form of  | 
                                                        
| 85 | 85 | * capability method and also include the $id of the payment method for the route.  | 
                                                        
| 86 | - **/  | 
                                                        |
| 86 | + **/  | 
                                                        |
| 87 | 87 | $this->_page_routes = array(  | 
                                                        
| 88 | 88 | 'default' => array(  | 
                                                        
| 89 | 89 | 'func'=>'_payment_methods_list',  | 
                                                        
@@ -747,9 +747,9 @@ discard block  | 
                                                    ||
| 747 | 747 | |
| 748 | 748 | /**  | 
                                                        
| 749 | 749 | * _update_payment_settings  | 
                                                        
| 750 | - * @access protected  | 
                                                        |
| 751 | - * @return array  | 
                                                        |
| 752 | - */  | 
                                                        |
| 750 | + * @access protected  | 
                                                        |
| 751 | + * @return array  | 
                                                        |
| 752 | + */  | 
                                                        |
| 753 | 753 |  	protected function _update_payment_settings() { | 
                                                        
| 754 | 754 | EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;  | 
                                                        
| 755 | 755 | EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );  | 
                                                        
@@ -1,6 +1,7 @@ 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 | 6 | /**  | 
                                                        
| 6 | 7 | * Event Espresso  | 
                                                        
@@ -655,7 +656,7 @@ discard block  | 
                                                    ||
| 655 | 656 | $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );  | 
                                                        
| 656 | 657 | |
| 657 | 658 |  			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); | 
                                                        
| 658 | -		}else{ | 
                                                        |
| 659 | +		} else{ | 
                                                        |
| 659 | 660 |  			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); | 
                                                        
| 660 | 661 | }  | 
                                                        
| 661 | 662 | }  | 
                                                        
@@ -670,7 +671,7 @@ discard block  | 
                                                    ||
| 670 | 671 |  			EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        
| 671 | 672 | $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );  | 
                                                        
| 672 | 673 |  			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); | 
                                                        
| 673 | -		}else{ | 
                                                        |
| 674 | +		} else{ | 
                                                        |
| 674 | 675 |  			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); | 
                                                        
| 675 | 676 | }  | 
                                                        
| 676 | 677 | }  | 
                                                        
@@ -712,7 +713,7 @@ discard block  | 
                                                    ||
| 712 | 713 | $pm = $correct_pmt_form_to_use->get_model_object();  | 
                                                        
| 713 | 714 | /** @var $pm EE_Payment_Method */  | 
                                                        
| 714 | 715 |  				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); | 
                                                        
| 715 | -			}else{ | 
                                                        |
| 716 | +			} else{ | 
                                                        |
| 716 | 717 | EE_Error::add_error(  | 
                                                        
| 717 | 718 | sprintf(  | 
                                                        
| 718 | 719 |  						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), | 
                                                        
@@ -838,7 +839,7 @@ discard block  | 
                                                    ||
| 838 | 839 |  		if(isset($this->_req_data['order'])){ | 
                                                        
| 839 | 840 | $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';  | 
                                                        
| 840 | 841 |  			$query_params['order_by'] = array('LOG_time' => $sort); | 
                                                        
| 841 | -		}else{ | 
                                                        |
| 842 | +		} else{ | 
                                                        |
| 842 | 843 |  				$query_params['order_by'] = array('LOG_time' => 'DESC'); | 
                                                        
| 843 | 844 | }  | 
                                                        
| 844 | 845 | $offset = ($current_page-1)*$per_page;  | 
                                                        
@@ -881,7 +882,7 @@ discard block  | 
                                                    ||
| 881 | 882 | $comparison = $timeA < $timeB ? -1 : 1;  | 
                                                        
| 882 | 883 |  		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ | 
                                                        
| 883 | 884 | return $comparison * -1;  | 
                                                        
| 884 | -		}else{ | 
                                                        |
| 885 | +		} else{ | 
                                                        |
| 885 | 886 | return $comparison;  | 
                                                        
| 886 | 887 | }  | 
                                                        
| 887 | 888 | }  | 
                                                        
@@ -896,7 +897,7 @@ discard block  | 
                                                    ||
| 896 | 897 |  			if( $payment_log->object() instanceof EE_Payment ){ | 
                                                        
| 897 | 898 | $payment_method = $payment_log->object()->payment_method();  | 
                                                        
| 898 | 899 | $transaction = $payment_log->object()->transaction();  | 
                                                        
| 899 | -			}elseif($payment_log->object() instanceof EE_Payment_Method){ | 
                                                        |
| 900 | +			} elseif($payment_log->object() instanceof EE_Payment_Method){ | 
                                                        |
| 900 | 901 | $payment_method = $payment_log->object();  | 
                                                        
| 901 | 902 | }  | 
                                                        
| 902 | 903 | }  | 
                                                        
@@ -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 | /**  | 
                                                        
@@ -44,8 +44,8 @@ discard block  | 
                                                    ||
| 44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.  | 
                                                        
| 45 | 45 | * @return \Payments_Admin_Page  | 
                                                        
| 46 | 46 | */  | 
                                                        
| 47 | -	public function __construct( $routing = TRUE ) { | 
                                                        |
| 48 | - parent::__construct( $routing );  | 
                                                        |
| 47 | +	public function __construct($routing = TRUE) { | 
                                                        |
| 48 | + parent::__construct($routing);  | 
                                                        |
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
| 51 | 51 | |
@@ -130,19 +130,19 @@ discard block  | 
                                                    ||
| 130 | 130 |  	protected function _set_page_config() { | 
                                                        
| 131 | 131 | $payment_method_list_config = array(  | 
                                                        
| 132 | 132 | 'nav' => array(  | 
                                                        
| 133 | - 'label' => __( 'Payment Methods', 'event_espresso' ),  | 
                                                        |
| 133 | +				'label' => __('Payment Methods', 'event_espresso'), | 
                                                        |
| 134 | 134 | 'order' => 10  | 
                                                        
| 135 | 135 | ),  | 
                                                        
| 136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes,  | 
                                                        
| 137 | 137 | 'help_tabs' => array_merge(  | 
                                                        
| 138 | 138 | array(  | 
                                                        
| 139 | 139 | 'payment_methods_overview_help_tab' => array(  | 
                                                        
| 140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ),  | 
                                                        |
| 140 | +						'title'    => __('Payment Methods Overview', 'event_espresso'), | 
                                                        |
| 141 | 141 | 'filename' => 'payment_methods_overview'  | 
                                                        
| 142 | 142 | )  | 
                                                        
| 143 | 143 | ),  | 
                                                        
| 144 | 144 | $this->_add_payment_method_help_tabs() ),  | 
                                                        
| 145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ),  | 
                                                        |
| 145 | +			'help_tour'     => array('Payment_Methods_Selection_Help_Tour'), | 
                                                        |
| 146 | 146 | 'require_nonce' => false  | 
                                                        
| 147 | 147 | );  | 
                                                        
| 148 | 148 | |
@@ -160,7 +160,7 @@ discard block  | 
                                                    ||
| 160 | 160 | )  | 
                                                        
| 161 | 161 | ),  | 
                                                        
| 162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),  | 
                                                        
| 163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),  | 
                                                        |
| 163 | +				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 164 | 164 | 'require_nonce' => FALSE  | 
                                                        
| 165 | 165 | ),  | 
                                                        
| 166 | 166 | 'payment_log'=>array(  | 
                                                        
@@ -179,18 +179,18 @@ discard block  | 
                                                    ||
| 179 | 179 | /**  | 
                                                        
| 180 | 180 | * @return array  | 
                                                        
| 181 | 181 | */  | 
                                                        
| 182 | -	protected function _add_payment_method_help_tabs(){ | 
                                                        |
| 182 | +	protected function _add_payment_method_help_tabs() { | 
                                                        |
| 183 | 183 |  		EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        
| 184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();  | 
                                                        
| 185 | 185 | $all_pmt_help_tabs_config = array();  | 
                                                        
| 186 | -		foreach( $payment_method_types as $payment_method_type ){ | 
                                                        |
| 187 | -			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { | 
                                                        |
| 186 | +		foreach ($payment_method_types as $payment_method_type) { | 
                                                        |
| 187 | +			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { | 
                                                        |
| 188 | 188 | continue;  | 
                                                        
| 189 | 189 | }  | 
                                                        
| 190 | -			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ | 
                                                        |
| 190 | +			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { | 
                                                        |
| 191 | 191 | $all_pmt_help_tabs_config[$help_tab_name] = array(  | 
                                                        
| 192 | 192 | 'title'=>$config['title'],  | 
                                                        
| 193 | -					'content'=>EEH_Template::display_template( $payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true) | 
                                                        |
| 193 | +					'content'=>EEH_Template::display_template($payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true) | 
                                                        |
| 194 | 194 | );  | 
                                                        
| 195 | 195 | }  | 
                                                        
| 196 | 196 | }  | 
                                                        
@@ -211,9 +211,9 @@ discard block  | 
                                                    ||
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 |  	public function load_scripts_styles() { | 
                                                        
| 214 | - wp_enqueue_script( 'ee_admin_js' );  | 
                                                        |
| 215 | - wp_enqueue_script( 'ee-text-links' );  | 
                                                        |
| 216 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );  | 
                                                        |
| 214 | +		wp_enqueue_script('ee_admin_js'); | 
                                                        |
| 215 | +		wp_enqueue_script('ee-text-links'); | 
                                                        |
| 216 | +		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 217 | 217 | }  | 
                                                        
| 218 | 218 | |
| 219 | 219 | |
@@ -222,9 +222,9 @@ discard block  | 
                                                    ||
| 222 | 222 | |
| 223 | 223 |  	public function load_scripts_styles_default() { | 
                                                        
| 224 | 224 | //styles  | 
                                                        
| 225 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );  | 
                                                        |
| 226 | - wp_enqueue_style( 'espresso_payments' );  | 
                                                        |
| 227 | - wp_enqueue_style( 'ee-text-links' );  | 
                                                        |
| 225 | +		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 226 | +		wp_enqueue_style('espresso_payments'); | 
                                                        |
| 227 | +		wp_enqueue_style('ee-text-links'); | 
                                                        |
| 228 | 228 | //scripts  | 
                                                        
| 229 | 229 | }  | 
                                                        
| 230 | 230 | |
@@ -238,27 +238,27 @@ discard block  | 
                                                    ||
| 238 | 238 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a  | 
                                                        
| 239 | 239 | * recheck here.  | 
                                                        
| 240 | 240 | */  | 
                                                        
| 241 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );  | 
                                                        |
| 241 | +		EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        |
| 242 | 242 | EEM_Payment_Method::instance()->verify_button_urls();  | 
                                                        
| 243 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' );  | 
                                                        |
| 244 | - EE_Registry::instance()->load_helper( 'HTML' );  | 
                                                        |
| 243 | +		EE_Registry::instance()->load_helper('Tabbed_Content'); | 
                                                        |
| 244 | +		EE_Registry::instance()->load_helper('HTML'); | 
                                                        |
| 245 | 245 | //setup tabs, one for each payment method type  | 
                                                        
| 246 | 246 | $tabs = array();  | 
                                                        
| 247 | -		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { | 
                                                        |
| 247 | +		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { | 
                                                        |
| 248 | 248 | // we don't want to show admin-only PMTs for now  | 
                                                        
| 249 | -			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { | 
                                                        |
| 249 | +			if ($pmt_obj instanceof EE_PMT_Admin_Only) { | 
                                                        |
| 250 | 250 | continue;  | 
                                                        
| 251 | 251 | }  | 
                                                        
| 252 | 252 | //check access  | 
                                                        
| 253 | -			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { | 
                                                        |
| 253 | +			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { | 
                                                        |
| 254 | 254 | continue;  | 
                                                        
| 255 | 255 | }  | 
                                                        
| 256 | 256 | //check for any active pms of that type  | 
                                                        
| 257 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );  | 
                                                        |
| 258 | -			if ( ! $payment_method instanceof EE_Payment_Method ) { | 
                                                        |
| 257 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());  | 
                                                        |
| 258 | +			if ( ! $payment_method instanceof EE_Payment_Method) { | 
                                                        |
| 259 | 259 | $payment_method = EE_Payment_Method::new_instance(  | 
                                                        
| 260 | 260 | array(  | 
                                                        
| 261 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ),  | 
                                                        |
| 261 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()),  | 
                                                        |
| 262 | 262 | 'PMD_type' =>$pmt_obj->system_name(),  | 
                                                        
| 263 | 263 | 'PMD_name' =>$pmt_obj->pretty_name(),  | 
                                                        
| 264 | 264 | 'PMD_admin_name' =>$pmt_obj->pretty_name()  | 
                                                        
@@ -268,11 +268,11 @@ discard block  | 
                                                    ||
| 268 | 268 | |
| 269 | 269 | add_meta_box(  | 
                                                        
| 270 | 270 | //html id  | 
                                                        
| 271 | - 'espresso_' . $payment_method->slug() . '_payment_settings',  | 
                                                        |
| 271 | + 'espresso_'.$payment_method->slug().'_payment_settings',  | 
                                                        |
| 272 | 272 | //title  | 
                                                        
| 273 | -				sprintf( __('%s Settings', 'event_espresso'), $payment_method->admin_name() ), | 
                                                        |
| 273 | +				sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), | 
                                                        |
| 274 | 274 | //callback  | 
                                                        
| 275 | - array( $this, 'payment_method_settings_meta_box' ),  | 
                                                        |
| 275 | + array($this, 'payment_method_settings_meta_box'),  | 
                                                        |
| 276 | 276 | //post type  | 
                                                        
| 277 | 277 | NULL,  | 
                                                        
| 278 | 278 | //context  | 
                                                        
@@ -280,20 +280,20 @@ discard block  | 
                                                    ||
| 280 | 280 | //priority  | 
                                                        
| 281 | 281 | 'default',  | 
                                                        
| 282 | 282 | //callback args  | 
                                                        
| 283 | - array( 'payment_method' => $payment_method )  | 
                                                        |
| 283 | +				array('payment_method' => $payment_method) | 
                                                        |
| 284 | 284 | );  | 
                                                        
| 285 | 285 | |
| 286 | 286 | //setup for tabbed content  | 
                                                        
| 287 | 287 | $tabs[$payment_method->slug()] = array(  | 
                                                        
| 288 | 288 | 'label' => $payment_method->admin_name(),  | 
                                                        
| 289 | 289 | 'class' => $payment_method->active() ? 'gateway-active' : '',  | 
                                                        
| 290 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings',  | 
                                                        |
| 290 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings',  | 
                                                        |
| 291 | 291 |  				'title' => __('Modify this Payment Method', 'event_espresso'), | 
                                                        
| 292 | 292 | 'slug' => $payment_method->slug()  | 
                                                        
| 293 | 293 | );  | 
                                                        
| 294 | 294 | }  | 
                                                        
| 295 | 295 | |
| 296 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );  | 
                                                        |
| 296 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());  | 
                                                        |
| 297 | 297 | $this->display_admin_page_with_sidebar();  | 
                                                        
| 298 | 298 | |
| 299 | 299 | }  | 
                                                        
@@ -304,20 +304,20 @@ discard block  | 
                                                    ||
| 304 | 304 | * _get_active_payment_method_slug  | 
                                                        
| 305 | 305 | * @return string  | 
                                                        
| 306 | 306 | */  | 
                                                        
| 307 | -	protected function _get_active_payment_method_slug(){ | 
                                                        |
| 307 | +	protected function _get_active_payment_method_slug() { | 
                                                        |
| 308 | 308 | $payment_method_slug = FALSE;  | 
                                                        
| 309 | 309 | //decide which payment method tab to open first, as dictated by the request's 'payment_method'  | 
                                                        
| 310 | -		if ( isset( $this->_req_data['payment_method'] )) { | 
                                                        |
| 310 | +		if (isset($this->_req_data['payment_method'])) { | 
                                                        |
| 311 | 311 | // if they provided the current payment method, use it  | 
                                                        
| 312 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );  | 
                                                        |
| 312 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']);  | 
                                                        |
| 313 | 313 | }  | 
                                                        
| 314 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));  | 
                                                        |
| 314 | +		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); | 
                                                        |
| 315 | 315 | // if that didn't work or wasn't provided, find another way to select the current pm  | 
                                                        
| 316 | -		if ( ! $this->_verify_payment_method( $payment_method )) { | 
                                                        |
| 316 | +		if ( ! $this->_verify_payment_method($payment_method)) { | 
                                                        |
| 317 | 317 | // like, looking for an active one  | 
                                                        
| 318 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );  | 
                                                        |
| 318 | +			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); | 
                                                        |
| 319 | 319 | // test that one as well  | 
                                                        
| 320 | -			if ( $this->_verify_payment_method( $payment_method )) { | 
                                                        |
| 320 | +			if ($this->_verify_payment_method($payment_method)) { | 
                                                        |
| 321 | 321 | $payment_method_slug = $payment_method->slug();  | 
                                                        
| 322 | 322 |  			} else { | 
                                                        
| 323 | 323 | $payment_method_slug = 'paypal_standard';  | 
                                                        
@@ -335,11 +335,11 @@ discard block  | 
                                                    ||
| 335 | 335 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 336 | 336 | * @return boolean  | 
                                                        
| 337 | 337 | */  | 
                                                        
| 338 | -	protected function _verify_payment_method( $payment_method ){ | 
                                                        |
| 338 | +	protected function _verify_payment_method($payment_method) { | 
                                                        |
| 339 | 339 | if (  | 
                                                        
| 340 | 340 | $payment_method instanceof EE_Payment_Method &&  | 
                                                        
| 341 | 341 | $payment_method->type_obj() instanceof EE_PMT_Base &&  | 
                                                        
| 342 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )  | 
                                                        |
| 342 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')  | 
                                                        |
| 343 | 343 |  		) { | 
                                                        
| 344 | 344 | return TRUE;  | 
                                                        
| 345 | 345 | }  | 
                                                        
@@ -356,21 +356,21 @@ discard block  | 
                                                    ||
| 356 | 356 | * @return string  | 
                                                        
| 357 | 357 | * @throws EE_Error  | 
                                                        
| 358 | 358 | */  | 
                                                        
| 359 | -	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ | 
                                                        |
| 360 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;  | 
                                                        |
| 361 | -		if ( ! $payment_method instanceof EE_Payment_Method ){ | 
                                                        |
| 362 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));  | 
                                                        |
| 359 | +	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { | 
                                                        |
| 360 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;  | 
                                                        |
| 361 | +		if ( ! $payment_method instanceof EE_Payment_Method) { | 
                                                        |
| 362 | +			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); | 
                                                        |
| 363 | 363 | }  | 
                                                        
| 364 | 364 | $payment_method_scopes = $payment_method->active();  | 
                                                        
| 365 | 365 | // if the payment method really exists show its form, otherwise the activation template  | 
                                                        
| 366 | -		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { | 
                                                        |
| 367 | - $form = $this->_generate_payment_method_settings_form( $payment_method );  | 
                                                        |
| 368 | -				if ( $form->form_data_present_in( $this->_req_data )) { | 
                                                        |
| 369 | - $form->receive_form_submission( $this->_req_data );  | 
                                                        |
| 366 | +		if ($payment_method->ID() && ! empty($payment_method_scopes)) { | 
                                                        |
| 367 | + $form = $this->_generate_payment_method_settings_form($payment_method);  | 
                                                        |
| 368 | +				if ($form->form_data_present_in($this->_req_data)) { | 
                                                        |
| 369 | + $form->receive_form_submission($this->_req_data);  | 
                                                        |
| 370 | 370 | }  | 
                                                        
| 371 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close();  | 
                                                        |
| 371 | + echo $form->form_open().$form->get_html_and_js().$form->form_close();  | 
                                                        |
| 372 | 372 |  		} else { | 
                                                        
| 373 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();  | 
                                                        |
| 373 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();  | 
                                                        |
| 374 | 374 | }  | 
                                                        
| 375 | 375 | }  | 
                                                        
| 376 | 376 | |
@@ -383,14 +383,14 @@ discard block  | 
                                                    ||
| 383 | 383 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 384 | 384 | * @return \EE_Form_Section_Proper  | 
                                                        
| 385 | 385 | */  | 
                                                        
| 386 | -	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { | 
                                                        |
| 387 | -		if ( ! $payment_method instanceof EE_Payment_Method ){ | 
                                                        |
| 386 | +	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { | 
                                                        |
| 387 | +		if ( ! $payment_method instanceof EE_Payment_Method) { | 
                                                        |
| 388 | 388 | return new EE_Form_Section_Proper();  | 
                                                        
| 389 | 389 | }  | 
                                                        
| 390 | 390 | return new EE_Form_Section_Proper(  | 
                                                        
| 391 | 391 | array(  | 
                                                        
| 392 | - 'name' => $payment_method->slug() . '_settings_form',  | 
                                                        |
| 393 | - 'html_id' => $payment_method->slug() . '_settings_form',  | 
                                                        |
| 392 | + 'name' => $payment_method->slug().'_settings_form',  | 
                                                        |
| 393 | + 'html_id' => $payment_method->slug().'_settings_form',  | 
                                                        |
| 394 | 394 | 'action' => EE_Admin_Page::add_query_args_and_nonce(  | 
                                                        
| 395 | 395 | array(  | 
                                                        
| 396 | 396 | 'action' => 'update_payment_method',  | 
                                                        
@@ -402,12 +402,12 @@ discard block  | 
                                                    ||
| 402 | 402 | 'subsections' => apply_filters(  | 
                                                        
| 403 | 403 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',  | 
                                                        
| 404 | 404 | array(  | 
                                                        
| 405 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ),  | 
                                                        |
| 406 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ),  | 
                                                        |
| 407 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ),  | 
                                                        |
| 408 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ),  | 
                                                        |
| 409 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ),  | 
                                                        |
| 410 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print()  | 
                                                        |
| 405 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method),  | 
                                                        |
| 406 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method),  | 
                                                        |
| 407 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method),  | 
                                                        |
| 408 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method),  | 
                                                        |
| 409 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method),  | 
                                                        |
| 410 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print()  | 
                                                        |
| 411 | 411 | )  | 
                                                        
| 412 | 412 | )  | 
                                                        
| 413 | 413 | )  | 
                                                        
@@ -423,19 +423,19 @@ discard block  | 
                                                    ||
| 423 | 423 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 424 | 424 | * @return \EE_Form_Section_Proper  | 
                                                        
| 425 | 425 | */  | 
                                                        
| 426 | -	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { | 
                                                        |
| 427 | -		if ( $payment_method->type_obj()->requires_https() ) { | 
                                                        |
| 426 | +	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { | 
                                                        |
| 427 | +		if ($payment_method->type_obj()->requires_https()) { | 
                                                        |
| 428 | 428 | return new EE_Form_Section_HTML(  | 
                                                        
| 429 | 429 | EEH_HTML::tr(  | 
                                                        
| 430 | 430 | EEH_HTML::th(  | 
                                                        
| 431 | 431 | EEH_HTML::label(  | 
                                                        
| 432 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )  | 
                                                        |
| 432 | +							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') | 
                                                        |
| 433 | 433 | )  | 
                                                        
| 434 | - ) .  | 
                                                        |
| 434 | + ).  | 
                                                        |
| 435 | 435 | EEH_HTML::td(  | 
                                                        
| 436 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .  | 
                                                        |
| 437 | - EEH_HTML::br() .  | 
                                                        |
| 438 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))  | 
                                                        |
| 436 | +						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). | 
                                                        |
| 437 | + EEH_HTML::br().  | 
                                                        |
| 438 | +						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) | 
                                                        |
| 439 | 439 | )  | 
                                                        
| 440 | 440 | )  | 
                                                        
| 441 | 441 | );  | 
                                                        
@@ -453,19 +453,19 @@ discard block  | 
                                                    ||
| 453 | 453 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 454 | 454 | * @return \EE_Form_Section_Proper  | 
                                                        
| 455 | 455 | */  | 
                                                        
| 456 | -	protected function _currency_support( EE_Payment_Method $payment_method ) { | 
                                                        |
| 457 | -		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { | 
                                                        |
| 456 | +	protected function _currency_support(EE_Payment_Method $payment_method) { | 
                                                        |
| 457 | +		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { | 
                                                        |
| 458 | 458 | return new EE_Form_Section_HTML(  | 
                                                        
| 459 | 459 | EEH_HTML::tr(  | 
                                                        
| 460 | 460 | EEH_HTML::th(  | 
                                                        
| 461 | 461 | EEH_HTML::label(  | 
                                                        
| 462 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )  | 
                                                        |
| 462 | +							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') | 
                                                        |
| 463 | 463 | )  | 
                                                        
| 464 | - ) .  | 
                                                        |
| 464 | + ).  | 
                                                        |
| 465 | 465 | EEH_HTML::td(  | 
                                                        
| 466 | 466 | EEH_HTML::strong(  | 
                                                        
| 467 | 467 | sprintf(  | 
                                                        
| 468 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),  | 
                                                        |
| 468 | +								__('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), | 
                                                        |
| 469 | 469 | EE_Config::instance()->currency->code  | 
                                                        
| 470 | 470 | )  | 
                                                        
| 471 | 471 | )  | 
                                                        
@@ -485,9 +485,9 @@ discard block  | 
                                                    ||
| 485 | 485 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 486 | 486 | * @return \EE_Form_Section_HTML  | 
                                                        
| 487 | 487 | */  | 
                                                        
| 488 | -	protected function _payment_method_settings( EE_Payment_Method $payment_method ) { | 
                                                        |
| 488 | +	protected function _payment_method_settings(EE_Payment_Method $payment_method) { | 
                                                        |
| 489 | 489 | //modify the form so we only have/show fields that will be implemented for this version  | 
                                                        
| 490 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );  | 
                                                        |
| 490 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());  | 
                                                        |
| 491 | 491 | }  | 
                                                        
| 492 | 492 | |
| 493 | 493 | |
@@ -500,8 +500,8 @@ discard block  | 
                                                    ||
| 500 | 500 | * @return \EE_Payment_Method_Form  | 
                                                        
| 501 | 501 | * @throws \EE_Error  | 
                                                        
| 502 | 502 | */  | 
                                                        
| 503 | -	protected function _simplify_form( $form_section, $payment_method_name = '' ){ | 
                                                        |
| 504 | -		if ( $form_section instanceof EE_Payment_Method_Form ) { | 
                                                        |
| 503 | +	protected function _simplify_form($form_section, $payment_method_name = '') { | 
                                                        |
| 504 | +		if ($form_section instanceof EE_Payment_Method_Form) { | 
                                                        |
| 505 | 505 | $form_section->exclude(  | 
                                                        
| 506 | 506 | array(  | 
                                                        
| 507 | 507 | 'PMD_type', //dont want them changing the type  | 
                                                        
@@ -512,7 +512,7 @@ discard block  | 
                                                    ||
| 512 | 512 | );  | 
                                                        
| 513 | 513 | return $form_section;  | 
                                                        
| 514 | 514 |  		} else { | 
                                                        
| 515 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name ));  | 
                                                        |
| 515 | +			throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); | 
                                                        |
| 516 | 516 | }  | 
                                                        
| 517 | 517 | }  | 
                                                        
| 518 | 518 | |
@@ -525,18 +525,18 @@ discard block  | 
                                                    ||
| 525 | 525 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 526 | 526 | * @return \EE_Form_Section_HTML  | 
                                                        
| 527 | 527 | */  | 
                                                        
| 528 | -	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { | 
                                                        |
| 528 | +	protected function _update_payment_method_button(EE_Payment_Method $payment_method) { | 
                                                        |
| 529 | 529 | $update_button = new EE_Submit_Input(  | 
                                                        
| 530 | 530 | array(  | 
                                                        
| 531 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings',  | 
                                                        |
| 532 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),  | 
                                                        |
| 531 | + 'html_id' => 'save_'.$payment_method->slug().'_settings',  | 
                                                        |
| 532 | +				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), | 
                                                        |
| 533 | 533 | 'html_label' => EEH_HTML::nbsp()  | 
                                                        
| 534 | 534 | )  | 
                                                        
| 535 | 535 | );  | 
                                                        
| 536 | 536 | return new EE_Form_Section_HTML(  | 
                                                        
| 537 | - EEH_HTML::no_row( EEH_HTML::br(2) ) .  | 
                                                        |
| 537 | + EEH_HTML::no_row(EEH_HTML::br(2)).  | 
                                                        |
| 538 | 538 | EEH_HTML::tr(  | 
                                                        
| 539 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .  | 
                                                        |
| 539 | +				EEH_HTML::th(__('Update Settings', 'event_espresso')). | 
                                                        |
| 540 | 540 | EEH_HTML::td(  | 
                                                        
| 541 | 541 | $update_button->get_html_for_input()  | 
                                                        
| 542 | 542 | )  | 
                                                        
@@ -553,11 +553,11 @@ discard block  | 
                                                    ||
| 553 | 553 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 554 | 554 | * @return \EE_Form_Section_Proper  | 
                                                        
| 555 | 555 | */  | 
                                                        
| 556 | -	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { | 
                                                        |
| 557 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );  | 
                                                        |
| 556 | +	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { | 
                                                        |
| 557 | +		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); | 
                                                        |
| 558 | 558 | return new EE_Form_Section_HTML(  | 
                                                        
| 559 | 559 | EEH_HTML::tr(  | 
                                                        
| 560 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .  | 
                                                        |
| 560 | +				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). | 
                                                        |
| 561 | 561 | EEH_HTML::td(  | 
                                                        
| 562 | 562 | EEH_HTML::link(  | 
                                                        
| 563 | 563 | EE_Admin_Page::add_query_args_and_nonce(  | 
                                                        
@@ -569,7 +569,7 @@ discard block  | 
                                                    ||
| 569 | 569 | ),  | 
                                                        
| 570 | 570 | $link_text_and_title,  | 
                                                        
| 571 | 571 | $link_text_and_title,  | 
                                                        
| 572 | - 'deactivate_' . $payment_method->slug(),  | 
                                                        |
| 572 | + 'deactivate_'.$payment_method->slug(),  | 
                                                        |
| 573 | 573 | 'espresso-button button-secondary'  | 
                                                        
| 574 | 574 | )  | 
                                                        
| 575 | 575 | )  | 
                                                        
@@ -585,12 +585,12 @@ discard block  | 
                                                    ||
| 585 | 585 | * @param \EE_Payment_Method $payment_method  | 
                                                        
| 586 | 586 | * @return \EE_Form_Section_Proper  | 
                                                        
| 587 | 587 | */  | 
                                                        
| 588 | -	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { | 
                                                        |
| 589 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );  | 
                                                        |
| 588 | +	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { | 
                                                        |
| 589 | +		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); | 
                                                        |
| 590 | 590 | return new EE_Form_Section_Proper(  | 
                                                        
| 591 | 591 | array(  | 
                                                        
| 592 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form',  | 
                                                        |
| 593 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form',  | 
                                                        |
| 592 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form',  | 
                                                        |
| 593 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form',  | 
                                                        |
| 594 | 594 | 'action' => '#',  | 
                                                        
| 595 | 595 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(),  | 
                                                        
| 596 | 596 | 'subsections' => apply_filters(  | 
                                                        
@@ -599,8 +599,8 @@ discard block  | 
                                                    ||
| 599 | 599 | new EE_Form_Section_HTML(  | 
                                                        
| 600 | 600 | EEH_HTML::tr(  | 
                                                        
| 601 | 601 | EEH_HTML::th(  | 
                                                        
| 602 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))  | 
                                                        |
| 603 | - ) .  | 
                                                        |
| 602 | +									EEH_HTML::label(__('Click to Activate ', 'event_espresso')) | 
                                                        |
| 603 | + ).  | 
                                                        |
| 604 | 604 | EEH_HTML::td(  | 
                                                        
| 605 | 605 | EEH_HTML::link(  | 
                                                        
| 606 | 606 | EE_Admin_Page::add_query_args_and_nonce(  | 
                                                        
@@ -612,7 +612,7 @@ discard block  | 
                                                    ||
| 612 | 612 | ),  | 
                                                        
| 613 | 613 | $link_text_and_title,  | 
                                                        
| 614 | 614 | $link_text_and_title,  | 
                                                        
| 615 | - 'activate_' . $payment_method->slug(),  | 
                                                        |
| 615 | + 'activate_'.$payment_method->slug(),  | 
                                                        |
| 616 | 616 | 'espresso-button-green button-primary'  | 
                                                        
| 617 | 617 | )  | 
                                                        
| 618 | 618 | )  | 
                                                        
@@ -633,9 +633,9 @@ discard block  | 
                                                    ||
| 633 | 633 |  	protected function _fine_print() { | 
                                                        
| 634 | 634 | return new EE_Form_Section_HTML(  | 
                                                        
| 635 | 635 | EEH_HTML::tr(  | 
                                                        
| 636 | - EEH_HTML::th() .  | 
                                                        |
| 636 | + EEH_HTML::th().  | 
                                                        |
| 637 | 637 | EEH_HTML::td(  | 
                                                        
| 638 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )  | 
                                                        |
| 638 | +					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') | 
                                                        |
| 639 | 639 | )  | 
                                                        
| 640 | 640 | )  | 
                                                        
| 641 | 641 | );  | 
                                                        
@@ -647,15 +647,15 @@ discard block  | 
                                                    ||
| 647 | 647 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)  | 
                                                        
| 648 | 648 | * @global WP_User $current_user  | 
                                                        
| 649 | 649 | */  | 
                                                        
| 650 | -	protected function _activate_payment_method(){ | 
                                                        |
| 651 | -		if(isset($this->_req_data['payment_method_type'])){ | 
                                                        |
| 650 | +	protected function _activate_payment_method() { | 
                                                        |
| 651 | +		if (isset($this->_req_data['payment_method_type'])) { | 
                                                        |
| 652 | 652 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);  | 
                                                        
| 653 | 653 | //see if one exists  | 
                                                        
| 654 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );  | 
                                                        |
| 655 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );  | 
                                                        |
| 654 | +			EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        |
| 655 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);  | 
                                                        |
| 656 | 656 | |
| 657 | -			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); | 
                                                        |
| 658 | -		}else{ | 
                                                        |
| 657 | +			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); | 
                                                        |
| 658 | +		} else { | 
                                                        |
| 659 | 659 |  			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); | 
                                                        
| 660 | 660 | }  | 
                                                        
| 661 | 661 | }  | 
                                                        
@@ -663,14 +663,14 @@ discard block  | 
                                                    ||
| 663 | 663 | /**  | 
                                                        
| 664 | 664 | * Deactivates the payment method with the specified slug, and redirects.  | 
                                                        
| 665 | 665 | */  | 
                                                        
| 666 | -	protected function _deactivate_payment_method(){ | 
                                                        |
| 667 | -		if(isset($this->_req_data['payment_method'])){ | 
                                                        |
| 666 | +	protected function _deactivate_payment_method() { | 
                                                        |
| 667 | +		if (isset($this->_req_data['payment_method'])) { | 
                                                        |
| 668 | 668 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']);  | 
                                                        
| 669 | 669 | //deactivate it  | 
                                                        
| 670 | 670 |  			EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        
| 671 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );  | 
                                                        |
| 672 | -			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); | 
                                                        |
| 673 | -		}else{ | 
                                                        |
| 671 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);  | 
                                                        |
| 672 | +			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); | 
                                                        |
| 673 | +		} else { | 
                                                        |
| 674 | 674 |  			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); | 
                                                        
| 675 | 675 | }  | 
                                                        
| 676 | 676 | }  | 
                                                        
@@ -684,39 +684,39 @@ discard block  | 
                                                    ||
| 684 | 684 | * subsequently called 'headers_sent_func' which is _payment_methods_list)  | 
                                                        
| 685 | 685 | * @return void  | 
                                                        
| 686 | 686 | */  | 
                                                        
| 687 | -	protected function _update_payment_method(){ | 
                                                        |
| 688 | -		if( $_SERVER['REQUEST_METHOD'] == 'POST'){ | 
                                                        |
| 687 | +	protected function _update_payment_method() { | 
                                                        |
| 688 | +		if ($_SERVER['REQUEST_METHOD'] == 'POST') { | 
                                                        |
| 689 | 689 | //ok let's find which gateway form to use based on the form input  | 
                                                        
| 690 | 690 |  			EE_Registry::instance()->load_lib('Payment_Method_Manager'); | 
                                                        
| 691 | 691 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */  | 
                                                        
| 692 | 692 | $correct_pmt_form_to_use = NULL;  | 
                                                        
| 693 | 693 | $pmt_obj = NULL;  | 
                                                        
| 694 | -			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ | 
                                                        |
| 694 | +			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { | 
                                                        |
| 695 | 695 | /** @var $pmt_obj EE_PMT_Base */  | 
                                                        
| 696 | 696 | //get the form and simplify it, like what we do when we display it  | 
                                                        
| 697 | 697 | $pmt_form = $pmt_obj->settings_form();  | 
                                                        
| 698 | 698 | $this->_simplify_form($pmt_form);  | 
                                                        
| 699 | -				if($pmt_form->form_data_present_in($this->_req_data)){ | 
                                                        |
| 699 | +				if ($pmt_form->form_data_present_in($this->_req_data)) { | 
                                                        |
| 700 | 700 | $correct_pmt_form_to_use = $pmt_form;  | 
                                                        
| 701 | 701 | break;  | 
                                                        
| 702 | 702 | }  | 
                                                        
| 703 | 703 | }  | 
                                                        
| 704 | 704 | //if we couldn't find the correct payment method type...  | 
                                                        
| 705 | -			if( ! $correct_pmt_form_to_use ){ | 
                                                        |
| 705 | +			if ( ! $correct_pmt_form_to_use) { | 
                                                        |
| 706 | 706 |  				EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        
| 707 | 707 |  				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); | 
                                                        
| 708 | 708 | }  | 
                                                        
| 709 | 709 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data);  | 
                                                        
| 710 | -			if($correct_pmt_form_to_use->is_valid()){ | 
                                                        |
| 710 | +			if ($correct_pmt_form_to_use->is_valid()) { | 
                                                        |
| 711 | 711 | $correct_pmt_form_to_use->save();  | 
                                                        
| 712 | 712 | $pm = $correct_pmt_form_to_use->get_model_object();  | 
                                                        
| 713 | 713 | /** @var $pm EE_Payment_Method */  | 
                                                        
| 714 | -				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); | 
                                                        |
| 715 | -			}else{ | 
                                                        |
| 714 | +				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); | 
                                                        |
| 715 | +			} else { | 
                                                        |
| 716 | 716 | EE_Error::add_error(  | 
                                                        
| 717 | 717 | sprintf(  | 
                                                        
| 718 | 718 |  						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), | 
                                                        
| 719 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )  | 
                                                        |
| 719 | +						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') | 
                                                        |
| 720 | 720 | ),  | 
                                                        
| 721 | 721 | __FILE__,  | 
                                                        
| 722 | 722 | __FUNCTION__,  | 
                                                        
@@ -733,11 +733,11 @@ discard block  | 
                                                    ||
| 733 | 733 |  	protected function _payment_settings() { | 
                                                        
| 734 | 734 | |
| 735 | 735 | $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        
| 736 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE;  | 
                                                        |
| 736 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE;  | 
                                                        |
| 737 | 737 | |
| 738 | - $this->_set_add_edit_form_tags( 'update_payment_settings' );  | 
                                                        |
| 739 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );  | 
                                                        |
| 740 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );  | 
                                                        |
| 738 | +		$this->_set_add_edit_form_tags('update_payment_settings'); | 
                                                        |
| 739 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);  | 
                                                        |
| 740 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);  | 
                                                        |
| 741 | 741 | $this->display_admin_page_with_sidebar();  | 
                                                        
| 742 | 742 | |
| 743 | 743 | }  | 
                                                        
@@ -751,13 +751,13 @@ discard block  | 
                                                    ||
| 751 | 751 | * @return array  | 
                                                        
| 752 | 752 | */  | 
                                                        
| 753 | 753 |  	protected function _update_payment_settings() { | 
                                                        
| 754 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;  | 
                                                        |
| 755 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );  | 
                                                        |
| 754 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE;  | 
                                                        |
| 755 | +		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); | 
                                                        |
| 756 | 756 | |
| 757 | 757 | |
| 758 | -		$what = __('Payment Settings','event_espresso'); | 
                                                        |
| 759 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 760 | -		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); | 
                                                        |
| 758 | +		$what = __('Payment Settings', 'event_espresso'); | 
                                                        |
| 759 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 760 | +		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); | 
                                                        |
| 761 | 761 | |
| 762 | 762 | }  | 
                                                        
| 763 | 763 |  	protected function _payment_log_overview_list_table() { | 
                                                        
@@ -783,18 +783,18 @@ discard block  | 
                                                    ||
| 783 | 783 | * @param bool $count  | 
                                                        
| 784 | 784 | * @return array  | 
                                                        
| 785 | 785 | */  | 
                                                        
| 786 | -	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ | 
                                                        |
| 787 | - EE_Registry::instance()->load_model( 'Change_Log' );  | 
                                                        |
| 786 | +	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { | 
                                                        |
| 787 | +		EE_Registry::instance()->load_model('Change_Log'); | 
                                                        |
| 788 | 788 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params  | 
                                                        
| 789 | -		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway)); | 
                                                        |
| 789 | +		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway)); | 
                                                        |
| 790 | 790 | //check if they've selected a specific payment method  | 
                                                        
| 791 | -		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ | 
                                                        |
| 791 | +		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { | 
                                                        |
| 792 | 792 |  			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], | 
                                                        
| 793 | 793 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);  | 
                                                        
| 794 | 794 | }  | 
                                                        
| 795 | 795 | //take into account search  | 
                                                        
| 796 | -		if(isset($this->_req_data['s']) && $this->_req_data['s']){ | 
                                                        |
| 797 | -			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); | 
                                                        |
| 796 | +		if (isset($this->_req_data['s']) && $this->_req_data['s']) { | 
                                                        |
| 797 | +			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); | 
                                                        |
| 798 | 798 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;  | 
                                                        
| 799 | 799 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;  | 
                                                        
| 800 | 800 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;  | 
                                                        
@@ -809,48 +809,48 @@ discard block  | 
                                                    ||
| 809 | 809 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string;  | 
                                                        
| 810 | 810 | |
| 811 | 811 | }  | 
                                                        
| 812 | -		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ | 
                                                        |
| 812 | +		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { | 
                                                        |
| 813 | 813 | //add date  | 
                                                        
| 814 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );  | 
                                                        |
| 815 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );  | 
                                                        |
| 814 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);  | 
                                                        |
| 815 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);  | 
                                                        |
| 816 | 816 | //make sure our timestamps start and end right at the boundaries for each day  | 
                                                        
| 817 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';  | 
                                                        |
| 818 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';  | 
                                                        |
| 817 | +			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; | 
                                                        |
| 818 | +			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; | 
                                                        |
| 819 | 819 | |
| 820 | 820 | //convert to timestamps  | 
                                                        
| 821 | - $start_date = strtotime( $start_date );  | 
                                                        |
| 822 | - $end_date = strtotime( $end_date );  | 
                                                        |
| 821 | + $start_date = strtotime($start_date);  | 
                                                        |
| 822 | + $end_date = strtotime($end_date);  | 
                                                        |
| 823 | 823 | |
| 824 | 824 | //makes sure start date is the lowest value and vice versa  | 
                                                        
| 825 | - $start_date = min( $start_date, $end_date );  | 
                                                        |
| 826 | - $end_date = max( $start_date, $end_date );  | 
                                                        |
| 825 | + $start_date = min($start_date, $end_date);  | 
                                                        |
| 826 | + $end_date = max($start_date, $end_date);  | 
                                                        |
| 827 | 827 | |
| 828 | 828 | //convert for query  | 
                                                        
| 829 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );  | 
                                                        |
| 830 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );  | 
                                                        |
| 829 | +			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); | 
                                                        |
| 830 | +			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); | 
                                                        |
| 831 | 831 | |
| 832 | -			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); | 
                                                        |
| 832 | +			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); | 
                                                        |
| 833 | 833 | |
| 834 | 834 | }  | 
                                                        
| 835 | -		if($count){ | 
                                                        |
| 835 | +		if ($count) { | 
                                                        |
| 836 | 836 | return EEM_Change_Log::instance()->count($query_params);  | 
                                                        
| 837 | 837 | }  | 
                                                        
| 838 | -		if(isset($this->_req_data['order'])){ | 
                                                        |
| 839 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';  | 
                                                        |
| 838 | +		if (isset($this->_req_data['order'])) { | 
                                                        |
| 839 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';  | 
                                                        |
| 840 | 840 |  			$query_params['order_by'] = array('LOG_time' => $sort); | 
                                                        
| 841 | -		}else{ | 
                                                        |
| 841 | +		} else { | 
                                                        |
| 842 | 842 |  				$query_params['order_by'] = array('LOG_time' => 'DESC'); | 
                                                        
| 843 | 843 | }  | 
                                                        
| 844 | - $offset = ($current_page-1)*$per_page;  | 
                                                        |
| 844 | + $offset = ($current_page - 1) * $per_page;  | 
                                                        |
| 845 | 845 | |
| 846 | -		if( ! isset($this->_req_data['download_results'])){ | 
                                                        |
| 847 | - $query_params['limit'] = array( $offset, $per_page );  | 
                                                        |
| 846 | +		if ( ! isset($this->_req_data['download_results'])) { | 
                                                        |
| 847 | + $query_params['limit'] = array($offset, $per_page);  | 
                                                        |
| 848 | 848 | }  | 
                                                        
| 849 | 849 | |
| 850 | 850 | |
| 851 | 851 | |
| 852 | 852 | //now they've requested to instead just download the file instead of viewing it.  | 
                                                        
| 853 | -		if(isset($this->_req_data['download_results'])){ | 
                                                        |
| 853 | +		if (isset($this->_req_data['download_results'])) { | 
                                                        |
| 854 | 854 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);  | 
                                                        
| 855 | 855 |  			header('Content-Disposition: attachment'); | 
                                                        
| 856 | 856 |  			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); | 
                                                        
@@ -872,36 +872,36 @@ discard block  | 
                                                    ||
| 872 | 872 | * @param EE_Change_Log $logB  | 
                                                        
| 873 | 873 | * @return int  | 
                                                        
| 874 | 874 | */  | 
                                                        
| 875 | -	protected function _sort_logs_again($logA,$logB){ | 
                                                        |
| 875 | +	protected function _sort_logs_again($logA, $logB) { | 
                                                        |
| 876 | 876 |  		$timeA = $logA->get_raw('LOG_time'); | 
                                                        
| 877 | 877 |  		$timeB = $logB->get_raw('LOG_time'); | 
                                                        
| 878 | -		if($timeA == $timeB){ | 
                                                        |
| 878 | +		if ($timeA == $timeB) { | 
                                                        |
| 879 | 879 | return 0;  | 
                                                        
| 880 | 880 | }  | 
                                                        
| 881 | 881 | $comparison = $timeA < $timeB ? -1 : 1;  | 
                                                        
| 882 | -		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ | 
                                                        |
| 882 | +		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { | 
                                                        |
| 883 | 883 | return $comparison * -1;  | 
                                                        
| 884 | -		}else{ | 
                                                        |
| 884 | +		} else { | 
                                                        |
| 885 | 885 | return $comparison;  | 
                                                        
| 886 | 886 | }  | 
                                                        
| 887 | 887 | }  | 
                                                        
| 888 | 888 | |
| 889 | 889 |  	protected function _payment_log_details() { | 
                                                        
| 890 | - EE_Registry::instance()->load_model( 'Change_Log' );  | 
                                                        |
| 890 | +		EE_Registry::instance()->load_model('Change_Log'); | 
                                                        |
| 891 | 891 | /** @var $payment_log EE_Change_Log */  | 
                                                        
| 892 | 892 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);  | 
                                                        
| 893 | 893 | $payment_method = NULL;  | 
                                                        
| 894 | 894 | $transaction = NULL;  | 
                                                        
| 895 | -		if( $payment_log instanceof EE_Change_Log ){ | 
                                                        |
| 896 | -			if( $payment_log->object() instanceof EE_Payment ){ | 
                                                        |
| 895 | +		if ($payment_log instanceof EE_Change_Log) { | 
                                                        |
| 896 | +			if ($payment_log->object() instanceof EE_Payment) { | 
                                                        |
| 897 | 897 | $payment_method = $payment_log->object()->payment_method();  | 
                                                        
| 898 | 898 | $transaction = $payment_log->object()->transaction();  | 
                                                        
| 899 | -			}elseif($payment_log->object() instanceof EE_Payment_Method){ | 
                                                        |
| 899 | +			}elseif ($payment_log->object() instanceof EE_Payment_Method) { | 
                                                        |
| 900 | 900 | $payment_method = $payment_log->object();  | 
                                                        
| 901 | 901 | }  | 
                                                        
| 902 | 902 | }  | 
                                                        
| 903 | 903 | $this->_template_args['admin_page_content'] = EEH_Template::display_template(  | 
                                                        
| 904 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',  | 
                                                        |
| 904 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',  | 
                                                        |
| 905 | 905 | array(  | 
                                                        
| 906 | 906 | 'payment_log'=>$payment_log,  | 
                                                        
| 907 | 907 | 'payment_method'=>$payment_method,  | 
                                                        
@@ -1565,8 +1565,6 @@ discard block  | 
                                                    ||
| 1565 | 1565 | * form_form_field_input__wrap  | 
                                                        
| 1566 | 1566 | *  | 
                                                        
| 1567 | 1567 | * @access public  | 
                                                        
| 1568 | - * @param string $label  | 
                                                        |
| 1569 | - * @return string  | 
                                                        |
| 1570 | 1568 | */  | 
                                                        
| 1571 | 1569 |  	public function form_form_field_input__wrap( $input ) { | 
                                                        
| 1572 | 1570 | return '  | 
                                                        
@@ -1649,6 +1647,10 @@ discard block  | 
                                                    ||
| 1649 | 1647 | |
| 1650 | 1648 | |
| 1651 | 1649 | //TODO: try changing this to use the model directly... not indirectly through creating a default object...  | 
                                                        
| 1650 | +  | 
                                                        |
| 1651 | + /**  | 
                                                        |
| 1652 | + * @param boolean $REG_ID  | 
                                                        |
| 1653 | + */  | 
                                                        |
| 1652 | 1654 |  	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { | 
                                                        
| 1653 | 1655 | $set_values = array(  | 
                                                        
| 1654 | 1656 | 'QST_ID' => $QST_ID,  | 
                                                        
@@ -1,4 +1,6 @@ discard block  | 
                                                    ||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); | 
                                                        |
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        |
| 2 | +	exit('No direct script access allowed'); | 
                                                        |
| 3 | +}  | 
                                                        |
| 2 | 4 | /**  | 
                                                        
| 3 | 5 | * Event Espresso  | 
                                                        
| 4 | 6 | *  | 
                                                        
@@ -79,8 +81,9 @@ discard block  | 
                                                    ||
| 79 | 81 |  	public function clear_comment_link( $link, $comment, $args ) { | 
                                                        
| 80 | 82 | //gotta make sure this only happens on this route  | 
                                                        
| 81 | 83 | $post_type = get_post_type( $comment->comment_post_ID);  | 
                                                        
| 82 | - if ( $post_type == 'espresso_attendees' )  | 
                                                        |
| 83 | - return '#commentsdiv';  | 
                                                        |
| 84 | +		if ( $post_type == 'espresso_attendees' ) { | 
                                                        |
| 85 | + return '#commentsdiv';  | 
                                                        |
| 86 | + }  | 
                                                        |
| 84 | 87 | return $link;  | 
                                                        
| 85 | 88 | }  | 
                                                        
| 86 | 89 | |
@@ -834,9 +837,9 @@ discard block  | 
                                                    ||
| 834 | 837 | |
| 835 | 838 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;  | 
                                                        
| 836 | 839 | |
| 837 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))  | 
                                                        |
| 838 | - return TRUE;  | 
                                                        |
| 839 | -		else { | 
                                                        |
| 840 | +		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) { | 
                                                        |
| 841 | + return TRUE;  | 
                                                        |
| 842 | +		} else { | 
                                                        |
| 840 | 843 |  			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); | 
                                                        
| 841 | 844 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        
| 842 | 845 | $this->_registration = NULL;  | 
                                                        
@@ -933,7 +936,7 @@ discard block  | 
                                                    ||
| 933 | 936 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),  | 
                                                        
| 934 | 937 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),  | 
                                                        
| 935 | 938 | ));  | 
                                                        
| 936 | -		}elseif($this_month_a || $this_month){ | 
                                                        |
| 939 | +		} elseif($this_month_a || $this_month){ | 
                                                        |
| 937 | 940 |  			$this_month_r = date('m', current_time('timestamp')); | 
                                                        
| 938 | 941 |  			$days_this_month = date( 't', current_time('timestamp') ); | 
                                                        
| 939 | 942 |  			$_where['REG_date']= array('BETWEEN', | 
                                                        
@@ -941,18 +944,18 @@ discard block  | 
                                                    ||
| 941 | 944 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),  | 
                                                        
| 942 | 945 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )  | 
                                                        
| 943 | 946 | ));  | 
                                                        
| 944 | -		}elseif($month_range){ | 
                                                        |
| 947 | +		} elseif($month_range){ | 
                                                        |
| 945 | 948 |  			$pieces = explode(' ', $this->_req_data['month_range'], 3); | 
                                                        
| 946 | 949 |  			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; | 
                                                        
| 947 | 950 | $year_r = !empty($pieces[1]) ? $pieces[1] : '';  | 
                                                        
| 948 | 951 |  			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') ); | 
                                                        
| 949 | 952 |  			$_where['REG_date']= array('BETWEEN', | 
                                                        
| 950 | 953 | array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) );  | 
                                                        
| 951 | -		}elseif($start_date && $end_date){ | 
                                                        |
| 954 | +		} elseif($start_date && $end_date){ | 
                                                        |
| 952 | 955 |  			throw new EE_Error("not yet supported"); | 
                                                        
| 953 | -		}elseif($start_date){ | 
                                                        |
| 956 | +		} elseif($start_date){ | 
                                                        |
| 954 | 957 |  			throw new EE_Error("not yet supported"); | 
                                                        
| 955 | -		}elseif($end_date){ | 
                                                        |
| 958 | +		} elseif($end_date){ | 
                                                        |
| 956 | 959 |  			throw new EE_Error("not yet supported"); | 
                                                        
| 957 | 960 | }  | 
                                                        
| 958 | 961 | |
@@ -1876,8 +1879,9 @@ discard block  | 
                                                    ||
| 1876 | 1879 | // cycle thru checkboxes  | 
                                                        
| 1877 | 1880 |  			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { | 
                                                        
| 1878 | 1881 | $REG = $REG_MDL->get_one_by_ID($REG_ID);  | 
                                                        
| 1879 | - if ( ! $REG instanceof EE_Registration )  | 
                                                        |
| 1880 | - continue;  | 
                                                        |
| 1882 | +				if ( ! $REG instanceof EE_Registration ) { | 
                                                        |
| 1883 | + continue;  | 
                                                        |
| 1884 | + }  | 
                                                        |
| 1881 | 1885 | $deleted = $this->_delete_registration($REG);  | 
                                                        
| 1882 | 1886 |  				if ( !$deleted ) { | 
                                                        
| 1883 | 1887 | $success = 0;  | 
                                                        
@@ -1916,8 +1920,9 @@ discard block  | 
                                                    ||
| 1916 | 1920 | |
| 1917 | 1921 | $all_trashed = TRUE;  | 
                                                        
| 1918 | 1922 |  		foreach ( $REGS as $registration ) { | 
                                                        
| 1919 | -			if ( ! $registration->get('REG_deleted') ) | 
                                                        |
| 1920 | - $all_trashed = FALSE;  | 
                                                        |
| 1923 | +			if ( ! $registration->get('REG_deleted') ) { | 
                                                        |
| 1924 | + $all_trashed = FALSE;  | 
                                                        |
| 1925 | + }  | 
                                                        |
| 1921 | 1926 | }  | 
                                                        
| 1922 | 1927 | |
| 1923 | 1928 |  		if ( ! $all_trashed ) { | 
                                                        
@@ -1943,8 +1948,10 @@ discard block  | 
                                                    ||
| 1943 | 1948 | //now delete permanently the checkins related to this registration.  | 
                                                        
| 1944 | 1949 |  			$registration->delete_related_permanently('Checkin'); | 
                                                        
| 1945 | 1950 | |
| 1946 | - if ( $registration->ID() === $REG->ID() )  | 
                                                        |
| 1947 | - continue; //we don't want to delete permanently the existing registration just yet.  | 
                                                        |
| 1951 | +			if ( $registration->ID() === $REG->ID() ) { | 
                                                        |
| 1952 | + continue;  | 
                                                        |
| 1953 | + }  | 
                                                        |
| 1954 | + //we don't want to delete permanently the existing registration just yet.  | 
                                                        |
| 1948 | 1955 | |
| 1949 | 1956 | //remove relation to transaction for these registrations if NOT the existing registrations  | 
                                                        
| 1950 | 1957 |  			$registration->_remove_relations('Transaction'); | 
                                                        
@@ -1997,8 +2004,9 @@ discard block  | 
                                                    ||
| 1997 | 2004 | |
| 1998 | 2005 | $this->_template_args['step_content'] = $this->_get_registration_step_content();  | 
                                                        
| 1999 | 2006 | |
| 2000 | -		if ( defined('DOING_AJAX' ) ) | 
                                                        |
| 2001 | - $this->_return_json();  | 
                                                        |
| 2007 | +		if ( defined('DOING_AJAX' ) ) { | 
                                                        |
| 2008 | + $this->_return_json();  | 
                                                        |
| 2009 | + }  | 
                                                        |
| 2002 | 2010 | |
| 2003 | 2011 | |
| 2004 | 2012 | // grab header  | 
                                                        
@@ -2412,8 +2420,9 @@ discard block  | 
                                                    ||
| 2412 | 2420 | }  | 
                                                        
| 2413 | 2421 | }  | 
                                                        
| 2414 | 2422 | |
| 2415 | - if ( $success === FALSE )  | 
                                                        |
| 2416 | -			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2423 | +		if ( $success === FALSE ) { | 
                                                        |
| 2424 | +					EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2425 | + }  | 
                                                        |
| 2417 | 2426 | |
| 2418 | 2427 | }  | 
                                                        
| 2419 | 2428 | |
@@ -1,26 +1,26 @@ discard block  | 
                                                    ||
| 1 | 1 |  <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * Event Espresso  | 
                                                        |
| 4 | - *  | 
                                                        |
| 5 | - * Event Registration and Management Plugin for WordPress  | 
                                                        |
| 6 | - *  | 
                                                        |
| 7 | - * @ package Event Espresso  | 
                                                        |
| 8 | - * @ author Seth Shoultes  | 
                                                        |
| 9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved.  | 
                                                        |
| 10 | - * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing * | 
                                                        |
| 11 | - * @ link					{@link http://www.eventespresso.com} | 
                                                        |
| 12 | - * @ since 4.0  | 
                                                        |
| 13 | - *  | 
                                                        |
| 14 | - * ------------------------------------------------------------------------  | 
                                                        |
| 15 | - *  | 
                                                        |
| 16 | - * Registrations_Admin_Page class  | 
                                                        |
| 17 | - *  | 
                                                        |
| 18 | - * @package Event Espresso  | 
                                                        |
| 19 | - * @subpackage includes/core/admin/transactions/Registrations_Admin_Page.core.php  | 
                                                        |
| 20 | - * @author Brent Christensen  | 
                                                        |
| 21 | - *  | 
                                                        |
| 22 | - * ------------------------------------------------------------------------  | 
                                                        |
| 23 | - */  | 
                                                        |
| 3 | + * Event Espresso  | 
                                                        |
| 4 | + *  | 
                                                        |
| 5 | + * Event Registration and Management Plugin for WordPress  | 
                                                        |
| 6 | + *  | 
                                                        |
| 7 | + * @ package Event Espresso  | 
                                                        |
| 8 | + * @ author Seth Shoultes  | 
                                                        |
| 9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved.  | 
                                                        |
| 10 | +					 * @ license			{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing * | 
                                                        |
| 11 | +					 * @ link					{@link http://www.eventespresso.com} | 
                                                        |
| 12 | + * @ since 4.0  | 
                                                        |
| 13 | + *  | 
                                                        |
| 14 | + * ------------------------------------------------------------------------  | 
                                                        |
| 15 | + *  | 
                                                        |
| 16 | + * Registrations_Admin_Page class  | 
                                                        |
| 17 | + *  | 
                                                        |
| 18 | + * @package Event Espresso  | 
                                                        |
| 19 | + * @subpackage includes/core/admin/transactions/Registrations_Admin_Page.core.php  | 
                                                        |
| 20 | + * @author Brent Christensen  | 
                                                        |
| 21 | + *  | 
                                                        |
| 22 | + * ------------------------------------------------------------------------  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | 24 |  class Registrations_Admin_Page extends EE_Admin_Page_CPT { | 
                                                        
| 25 | 25 | |
| 26 | 26 | /**  | 
                                                        
@@ -129,9 +129,9 @@ discard block  | 
                                                    ||
| 129 | 129 | |
| 130 | 130 | /**  | 
                                                        
| 131 | 131 | * grab url requests and route them  | 
                                                        
| 132 | - * @access private  | 
                                                        |
| 133 | - * @return void  | 
                                                        |
| 134 | - */  | 
                                                        |
| 132 | + * @access private  | 
                                                        |
| 133 | + * @return void  | 
                                                        |
| 134 | + */  | 
                                                        |
| 135 | 135 |  	public function _set_page_routes() { | 
                                                        
| 136 | 136 | |
| 137 | 137 | $this->_get_registration_status_array();  | 
                                                        
@@ -403,7 +403,7 @@ discard block  | 
                                                    ||
| 403 | 403 |  						'title' => __('Registrations Other', 'event_espresso'), | 
                                                        
| 404 | 404 | 'filename' => 'registrations_overview_other'  | 
                                                        
| 405 | 405 | )  | 
                                                        
| 406 | - ),  | 
                                                        |
| 406 | + ),  | 
                                                        |
| 407 | 407 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ),  | 
                                                        
| 408 | 408 |  				'qtips' => array('Registration_List_Table_Tips'), | 
                                                        
| 409 | 409 | 'list_table' => 'EE_Registrations_List_Table',  | 
                                                        
@@ -417,7 +417,7 @@ discard block  | 
                                                    ||
| 417 | 417 |  					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url, | 
                                                        
| 418 | 418 | 'persistent' => FALSE  | 
                                                        
| 419 | 419 | ),  | 
                                                        
| 420 | - 'help_tabs' => array(  | 
                                                        |
| 420 | + 'help_tabs' => array(  | 
                                                        |
| 421 | 421 | 'registrations_details_help_tab' => array(  | 
                                                        
| 422 | 422 |  						'title' => __('Registration Details', 'event_espresso'), | 
                                                        
| 423 | 423 | 'filename' => 'registrations_details'  | 
                                                        
@@ -481,7 +481,7 @@ discard block  | 
                                                    ||
| 481 | 481 | 'order' => 20  | 
                                                        
| 482 | 482 | ),  | 
                                                        
| 483 | 483 | 'list_table' => 'EE_Attendee_Contact_List_Table',  | 
                                                        
| 484 | - 'help_tabs' => array(  | 
                                                        |
| 484 | + 'help_tabs' => array(  | 
                                                        |
| 485 | 485 | 'registrations_contact_list_help_tab' => array(  | 
                                                        
| 486 | 486 |  						'title' => __('Registrations Contact List', 'event_espresso'), | 
                                                        
| 487 | 487 | 'filename' => 'registrations_contact_list'  | 
                                                        
@@ -498,7 +498,7 @@ discard block  | 
                                                    ||
| 498 | 498 |  						'title' => __('Contact List Other', 'event_espresso'), | 
                                                        
| 499 | 499 | 'filename' => 'registrations_contact_list_other'  | 
                                                        
| 500 | 500 | )  | 
                                                        
| 501 | - ),  | 
                                                        |
| 501 | + ),  | 
                                                        |
| 502 | 502 | 'help_tour' => array( 'Contact_List_Help_Tour' ),  | 
                                                        
| 503 | 503 | 'metaboxes' => array(),  | 
                                                        
| 504 | 504 | 'require_nonce' => FALSE  | 
                                                        
@@ -532,9 +532,9 @@ discard block  | 
                                                    ||
| 532 | 532 | |
| 533 | 533 | /**  | 
                                                        
| 534 | 534 | * get list of registration statuses  | 
                                                        
| 535 | - * @access private  | 
                                                        |
| 536 | - * @return void  | 
                                                        |
| 537 | - */  | 
                                                        |
| 535 | + * @access private  | 
                                                        |
| 536 | + * @return void  | 
                                                        |
| 537 | + */  | 
                                                        |
| 538 | 538 |  	private function _get_registration_status_array() { | 
                                                        
| 539 | 539 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);  | 
                                                        
| 540 | 540 | }  | 
                                                        
@@ -839,7 +839,7 @@ discard block  | 
                                                    ||
| 839 | 839 | return TRUE;  | 
                                                        
| 840 | 840 | }  | 
                                                        
| 841 | 841 | |
| 842 | - $REG = EEM_Registration::instance();  | 
                                                        |
| 842 | + $REG = EEM_Registration::instance();  | 
                                                        |
| 843 | 843 | |
| 844 | 844 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;  | 
                                                        
| 845 | 845 | |
@@ -1062,9 +1062,9 @@ discard block  | 
                                                    ||
| 1062 | 1062 | |
| 1063 | 1063 | /**  | 
                                                        
| 1064 | 1064 | * generates HTML for the View Registration Details Admin page  | 
                                                        
| 1065 | - * @access protected  | 
                                                        |
| 1066 | - * @return void  | 
                                                        |
| 1067 | - */  | 
                                                        |
| 1065 | + * @access protected  | 
                                                        |
| 1066 | + * @return void  | 
                                                        |
| 1067 | + */  | 
                                                        |
| 1068 | 1068 |  	protected function _registration_details() { | 
                                                        
| 1069 | 1069 | |
| 1070 | 1070 | $this->_template_args = array();  | 
                                                        
@@ -1141,9 +1141,9 @@ discard block  | 
                                                    ||
| 1141 | 1141 | |
| 1142 | 1142 | /**  | 
                                                        
| 1143 | 1143 | * _set_approve_or_decline_reg_status_buttons  | 
                                                        
| 1144 | - * @access protected  | 
                                                        |
| 1145 | - * @return string  | 
                                                        |
| 1146 | - */  | 
                                                        |
| 1144 | + * @access protected  | 
                                                        |
| 1145 | + * @return string  | 
                                                        |
| 1146 | + */  | 
                                                        |
| 1147 | 1147 |  	public function set_reg_status_buttons_metabox() { | 
                                                        
| 1148 | 1148 | |
| 1149 | 1149 | //is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown.  | 
                                                        
@@ -1333,10 +1333,10 @@ discard block  | 
                                                    ||
| 1333 | 1333 | |
| 1334 | 1334 | /**  | 
                                                        
| 1335 | 1335 | * approve_registration  | 
                                                        
| 1336 | - * @access protected  | 
                                                        |
| 1337 | - * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1338 | - * @return void  | 
                                                        |
| 1339 | - */  | 
                                                        |
| 1336 | + * @access protected  | 
                                                        |
| 1337 | + * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1338 | + * @return void  | 
                                                        |
| 1339 | + */  | 
                                                        |
| 1340 | 1340 |  	protected function approve_registration( $notify = false ) { | 
                                                        
| 1341 | 1341 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );  | 
                                                        
| 1342 | 1342 | }  | 
                                                        
@@ -1346,10 +1346,10 @@ discard block  | 
                                                    ||
| 1346 | 1346 | |
| 1347 | 1347 | /**  | 
                                                        
| 1348 | 1348 | * decline_registration  | 
                                                        
| 1349 | - * @access protected  | 
                                                        |
| 1350 | - * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1351 | - * @return void  | 
                                                        |
| 1352 | - */  | 
                                                        |
| 1349 | + * @access protected  | 
                                                        |
| 1350 | + * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1351 | + * @return void  | 
                                                        |
| 1352 | + */  | 
                                                        |
| 1353 | 1353 |  	protected function decline_registration( $notify = false ) { | 
                                                        
| 1354 | 1354 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );  | 
                                                        
| 1355 | 1355 | }  | 
                                                        
@@ -1359,10 +1359,10 @@ discard block  | 
                                                    ||
| 1359 | 1359 | |
| 1360 | 1360 | /**  | 
                                                        
| 1361 | 1361 | * cancel_registration  | 
                                                        
| 1362 | - * @access protected  | 
                                                        |
| 1363 | - * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1364 | - * @return void  | 
                                                        |
| 1365 | - */  | 
                                                        |
| 1362 | + * @access protected  | 
                                                        |
| 1363 | + * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1364 | + * @return void  | 
                                                        |
| 1365 | + */  | 
                                                        |
| 1366 | 1366 |  	protected function cancel_registration( $notify = false ) { | 
                                                        
| 1367 | 1367 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );  | 
                                                        
| 1368 | 1368 | }  | 
                                                        
@@ -1373,10 +1373,10 @@ discard block  | 
                                                    ||
| 1373 | 1373 | |
| 1374 | 1374 | /**  | 
                                                        
| 1375 | 1375 | * not_approve_registration  | 
                                                        
| 1376 | - * @access protected  | 
                                                        |
| 1377 | - * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1378 | - * @return void  | 
                                                        |
| 1379 | - */  | 
                                                        |
| 1376 | + * @access protected  | 
                                                        |
| 1377 | + * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1378 | + * @return void  | 
                                                        |
| 1379 | + */  | 
                                                        |
| 1380 | 1380 |  	protected function not_approve_registration( $notify = false ) { | 
                                                        
| 1381 | 1381 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );  | 
                                                        
| 1382 | 1382 | }  | 
                                                        
@@ -1385,10 +1385,10 @@ discard block  | 
                                                    ||
| 1385 | 1385 | |
| 1386 | 1386 | /**  | 
                                                        
| 1387 | 1387 | * decline_registration  | 
                                                        
| 1388 | - * @access protected  | 
                                                        |
| 1389 | - * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1390 | - * @return void  | 
                                                        |
| 1391 | - */  | 
                                                        |
| 1388 | + * @access protected  | 
                                                        |
| 1389 | + * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        |
| 1390 | + * @return void  | 
                                                        |
| 1391 | + */  | 
                                                        |
| 1392 | 1392 |  	protected function pending_registration( $notify = false ) { | 
                                                        
| 1393 | 1393 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );  | 
                                                        
| 1394 | 1394 | }  | 
                                                        
@@ -1398,9 +1398,9 @@ discard block  | 
                                                    ||
| 1398 | 1398 | |
| 1399 | 1399 | /**  | 
                                                        
| 1400 | 1400 | * generates HTML for the Registration main meta box  | 
                                                        
| 1401 | - * @access public  | 
                                                        |
| 1402 | - * @return void  | 
                                                        |
| 1403 | - */  | 
                                                        |
| 1401 | + * @access public  | 
                                                        |
| 1402 | + * @return void  | 
                                                        |
| 1403 | + */  | 
                                                        |
| 1404 | 1404 |  	public function _reg_details_meta_box() { | 
                                                        
| 1405 | 1405 | EEH_Autoloader::register_line_item_display_autoloaders();  | 
                                                        
| 1406 | 1406 | EEH_Autoloader::register_line_item_filter_autoloaders();  | 
                                                        
@@ -1483,9 +1483,9 @@ discard block  | 
                                                    ||
| 1483 | 1483 | |
| 1484 | 1484 | /**  | 
                                                        
| 1485 | 1485 | * generates HTML for the Registration Questions meta box  | 
                                                        
| 1486 | - * @access public  | 
                                                        |
| 1487 | - * @return void  | 
                                                        |
| 1488 | - */  | 
                                                        |
| 1486 | + * @access public  | 
                                                        |
| 1487 | + * @return void  | 
                                                        |
| 1488 | + */  | 
                                                        |
| 1489 | 1489 |  	public function _reg_questions_meta_box() { | 
                                                        
| 1490 | 1490 | |
| 1491 | 1491 | add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );  | 
                                                        
@@ -1593,9 +1593,9 @@ discard block  | 
                                                    ||
| 1593 | 1593 | |
| 1594 | 1594 | /**  | 
                                                        
| 1595 | 1595 | * generates HTML for the Registration main meta box  | 
                                                        
| 1596 | - * @access protected  | 
                                                        |
| 1597 | - * @return void  | 
                                                        |
| 1598 | - */  | 
                                                        |
| 1596 | + * @access protected  | 
                                                        |
| 1597 | + * @return void  | 
                                                        |
| 1598 | + */  | 
                                                        |
| 1599 | 1599 |  	protected function _update_attendee_registration_form() { | 
                                                        
| 1600 | 1600 | $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;  | 
                                                        
| 1601 | 1601 | $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;  | 
                                                        
@@ -1677,12 +1677,12 @@ discard block  | 
                                                    ||
| 1677 | 1677 | |
| 1678 | 1678 | /**  | 
                                                        
| 1679 | 1679 | * generates HTML for the Registration main meta box  | 
                                                        
| 1680 | - * @access public  | 
                                                        |
| 1681 | - * @return void  | 
                                                        |
| 1682 | - */  | 
                                                        |
| 1680 | + * @access public  | 
                                                        |
| 1681 | + * @return void  | 
                                                        |
| 1682 | + */  | 
                                                        |
| 1683 | 1683 |  	public function _reg_attendees_meta_box() { | 
                                                        
| 1684 | 1684 | |
| 1685 | - $REG = EEM_Registration::instance();  | 
                                                        |
| 1685 | + $REG = EEM_Registration::instance();  | 
                                                        |
| 1686 | 1686 | //get all other registrations on this transaction, and cache  | 
                                                        
| 1687 | 1687 | //the attendees for them so we don't have to run another query using force_join  | 
                                                        
| 1688 | 1688 | $registrations = $REG->get_all(array(  | 
                                                        
@@ -1735,9 +1735,9 @@ discard block  | 
                                                    ||
| 1735 | 1735 | |
| 1736 | 1736 | /**  | 
                                                        
| 1737 | 1737 | * generates HTML for the Edit Registration side meta box  | 
                                                        
| 1738 | - * @access public  | 
                                                        |
| 1739 | - * @return void  | 
                                                        |
| 1740 | - */  | 
                                                        |
| 1738 | + * @access public  | 
                                                        |
| 1739 | + * @return void  | 
                                                        |
| 1740 | + */  | 
                                                        |
| 1741 | 1741 |  	public function _reg_registrant_side_meta_box() { | 
                                                        
| 1742 | 1742 | |
| 1743 | 1743 | /*@var $attendee EE_Attendee */  | 
                                                        
@@ -2083,9 +2083,9 @@ discard block  | 
                                                    ||
| 2083 | 2083 | |
| 2084 | 2084 | /**  | 
                                                        
| 2085 | 2085 | * set_reg_event  | 
                                                        
| 2086 | - * @access private  | 
                                                        |
| 2087 | - * @return boolean  | 
                                                        |
| 2088 | - */  | 
                                                        |
| 2086 | + * @access private  | 
                                                        |
| 2087 | + * @return boolean  | 
                                                        |
| 2088 | + */  | 
                                                        |
| 2089 | 2089 |  	private function _set_reg_event() { | 
                                                        
| 2090 | 2090 |  		if ( is_object( $this->_reg_event )) { | 
                                                        
| 2091 | 2091 | return TRUE;  | 
                                                        
@@ -2189,9 +2189,9 @@ discard block  | 
                                                    ||
| 2189 | 2189 | |
| 2190 | 2190 | /**  | 
                                                        
| 2191 | 2191 | * generates HTML for the Attendee Contact List  | 
                                                        
| 2192 | - * @access protected  | 
                                                        |
| 2193 | - * @return void  | 
                                                        |
| 2194 | - */  | 
                                                        |
| 2192 | + * @access protected  | 
                                                        |
| 2193 | + * @return void  | 
                                                        |
| 2194 | + */  | 
                                                        |
| 2195 | 2195 |  	protected function _attendee_contact_list_table() { | 
                                                        
| 2196 | 2196 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        
| 2197 | 2197 |  		$this->_search_btn_label = __('Contacts', 'event_espresso'); | 
                                                        
@@ -2205,9 +2205,9 @@ discard block  | 
                                                    ||
| 2205 | 2205 | /**  | 
                                                        
| 2206 | 2206 | * get_attendees  | 
                                                        
| 2207 | 2207 | * @param bool $count whether to return count or data.  | 
                                                        
| 2208 | - * @access public  | 
                                                        |
| 2209 | - * @return array  | 
                                                        |
| 2210 | - */  | 
                                                        |
| 2208 | + * @access public  | 
                                                        |
| 2209 | + * @return array  | 
                                                        |
| 2210 | + */  | 
                                                        |
| 2211 | 2211 |  	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { | 
                                                        
| 2212 | 2212 | |
| 2213 | 2213 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        
@@ -2525,9 +2525,9 @@ discard block  | 
                                                    ||
| 2525 | 2525 | |
| 2526 | 2526 | /**  | 
                                                        
| 2527 | 2527 | * _attendee_details  | 
                                                        
| 2528 | - * @access protected  | 
                                                        |
| 2529 | - * @return void  | 
                                                        |
| 2530 | - */  | 
                                                        |
| 2528 | + * @access protected  | 
                                                        |
| 2529 | + * @return void  | 
                                                        |
| 2530 | + */  | 
                                                        |
| 2531 | 2531 |  	public function attendee_registrations_meta_box( $post ) { | 
                                                        
| 2532 | 2532 | |
| 2533 | 2533 | $this->_template_args['attendee'] = $this->_cpt_model_obj;  | 
                                                        
@@ -2560,10 +2560,10 @@ discard block  | 
                                                    ||
| 2560 | 2560 | |
| 2561 | 2561 | /**  | 
                                                        
| 2562 | 2562 | * _trash_or_restore_attendee  | 
                                                        
| 2563 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)  | 
                                                        |
| 2564 | - * @access protected  | 
                                                        |
| 2565 | - * @return void  | 
                                                        |
| 2566 | - */  | 
                                                        |
| 2563 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)  | 
                                                        |
| 2564 | + * @access protected  | 
                                                        |
| 2565 | + * @return void  | 
                                                        |
| 2566 | + */  | 
                                                        |
| 2567 | 2567 |  	protected function _trash_or_restore_attendees( $trash = TRUE ) { | 
                                                        
| 2568 | 2568 | |
| 2569 | 2569 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        
@@ -42,8 +42,8 @@ discard block  | 
                                                    ||
| 42 | 42 | * @param bool $routing  | 
                                                        
| 43 | 43 | * @return Registrations_Admin_Page  | 
                                                        
| 44 | 44 | */  | 
                                                        
| 45 | -	public function __construct( $routing = TRUE ) { | 
                                                        |
| 46 | - parent::__construct( $routing );  | 
                                                        |
| 45 | +	public function __construct($routing = TRUE) { | 
                                                        |
| 46 | + parent::__construct($routing);  | 
                                                        |
| 47 | 47 | }  | 
                                                        
| 48 | 48 | |
| 49 | 49 | |
@@ -75,16 +75,16 @@ discard block  | 
                                                    ||
| 75 | 75 | 'trash' => 'post.php'  | 
                                                        
| 76 | 76 | );  | 
                                                        
| 77 | 77 | |
| 78 | -		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); | 
                                                        |
| 78 | +		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); | 
                                                        |
| 79 | 79 | //add filters so that the comment urls don't take users to a confusing 404 page  | 
                                                        
| 80 | -		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); | 
                                                        |
| 80 | +		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); | 
                                                        |
| 81 | 81 | }  | 
                                                        
| 82 | 82 | |
| 83 | 83 | |
| 84 | -	public function clear_comment_link( $link, $comment, $args ) { | 
                                                        |
| 84 | +	public function clear_comment_link($link, $comment, $args) { | 
                                                        |
| 85 | 85 | //gotta make sure this only happens on this route  | 
                                                        
| 86 | - $post_type = get_post_type( $comment->comment_post_ID);  | 
                                                        |
| 87 | - if ( $post_type == 'espresso_attendees' )  | 
                                                        |
| 86 | + $post_type = get_post_type($comment->comment_post_ID);  | 
                                                        |
| 87 | + if ($post_type == 'espresso_attendees')  | 
                                                        |
| 88 | 88 | return '#commentsdiv';  | 
                                                        
| 89 | 89 | return $link;  | 
                                                        
| 90 | 90 | }  | 
                                                        
@@ -92,7 +92,7 @@ discard block  | 
                                                    ||
| 92 | 92 | |
| 93 | 93 |  	protected function _ajax_hooks() { | 
                                                        
| 94 | 94 | //todo: all hooks for registrations ajax goes in here  | 
                                                        
| 95 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));  | 
                                                        |
| 95 | +		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); | 
                                                        |
| 96 | 96 | }  | 
                                                        
| 97 | 97 | |
| 98 | 98 | |
@@ -107,8 +107,8 @@ discard block  | 
                                                    ||
| 107 | 107 |  					'add-attendee' => __('Add Contact', 'event_espresso'), | 
                                                        
| 108 | 108 |  					'edit' => __('Edit Contact', 'event_espresso'), | 
                                                        
| 109 | 109 |  					'report'=>  __("Event Registrations CSV Report", "event_espresso"), | 
                                                        
| 110 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),  | 
                                                        |
| 111 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),  | 
                                                        |
| 110 | +					'report_all' => __('All Registrations CSV Report', 'event_espresso'), | 
                                                        |
| 111 | +					'contact_list_report' => __('Contact List Report', 'event_espresso'), | 
                                                        |
| 112 | 112 |  					'contact_list_export'=>  __("Export Data", "event_espresso"), | 
                                                        
| 113 | 113 | ),  | 
                                                        
| 114 | 114 | 'publishbox' => array(  | 
                                                        
@@ -136,9 +136,9 @@ discard block  | 
                                                    ||
| 136 | 136 | |
| 137 | 137 | $this->_get_registration_status_array();  | 
                                                        
| 138 | 138 | |
| 139 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;  | 
                                                        |
| 140 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;  | 
                                                        |
| 141 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;  | 
                                                        |
| 139 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;  | 
                                                        |
| 140 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;  | 
                                                        |
| 141 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;  | 
                                                        |
| 142 | 142 | |
| 143 | 143 | $this->_page_routes = array(  | 
                                                        
| 144 | 144 | |
@@ -155,7 +155,7 @@ discard block  | 
                                                    ||
| 155 | 155 | |
| 156 | 156 | 'edit_registration' => array(  | 
                                                        
| 157 | 157 | 'func' => '_registration_details',  | 
                                                        
| 158 | - 'args' => array( 'edit' ),  | 
                                                        |
| 158 | +						'args' => array('edit'), | 
                                                        |
| 159 | 159 | 'noheader' => TRUE,  | 
                                                        
| 160 | 160 | 'capability' => 'ee_edit_registration',  | 
                                                        
| 161 | 161 | 'obj_id' => $reg_id  | 
                                                        
@@ -170,7 +170,7 @@ discard block  | 
                                                    ||
| 170 | 170 | |
| 171 | 171 | 'restore_registrations' => array(  | 
                                                        
| 172 | 172 | 'func' => '_trash_or_restore_registrations',  | 
                                                        
| 173 | - 'args' => array( 'trash' => FALSE ),  | 
                                                        |
| 173 | +					'args' => array('trash' => FALSE), | 
                                                        |
| 174 | 174 | 'noheader' => TRUE,  | 
                                                        
| 175 | 175 | 'capability' => 'ee_delete_registrations'  | 
                                                        
| 176 | 176 | ),  | 
                                                        
@@ -404,7 +404,7 @@ discard block  | 
                                                    ||
| 404 | 404 | 'filename' => 'registrations_overview_other'  | 
                                                        
| 405 | 405 | )  | 
                                                        
| 406 | 406 | ),  | 
                                                        
| 407 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ),  | 
                                                        |
| 407 | +				'help_tour' => array('Registration_Overview_Help_Tour'), | 
                                                        |
| 408 | 408 |  				'qtips' => array('Registration_List_Table_Tips'), | 
                                                        
| 409 | 409 | 'list_table' => 'EE_Registrations_List_Table',  | 
                                                        
| 410 | 410 | 'require_nonce' => FALSE  | 
                                                        
@@ -414,7 +414,7 @@ discard block  | 
                                                    ||
| 414 | 414 | 'nav' => array(  | 
                                                        
| 415 | 415 |  					'label' => __('REG Details', 'event_espresso'), | 
                                                        
| 416 | 416 | 'order' => 15,  | 
                                                        
| 417 | -					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url, | 
                                                        |
| 417 | +					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, | 
                                                        |
| 418 | 418 | 'persistent' => FALSE  | 
                                                        
| 419 | 419 | ),  | 
                                                        
| 420 | 420 | 'help_tabs' => array(  | 
                                                        
@@ -435,8 +435,8 @@ discard block  | 
                                                    ||
| 435 | 435 | 'filename' => 'registrations_details_registrant_details'  | 
                                                        
| 436 | 436 | )  | 
                                                        
| 437 | 437 | ),  | 
                                                        
| 438 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ),  | 
                                                        |
| 439 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),  | 
                                                        |
| 438 | +				'help_tour' => array('Registration_Details_Help_Tour'), | 
                                                        |
| 439 | +				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), | 
                                                        |
| 440 | 440 | 'require_nonce' => FALSE  | 
                                                        
| 441 | 441 | ),  | 
                                                        
| 442 | 442 | |
@@ -460,7 +460,7 @@ discard block  | 
                                                    ||
| 460 | 460 | 'order' => 15,  | 
                                                        
| 461 | 461 | 'persistent' => FALSE  | 
                                                        
| 462 | 462 | ),  | 
                                                        
| 463 | -				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), | 
                                                        |
| 463 | +				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), | 
                                                        |
| 464 | 464 | 'require_nonce' => FALSE  | 
                                                        
| 465 | 465 | ),  | 
                                                        
| 466 | 466 | |
@@ -469,7 +469,7 @@ discard block  | 
                                                    ||
| 469 | 469 |  					'label' => __('Edit Contact', 'event_espresso'), | 
                                                        
| 470 | 470 | 'order' => 15,  | 
                                                        
| 471 | 471 | 'persistent' => FALSE,  | 
                                                        
| 472 | -					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url | 
                                                        |
| 472 | +					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url | 
                                                        |
| 473 | 473 | ),  | 
                                                        
| 474 | 474 |  				'metaboxes' => array('attendee_editor_metaboxes'), | 
                                                        
| 475 | 475 | 'require_nonce' => FALSE  | 
                                                        
@@ -499,7 +499,7 @@ discard block  | 
                                                    ||
| 499 | 499 | 'filename' => 'registrations_contact_list_other'  | 
                                                        
| 500 | 500 | )  | 
                                                        
| 501 | 501 | ),  | 
                                                        
| 502 | - 'help_tour' => array( 'Contact_List_Help_Tour' ),  | 
                                                        |
| 502 | +				'help_tour' => array('Contact_List_Help_Tour'), | 
                                                        |
| 503 | 503 | 'metaboxes' => array(),  | 
                                                        
| 504 | 504 | 'require_nonce' => FALSE  | 
                                                        
| 505 | 505 | ),  | 
                                                        
@@ -518,7 +518,7 @@ discard block  | 
                                                    ||
| 518 | 518 |  	protected function _add_screen_options() {} | 
                                                        
| 519 | 519 |  	protected function _add_feature_pointers() {} | 
                                                        
| 520 | 520 |  	public function admin_init() { | 
                                                        
| 521 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );  | 
                                                        |
| 521 | +		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); | 
                                                        |
| 522 | 522 | }  | 
                                                        
| 523 | 523 |  	public function admin_notices() {} | 
                                                        
| 524 | 524 |  	public function admin_footer_scripts() {} | 
                                                        
@@ -536,7 +536,7 @@ discard block  | 
                                                    ||
| 536 | 536 | * @return void  | 
                                                        
| 537 | 537 | */  | 
                                                        
| 538 | 538 |  	private function _get_registration_status_array() { | 
                                                        
| 539 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);  | 
                                                        |
| 539 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);  | 
                                                        |
| 540 | 540 | }  | 
                                                        
| 541 | 541 | |
| 542 | 542 | |
@@ -559,11 +559,11 @@ discard block  | 
                                                    ||
| 559 | 559 |  	public function load_scripts_styles() { | 
                                                        
| 560 | 560 | //style  | 
                                                        
| 561 | 561 |  		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); | 
                                                        
| 562 | -		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); | 
                                                        |
| 562 | +		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 563 | 563 |  		wp_enqueue_style('espresso_reg'); | 
                                                        
| 564 | 564 | |
| 565 | 565 | //script  | 
                                                        
| 566 | -		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 566 | +		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 567 | 567 |  		wp_enqueue_script('espresso_reg'); | 
                                                        
| 568 | 568 | }  | 
                                                        
| 569 | 569 | |
@@ -572,9 +572,9 @@ discard block  | 
                                                    ||
| 572 | 572 |  	public function load_scripts_styles_edit_attendee() { | 
                                                        
| 573 | 573 | //stuff to only show up on our attendee edit details page.  | 
                                                        
| 574 | 574 | $attendee_details_translations = array(  | 
                                                        
| 575 | -			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) | 
                                                        |
| 575 | +			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) | 
                                                        |
| 576 | 576 | );  | 
                                                        
| 577 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );  | 
                                                        |
| 577 | +		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); | 
                                                        |
| 578 | 578 |  		wp_enqueue_script('jquery-validate'); | 
                                                        
| 579 | 579 | }  | 
                                                        
| 580 | 580 | |
@@ -592,7 +592,7 @@ discard block  | 
                                                    ||
| 592 | 592 | |
| 593 | 593 |  	public function load_scripts_styles_contact_list() { | 
                                                        
| 594 | 594 |  		wp_deregister_style('espresso_reg'); | 
                                                        
| 595 | -		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); | 
                                                        |
| 595 | +		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 596 | 596 |  		wp_enqueue_style('espresso_att'); | 
                                                        
| 597 | 597 | }  | 
                                                        
| 598 | 598 | |
@@ -601,9 +601,9 @@ discard block  | 
                                                    ||
| 601 | 601 | |
| 602 | 602 | |
| 603 | 603 |  	public function load_scripts_styles_new_registration() { | 
                                                        
| 604 | -		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); | 
                                                        |
| 604 | +		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 605 | 605 |  		wp_enqueue_script('ee-spco-for-admin'); | 
                                                        
| 606 | -		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); | 
                                                        |
| 606 | +		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); | 
                                                        |
| 607 | 607 | EE_Form_Section_Proper::wp_enqueue_scripts();  | 
                                                        
| 608 | 608 | EED_Ticket_Selector::load_tckt_slctr_assets();  | 
                                                        
| 609 | 609 | EE_Datepicker_Input::enqueue_styles_and_scripts();  | 
                                                        
@@ -642,23 +642,23 @@ discard block  | 
                                                    ||
| 642 | 642 | |
| 643 | 643 | /** setup reg status bulk actions **/  | 
                                                        
| 644 | 644 |  		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); | 
                                                        
| 645 | -		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { | 
                                                        |
| 645 | +		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { | 
                                                        |
| 646 | 646 |  			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); | 
                                                        
| 647 | 647 | }  | 
                                                        
| 648 | 648 |  		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); | 
                                                        
| 649 | -		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { | 
                                                        |
| 649 | +		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { | 
                                                        |
| 650 | 650 |  			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); | 
                                                        
| 651 | 651 | }  | 
                                                        
| 652 | 652 |  		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); | 
                                                        
| 653 | -		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { | 
                                                        |
| 653 | +		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { | 
                                                        |
| 654 | 654 |  			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); | 
                                                        
| 655 | 655 | }  | 
                                                        
| 656 | 656 |  		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); | 
                                                        
| 657 | -		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { | 
                                                        |
| 657 | +		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { | 
                                                        |
| 658 | 658 |  			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); | 
                                                        
| 659 | 659 | }  | 
                                                        
| 660 | 660 |  		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); | 
                                                        
| 661 | -		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { | 
                                                        |
| 661 | +		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { | 
                                                        |
| 662 | 662 |  			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); | 
                                                        
| 663 | 663 | }  | 
                                                        
| 664 | 664 | |
@@ -667,29 +667,29 @@ discard block  | 
                                                    ||
| 667 | 667 | 'slug' => 'all',  | 
                                                        
| 668 | 668 |  				'label' => __('View All Registrations', 'event_espresso'), | 
                                                        
| 669 | 669 | 'count' => 0,  | 
                                                        
| 670 | - 'bulk_action' => array_merge( $def_reg_status_actions, array(  | 
                                                        |
| 670 | + 'bulk_action' => array_merge($def_reg_status_actions, array(  | 
                                                        |
| 671 | 671 |  					'trash_registrations' => __('Trash Registrations', 'event_espresso') | 
                                                        
| 672 | - ) )  | 
                                                        |
| 672 | + ))  | 
                                                        |
| 673 | 673 | ),  | 
                                                        
| 674 | 674 | 'month' => array(  | 
                                                        
| 675 | 675 | 'slug' => 'month',  | 
                                                        
| 676 | 676 |  				'label' => __('This Month', 'event_espresso'), | 
                                                        
| 677 | 677 | 'count' => 0,  | 
                                                        
| 678 | - 'bulk_action' => array_merge( $def_reg_status_actions, array(  | 
                                                        |
| 678 | + 'bulk_action' => array_merge($def_reg_status_actions, array(  | 
                                                        |
| 679 | 679 |  					'trash_registrations' => __('Trash Registrations', 'event_espresso') | 
                                                        
| 680 | 680 | ))  | 
                                                        
| 681 | 681 | ),  | 
                                                        
| 682 | 682 | 'today' => array(  | 
                                                        
| 683 | 683 | 'slug' => 'today',  | 
                                                        
| 684 | -				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), | 
                                                        |
| 684 | +				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), | 
                                                        |
| 685 | 685 | 'count' => 0,  | 
                                                        
| 686 | - 'bulk_action' => array_merge( $def_reg_status_actions, array(  | 
                                                        |
| 686 | + 'bulk_action' => array_merge($def_reg_status_actions, array(  | 
                                                        |
| 687 | 687 |  					'trash_registrations' => __('Trash Registrations', 'event_espresso') | 
                                                        
| 688 | 688 | ))  | 
                                                        
| 689 | 689 | )  | 
                                                        
| 690 | 690 | );  | 
                                                        
| 691 | 691 | |
| 692 | -		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { | 
                                                        |
| 692 | +		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { | 
                                                        |
| 693 | 693 | $this->_views['incomplete'] = array(  | 
                                                        
| 694 | 694 | 'slug' => 'incomplete',  | 
                                                        
| 695 | 695 |  				'label' => __('Incomplete', 'event_espresso'), | 
                                                        
@@ -725,7 +725,7 @@ discard block  | 
                                                    ||
| 725 | 725 | )  | 
                                                        
| 726 | 726 | );  | 
                                                        
| 727 | 727 | |
| 728 | -		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { | 
                                                        |
| 728 | +		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { | 
                                                        |
| 729 | 729 | $this->_views['trash'] = array(  | 
                                                        
| 730 | 730 | 'slug' => 'trash',  | 
                                                        
| 731 | 731 |  				'label' => __('Trash', 'event_espresso'), | 
                                                        
@@ -764,42 +764,42 @@ discard block  | 
                                                    ||
| 764 | 764 |  				'desc' => __('View Transaction Invoice', 'event_espresso') | 
                                                        
| 765 | 765 | ),  | 
                                                        
| 766 | 766 | );  | 
                                                        
| 767 | -		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { | 
                                                        |
| 767 | +		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { | 
                                                        |
| 768 | 768 | $fc_items['resend_registration'] = array(  | 
                                                        
| 769 | 769 | 'class' => 'dashicons dashicons-email-alt',  | 
                                                        
| 770 | 770 |  				'desc' => __('Resend Registration Details', 'event_espresso') | 
                                                        
| 771 | 771 | );  | 
                                                        
| 772 | 772 |  		} else { | 
                                                        
| 773 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );  | 
                                                        |
| 773 | +			$fc_items['blank'] = array('class' => 'blank', 'desc' => ''); | 
                                                        |
| 774 | 774 | }  | 
                                                        
| 775 | 775 | |
| 776 | 776 | $sc_items = array(  | 
                                                        
| 777 | 777 | 'approved_status' => array(  | 
                                                        
| 778 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,  | 
                                                        |
| 779 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )  | 
                                                        |
| 778 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,  | 
                                                        |
| 779 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')  | 
                                                        |
| 780 | 780 | ),  | 
                                                        
| 781 | 781 | 'pending_status' => array(  | 
                                                        
| 782 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,  | 
                                                        |
| 783 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )  | 
                                                        |
| 782 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,  | 
                                                        |
| 783 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')  | 
                                                        |
| 784 | 784 | ),  | 
                                                        
| 785 | 785 | 'incomplete_status' => array(  | 
                                                        
| 786 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,  | 
                                                        |
| 787 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )  | 
                                                        |
| 786 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,  | 
                                                        |
| 787 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')  | 
                                                        |
| 788 | 788 | ),  | 
                                                        
| 789 | 789 | 'not_approved' => array(  | 
                                                        
| 790 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,  | 
                                                        |
| 791 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )  | 
                                                        |
| 790 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,  | 
                                                        |
| 791 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')  | 
                                                        |
| 792 | 792 | ),  | 
                                                        
| 793 | 793 | 'declined_status' => array(  | 
                                                        
| 794 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,  | 
                                                        |
| 795 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )  | 
                                                        |
| 794 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,  | 
                                                        |
| 795 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')  | 
                                                        |
| 796 | 796 | ),  | 
                                                        
| 797 | 797 | 'cancelled_status' => array(  | 
                                                        
| 798 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,  | 
                                                        |
| 799 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )  | 
                                                        |
| 798 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,  | 
                                                        |
| 799 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')  | 
                                                        |
| 800 | 800 | )  | 
                                                        
| 801 | 801 | );  | 
                                                        
| 802 | - return array_merge( $fc_items, $sc_items );  | 
                                                        |
| 802 | + return array_merge($fc_items, $sc_items);  | 
                                                        |
| 803 | 803 | }  | 
                                                        
| 804 | 804 | |
| 805 | 805 | |
@@ -812,15 +812,15 @@ discard block  | 
                                                    ||
| 812 | 812 | |
| 813 | 813 | |
| 814 | 814 |  	protected function _registrations_overview_list_table() { | 
                                                        
| 815 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 816 | -		if ( $EVT_ID ) { | 
                                                        |
| 817 | -			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { | 
                                                        |
| 818 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );  | 
                                                        |
| 815 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 816 | +		if ($EVT_ID) { | 
                                                        |
| 817 | +			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { | 
                                                        |
| 818 | +				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); | 
                                                        |
| 819 | 819 | }  | 
                                                        
| 820 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );  | 
                                                        |
| 821 | -			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; | 
                                                        |
| 820 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID);  | 
                                                        |
| 821 | +			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; | 
                                                        |
| 822 | 822 | }  | 
                                                        
| 823 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );  | 
                                                        |
| 823 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());  | 
                                                        |
| 824 | 824 | $this->display_admin_list_table_page_with_no_sidebar();  | 
                                                        
| 825 | 825 | }  | 
                                                        
| 826 | 826 | |
@@ -835,19 +835,19 @@ discard block  | 
                                                    ||
| 835 | 835 | */  | 
                                                        
| 836 | 836 |  	private function _set_registration_object() { | 
                                                        
| 837 | 837 | //get out if we've already set the object  | 
                                                        
| 838 | -		if ( is_object( $this->_registration )) { | 
                                                        |
| 838 | +		if (is_object($this->_registration)) { | 
                                                        |
| 839 | 839 | return TRUE;  | 
                                                        
| 840 | 840 | }  | 
                                                        
| 841 | 841 | |
| 842 | 842 | $REG = EEM_Registration::instance();  | 
                                                        
| 843 | 843 | |
| 844 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;  | 
                                                        |
| 844 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;  | 
                                                        |
| 845 | 845 | |
| 846 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))  | 
                                                        |
| 846 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID))  | 
                                                        |
| 847 | 847 | return TRUE;  | 
                                                        
| 848 | 848 |  		else { | 
                                                        
| 849 | -			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); | 
                                                        |
| 850 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 849 | +			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); | 
                                                        |
| 850 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 851 | 851 | $this->_registration = NULL;  | 
                                                        
| 852 | 852 | return FALSE;  | 
                                                        
| 853 | 853 | }  | 
                                                        
@@ -866,25 +866,25 @@ discard block  | 
                                                    ||
| 866 | 866 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set)  | 
                                                        
| 867 | 867 | * @return mixed (int|array) int = count || array of registration objects  | 
                                                        
| 868 | 868 | */  | 
                                                        
| 869 | -	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { | 
                                                        |
| 870 | -  | 
                                                        |
| 871 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 872 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;  | 
                                                        |
| 873 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;  | 
                                                        |
| 874 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april  | 
                                                        |
| 875 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;  | 
                                                        |
| 876 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE;  | 
                                                        |
| 869 | +	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { | 
                                                        |
| 870 | +  | 
                                                        |
| 871 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 872 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;  | 
                                                        |
| 873 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;  | 
                                                        |
| 874 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april  | 
                                                        |
| 875 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;  | 
                                                        |
| 876 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE;  | 
                                                        |
| 877 | 877 | $start_date = FALSE;  | 
                                                        
| 878 | 878 | $end_date = FALSE;  | 
                                                        
| 879 | 879 | $_where = array();  | 
                                                        
| 880 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;  | 
                                                        |
| 881 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;  | 
                                                        |
| 880 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;  | 
                                                        |
| 881 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;  | 
                                                        |
| 882 | 882 | |
| 883 | 883 | //set orderby  | 
                                                        
| 884 | 884 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';  | 
                                                        
| 885 | 885 | |
| 886 | 886 | |
| 887 | -		switch ( $this->_req_data['orderby'] ) { | 
                                                        |
| 887 | +		switch ($this->_req_data['orderby']) { | 
                                                        |
| 888 | 888 | case '_REG_ID':  | 
                                                        
| 889 | 889 | $orderby = 'REG_ID';  | 
                                                        
| 890 | 890 | break;  | 
                                                        
@@ -904,26 +904,26 @@ discard block  | 
                                                    ||
| 904 | 904 | $orderby = 'REG_date';  | 
                                                        
| 905 | 905 | }  | 
                                                        
| 906 | 906 | |
| 907 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';  | 
                                                        |
| 908 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 909 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;  | 
                                                        |
| 907 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';  | 
                                                        |
| 908 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 909 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;  | 
                                                        |
| 910 | 910 | |
| 911 | 911 | |
| 912 | - $offset = ($current_page-1)*$per_page;  | 
                                                        |
| 913 | - $limit = $count ? NULL : array( $offset, $per_page );  | 
                                                        |
| 912 | + $offset = ($current_page - 1) * $per_page;  | 
                                                        |
| 913 | + $limit = $count ? NULL : array($offset, $per_page);  | 
                                                        |
| 914 | 914 | |
| 915 | -		if($EVT_ID){ | 
                                                        |
| 916 | - $_where['EVT_ID']=$EVT_ID;  | 
                                                        |
| 915 | +		if ($EVT_ID) { | 
                                                        |
| 916 | + $_where['EVT_ID'] = $EVT_ID;  | 
                                                        |
| 917 | 917 | }  | 
                                                        
| 918 | -		if($CAT_ID){ | 
                                                        |
| 918 | +		if ($CAT_ID) { | 
                                                        |
| 919 | 919 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;  | 
                                                        
| 920 | 920 | }  | 
                                                        
| 921 | -		if ( $incomplete ) { | 
                                                        |
| 921 | +		if ($incomplete) { | 
                                                        |
| 922 | 922 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete;  | 
                                                        
| 923 | 923 |  		} else if ( ! $trash) { | 
                                                        
| 924 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );  | 
                                                        |
| 924 | +			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); | 
                                                        |
| 925 | 925 | }  | 
                                                        
| 926 | -		if($reg_status){ | 
                                                        |
| 926 | +		if ($reg_status) { | 
                                                        |
| 927 | 927 | $_where['STS_ID'] = $reg_status;  | 
                                                        
| 928 | 928 | }  | 
                                                        
| 929 | 929 | |
@@ -935,105 +935,105 @@ discard block  | 
                                                    ||
| 935 | 935 | $time_start = ' 00:00:00';  | 
                                                        
| 936 | 936 | $time_end = ' 23:59:59';  | 
                                                        
| 937 | 937 | |
| 938 | -		if($today_a || $today ){ | 
                                                        |
| 938 | +		if ($today_a || $today) { | 
                                                        |
| 939 | 939 |  			$curdate = date('Y-m-d', current_time('timestamp')); | 
                                                        
| 940 | -			$_where['REG_date']= array('BETWEEN', | 
                                                        |
| 940 | +			$_where['REG_date'] = array('BETWEEN', | 
                                                        |
| 941 | 941 | array(  | 
                                                        
| 942 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),  | 
                                                        |
| 943 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),  | 
                                                        |
| 942 | +					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), | 
                                                        |
| 943 | +					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), | 
                                                        |
| 944 | 944 | ));  | 
                                                        
| 945 | -		}elseif($this_month_a || $this_month){ | 
                                                        |
| 945 | +		}elseif ($this_month_a || $this_month) { | 
                                                        |
| 946 | 946 |  			$this_month_r = date('m', current_time('timestamp')); | 
                                                        
| 947 | -			$days_this_month = date( 't', current_time('timestamp') ); | 
                                                        |
| 948 | -			$_where['REG_date']= array('BETWEEN', | 
                                                        |
| 947 | +			$days_this_month = date('t', current_time('timestamp')); | 
                                                        |
| 948 | +			$_where['REG_date'] = array('BETWEEN', | 
                                                        |
| 949 | 949 | array(  | 
                                                        
| 950 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),  | 
                                                        |
| 951 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )  | 
                                                        |
| 950 | +					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), | 
                                                        |
| 951 | +					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') | 
                                                        |
| 952 | 952 | ));  | 
                                                        
| 953 | -		}elseif($month_range){ | 
                                                        |
| 953 | +		}elseif ($month_range) { | 
                                                        |
| 954 | 954 |  			$pieces = explode(' ', $this->_req_data['month_range'], 3); | 
                                                        
| 955 | -			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; | 
                                                        |
| 956 | - $year_r = !empty($pieces[1]) ? $pieces[1] : '';  | 
                                                        |
| 957 | -			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') ); | 
                                                        |
| 958 | -			$_where['REG_date']= array('BETWEEN', | 
                                                        |
| 959 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) );  | 
                                                        |
| 960 | -		}elseif($start_date && $end_date){ | 
                                                        |
| 955 | +			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; | 
                                                        |
| 956 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : '';  | 
                                                        |
| 957 | +			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); | 
                                                        |
| 958 | +			$_where['REG_date'] = array('BETWEEN', | 
                                                        |
| 959 | +				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); | 
                                                        |
| 960 | +		}elseif ($start_date && $end_date) { | 
                                                        |
| 961 | 961 |  			throw new EE_Error("not yet supported"); | 
                                                        
| 962 | -		}elseif($start_date){ | 
                                                        |
| 962 | +		}elseif ($start_date) { | 
                                                        |
| 963 | 963 |  			throw new EE_Error("not yet supported"); | 
                                                        
| 964 | -		}elseif($end_date){ | 
                                                        |
| 964 | +		}elseif ($end_date) { | 
                                                        |
| 965 | 965 |  			throw new EE_Error("not yet supported"); | 
                                                        
| 966 | 966 | }  | 
                                                        
| 967 | 967 | |
| 968 | -		if ( ! empty( $this->_req_data['s'] ) ) { | 
                                                        |
| 969 | - $sstr = '%' . $this->_req_data['s'] . '%';  | 
                                                        |
| 968 | +		if ( ! empty($this->_req_data['s'])) { | 
                                                        |
| 969 | + $sstr = '%'.$this->_req_data['s'].'%';  | 
                                                        |
| 970 | 970 | $_where['OR'] = array(  | 
                                                        
| 971 | - 'Event.EVT_name' => array( 'LIKE', $sstr),  | 
                                                        |
| 972 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ),  | 
                                                        |
| 973 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 974 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),  | 
                                                        |
| 975 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ),  | 
                                                        |
| 976 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ),  | 
                                                        |
| 977 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),  | 
                                                        |
| 978 | -				'Attendee.ATT_email' => array('LIKE', $sstr ), | 
                                                        |
| 979 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ),  | 
                                                        |
| 980 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ),  | 
                                                        |
| 981 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ),  | 
                                                        |
| 982 | - 'REG_final_price' => array( 'LIKE', $sstr ),  | 
                                                        |
| 983 | - 'REG_code' => array( 'LIKE', $sstr ),  | 
                                                        |
| 984 | - 'REG_count' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 985 | - 'REG_group_size' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 986 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ),  | 
                                                        |
| 987 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ),  | 
                                                        |
| 988 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )  | 
                                                        |
| 971 | +				'Event.EVT_name' => array('LIKE', $sstr), | 
                                                        |
| 972 | +				'Event.EVT_desc' => array('LIKE', $sstr), | 
                                                        |
| 973 | +				'Event.EVT_short_desc' => array('LIKE', $sstr), | 
                                                        |
| 974 | +				'Attendee.ATT_full_name' => array('LIKE', $sstr), | 
                                                        |
| 975 | +				'Attendee.ATT_fname' => array('LIKE', $sstr), | 
                                                        |
| 976 | +				'Attendee.ATT_lname' => array('LIKE', $sstr), | 
                                                        |
| 977 | +				'Attendee.ATT_short_bio' => array('LIKE', $sstr), | 
                                                        |
| 978 | +				'Attendee.ATT_email' => array('LIKE', $sstr), | 
                                                        |
| 979 | +				'Attendee.ATT_address' => array('LIKE', $sstr), | 
                                                        |
| 980 | +				'Attendee.ATT_address2' => array('LIKE', $sstr), | 
                                                        |
| 981 | +				'Attendee.ATT_city' => array('LIKE', $sstr), | 
                                                        |
| 982 | +				'REG_final_price' => array('LIKE', $sstr), | 
                                                        |
| 983 | +				'REG_code' => array('LIKE', $sstr), | 
                                                        |
| 984 | +				'REG_count' => array('LIKE', $sstr), | 
                                                        |
| 985 | +				'REG_group_size' => array('LIKE', $sstr), | 
                                                        |
| 986 | +				'Ticket.TKT_name' => array('LIKE', $sstr), | 
                                                        |
| 987 | +				'Ticket.TKT_description' => array('LIKE', $sstr), | 
                                                        |
| 988 | +				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) | 
                                                        |
| 989 | 989 | );  | 
                                                        
| 990 | 990 | }  | 
                                                        
| 991 | 991 | |
| 992 | 992 | //capability checks  | 
                                                        
| 993 | -		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { | 
                                                        |
| 993 | +		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { | 
                                                        |
| 994 | 994 | $_where['AND'] = array(  | 
                                                        
| 995 | 995 | 'Event.EVT_wp_user' => get_current_user_id()  | 
                                                        
| 996 | 996 | );  | 
                                                        
| 997 | 997 | }  | 
                                                        
| 998 | 998 | |
| 999 | 999 | |
| 1000 | -		if( $count ){ | 
                                                        |
| 1001 | -			if ( $trash ) { | 
                                                        |
| 1002 | - return EEM_Registration::instance()->count_deleted( array( $_where ));  | 
                                                        |
| 1003 | -			} else if ( $incomplete ) { | 
                                                        |
| 1004 | - return EEM_Registration::instance()->count( array( $_where ));  | 
                                                        |
| 1000 | +		if ($count) { | 
                                                        |
| 1001 | +			if ($trash) { | 
                                                        |
| 1002 | + return EEM_Registration::instance()->count_deleted(array($_where));  | 
                                                        |
| 1003 | +			} else if ($incomplete) { | 
                                                        |
| 1004 | + return EEM_Registration::instance()->count(array($_where));  | 
                                                        |
| 1005 | 1005 |  			} else { | 
                                                        
| 1006 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));  | 
                                                        |
| 1006 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));  | 
                                                        |
| 1007 | 1007 | }  | 
                                                        
| 1008 | 1008 |  		} else { | 
                                                        
| 1009 | 1009 | //make sure we remove default where conditions cause all registrations matching query are returned  | 
                                                        
| 1010 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );  | 
                                                        |
| 1011 | -			if ( $per_page !== -1 ) { | 
                                                        |
| 1010 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');  | 
                                                        |
| 1011 | +			if ($per_page !== -1) { | 
                                                        |
| 1012 | 1012 | $query_params['limit'] = $limit;  | 
                                                        
| 1013 | 1013 | }  | 
                                                        
| 1014 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);  | 
                                                        |
| 1014 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);  | 
                                                        |
| 1015 | 1015 | |
| 1016 | 1016 | |
| 1017 | -			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) { | 
                                                        |
| 1017 | +			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { | 
                                                        |
| 1018 | 1018 | $first_registration = $registrations[0];  | 
                                                        
| 1019 | 1019 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 1020 | 1020 | $event_name = $first_registration->event_obj()->name();  | 
                                                        
| 1021 | -				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; | 
                                                        |
| 1021 | +				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; | 
                                                        |
| 1022 | 1022 | // edit event link  | 
                                                        
| 1023 | -				if ( $event_name != '' ) { | 
                                                        |
| 1024 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );  | 
                                                        |
| 1025 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';  | 
                                                        |
| 1026 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;  | 
                                                        |
| 1023 | +				if ($event_name != '') { | 
                                                        |
| 1024 | +					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); | 
                                                        |
| 1025 | +					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; | 
                                                        |
| 1026 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';  | 
                                                        |
| 1027 | 1027 | }  | 
                                                        
| 1028 | 1028 | |
| 1029 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );  | 
                                                        |
| 1030 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';  | 
                                                        |
| 1029 | +				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); | 
                                                        |
| 1030 | +				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; | 
                                                        |
| 1031 | 1031 | |
| 1032 | 1032 | $this->_template_args['before_admin_page_content'] = '  | 
                                                        
| 1033 | 1033 | <div id="admin-page-header">  | 
                                                        
| 1034 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>  | 
                                                        |
| 1035 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>  | 
                                                        |
| 1036 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>  | 
                                                        |
| 1034 | +				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> | 
                                                        |
| 1035 | +				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> | 
                                                        |
| 1036 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>  | 
                                                        |
| 1037 | 1037 | </div>  | 
                                                        
| 1038 | 1038 | ';  | 
                                                        
| 1039 | 1039 | |
@@ -1071,7 +1071,7 @@ discard block  | 
                                                    ||
| 1071 | 1071 | |
| 1072 | 1072 | $this->_set_registration_object();  | 
                                                        
| 1073 | 1073 | |
| 1074 | -		if ( is_object( $this->_registration )) { | 
                                                        |
| 1074 | +		if (is_object($this->_registration)) { | 
                                                        |
| 1075 | 1075 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();  | 
                                                        
| 1076 | 1076 | $this->_session = $transaction->session_data();  | 
                                                        
| 1077 | 1077 | |
@@ -1079,10 +1079,10 @@ discard block  | 
                                                    ||
| 1079 | 1079 | |
| 1080 | 1080 | |
| 1081 | 1081 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();  | 
                                                        
| 1082 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );  | 
                                                        |
| 1082 | +			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); | 
                                                        |
| 1083 | 1083 | |
| 1084 | -			$this->_template_args['reg_datetime']['value'] =  $this->_registration->pretty_date('l F j, Y','g:i:s a') ; | 
                                                        |
| 1085 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );  | 
                                                        |
| 1084 | +			$this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); | 
                                                        |
| 1085 | +			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); | 
                                                        |
| 1086 | 1086 | |
| 1087 | 1087 | $this->_template_args['grand_total'] = $transaction->total();  | 
                                                        
| 1088 | 1088 | |
@@ -1090,19 +1090,19 @@ discard block  | 
                                                    ||
| 1090 | 1090 | // link back to overview  | 
                                                        
| 1091 | 1091 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL;  | 
                                                        
| 1092 | 1092 | $this->_template_args['registration'] = $this->_registration;  | 
                                                        
| 1093 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );  | 
                                                        |
| 1094 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );  | 
                                                        |
| 1095 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );  | 
                                                        |
| 1093 | +			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); | 
                                                        |
| 1094 | +			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); | 
                                                        |
| 1095 | +			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); | 
                                                        |
| 1096 | 1096 | |
| 1097 | 1097 | //next and previous links  | 
                                                        
| 1098 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' );  | 
                                                        |
| 1099 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';  | 
                                                        |
| 1100 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );  | 
                                                        |
| 1101 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';  | 
                                                        |
| 1098 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID');  | 
                                                        |
| 1099 | +			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; | 
                                                        |
| 1100 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID');  | 
                                                        |
| 1101 | +			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; | 
                                                        |
| 1102 | 1102 | |
| 1103 | 1103 | // grab header  | 
                                                        
| 1104 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';  | 
                                                        |
| 1105 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );  | 
                                                        |
| 1104 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';  | 
                                                        |
| 1105 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);  | 
                                                        |
| 1106 | 1106 | |
| 1107 | 1107 |  		} else { | 
                                                        
| 1108 | 1108 | |
@@ -1123,14 +1123,14 @@ discard block  | 
                                                    ||
| 1123 | 1123 |  	protected function _registration_details_metaboxes() { | 
                                                        
| 1124 | 1124 | $this->_set_registration_object();  | 
                                                        
| 1125 | 1125 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;  | 
                                                        
| 1126 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );  | 
                                                        |
| 1127 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );  | 
                                                        |
| 1128 | -		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { | 
                                                        |
| 1129 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );  | 
                                                        |
| 1126 | +		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); | 
                                                        |
| 1127 | +		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); | 
                                                        |
| 1128 | +		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { | 
                                                        |
| 1129 | +			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); | 
                                                        |
| 1130 | 1130 | }  | 
                                                        
| 1131 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );  | 
                                                        |
| 1132 | -		if ( $this->_registration->group_size() > 1 ) { | 
                                                        |
| 1133 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );  | 
                                                        |
| 1131 | +		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); | 
                                                        |
| 1132 | +		if ($this->_registration->group_size() > 1) { | 
                                                        |
| 1133 | +			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); | 
                                                        |
| 1134 | 1134 | }  | 
                                                        
| 1135 | 1135 | }  | 
                                                        
| 1136 | 1136 | |
@@ -1151,23 +1151,23 @@ discard block  | 
                                                    ||
| 1151 | 1151 | |
| 1152 | 1152 | //let's get an array of all possible buttons that we can just reference  | 
                                                        
| 1153 | 1153 | $status_buttons = $this->_get_reg_status_buttons();  | 
                                                        
| 1154 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();  | 
                                                        |
| 1155 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();  | 
                                                        |
| 1154 | + $template_args['reg_status_value'] = $this->_registration->pretty_status();  | 
                                                        |
| 1155 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();  | 
                                                        |
| 1156 | 1156 | $template_args['attendee'] = $this->_registration->attendee();  | 
                                                        
| 1157 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';  | 
                                                        |
| 1158 | -		if ( $this->_set_registration_object() ) { | 
                                                        |
| 1157 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';  | 
                                                        |
| 1158 | +		if ($this->_set_registration_object()) { | 
                                                        |
| 1159 | 1159 | $current_status = $this->_registration->status_ID();  | 
                                                        
| 1160 | - unset( $status_buttons[$current_status] );  | 
                                                        |
| 1161 | -			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { | 
                                                        |
| 1162 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] );  | 
                                                        |
| 1160 | + unset($status_buttons[$current_status]);  | 
                                                        |
| 1161 | +			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { | 
                                                        |
| 1162 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]);  | 
                                                        |
| 1163 | 1163 | }  | 
                                                        
| 1164 | - $template_args['status_buttons'] = implode( "\n", $status_buttons );  | 
                                                        |
| 1164 | +			$template_args['status_buttons'] = implode("\n", $status_buttons); | 
                                                        |
| 1165 | 1165 | }  | 
                                                        
| 1166 | 1166 | $template_args['form_url'] = REG_ADMIN_URL;  | 
                                                        
| 1167 | 1167 | $template_args['REG_ID'] = $this->_registration->ID();  | 
                                                        
| 1168 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE );  | 
                                                        |
| 1168 | +		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); | 
                                                        |
| 1169 | 1169 | |
| 1170 | - EEH_Template::display_template( $template, $template_args );  | 
                                                        |
| 1170 | + EEH_Template::display_template($template, $template_args);  | 
                                                        |
| 1171 | 1171 | |
| 1172 | 1172 | }  | 
                                                        
| 1173 | 1173 | |
@@ -1181,11 +1181,11 @@ discard block  | 
                                                    ||
| 1181 | 1181 |  	private function _get_reg_status_buttons() { | 
                                                        
| 1182 | 1182 | |
| 1183 | 1183 | $buttons = array(  | 
                                                        
| 1184 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',  | 
                                                        |
| 1185 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',  | 
                                                        |
| 1186 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',  | 
                                                        |
| 1187 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',  | 
                                                        |
| 1188 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',  | 
                                                        |
| 1184 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',  | 
                                                        |
| 1185 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',  | 
                                                        |
| 1186 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',  | 
                                                        |
| 1187 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',  | 
                                                        |
| 1188 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',  | 
                                                        |
| 1189 | 1189 | );  | 
                                                        
| 1190 | 1190 | return $buttons;  | 
                                                        
| 1191 | 1191 | }  | 
                                                        
@@ -1199,13 +1199,13 @@ discard block  | 
                                                    ||
| 1199 | 1199 | *  | 
                                                        
| 1200 | 1200 | * @return array (array with reg_id(s) updated and whether update was successful.  | 
                                                        
| 1201 | 1201 | */  | 
                                                        
| 1202 | -	protected function _set_registration_status_from_request( $status = false, $notify = false ) { | 
                                                        |
| 1203 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();  | 
                                                        |
| 1202 | +	protected function _set_registration_status_from_request($status = false, $notify = false) { | 
                                                        |
| 1203 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();  | 
                                                        |
| 1204 | 1204 | |
| 1205 | - $success = $this->_set_registration_status( $REG_ID, $status );  | 
                                                        |
| 1205 | + $success = $this->_set_registration_status($REG_ID, $status);  | 
                                                        |
| 1206 | 1206 | |
| 1207 | 1207 | //notify?  | 
                                                        
| 1208 | -		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { | 
                                                        |
| 1208 | +		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { | 
                                                        |
| 1209 | 1209 | $this->_process_resend_registration();  | 
                                                        
| 1210 | 1210 | }  | 
                                                        
| 1211 | 1211 | |
@@ -1223,19 +1223,19 @@ discard block  | 
                                                    ||
| 1223 | 1223 | * @param bool $status  | 
                                                        
| 1224 | 1224 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).  | 
                                                        
| 1225 | 1225 | */  | 
                                                        
| 1226 | -	protected function _set_registration_status( $REG_ID, $status = false ) { | 
                                                        |
| 1226 | +	protected function _set_registration_status($REG_ID, $status = false) { | 
                                                        |
| 1227 | 1227 | $success = true;  | 
                                                        
| 1228 | 1228 | // set default status if none is passed  | 
                                                        
| 1229 | 1229 | $status = $status ? $status : EEM_Registration::status_id_pending_payment;  | 
                                                        
| 1230 | 1230 | |
| 1231 | 1231 | //typecast and sanitize reg_id  | 
                                                        
| 1232 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' );  | 
                                                        |
| 1232 | + $reg_ids = array_filter((array) $REG_ID, 'absint');  | 
                                                        |
| 1233 | 1233 | |
| 1234 | 1234 | //loop through REG_ID's and change status  | 
                                                        
| 1235 | -		foreach ( $reg_ids as $r_id ) { | 
                                                        |
| 1236 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id );  | 
                                                        |
| 1237 | -			if ( $registration instanceof EE_Registration ) { | 
                                                        |
| 1238 | - $registration->set_status( $status );  | 
                                                        |
| 1235 | +		foreach ($reg_ids as $r_id) { | 
                                                        |
| 1236 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id);  | 
                                                        |
| 1237 | +			if ($registration instanceof EE_Registration) { | 
                                                        |
| 1238 | + $registration->set_status($status);  | 
                                                        |
| 1239 | 1239 | $result = $registration->save();  | 
                                                        
| 1240 | 1240 | |
| 1241 | 1241 | //verifying explicit fails because update *may* just return 0 for 0 rows affected  | 
                                                        
@@ -1247,7 +1247,7 @@ discard block  | 
                                                    ||
| 1247 | 1247 | $this->_req_data['_REG_ID'] = $reg_ids;  | 
                                                        
| 1248 | 1248 | |
| 1249 | 1249 | //return $success and processed registrations  | 
                                                        
| 1250 | - return array( 'REG_ID' => $reg_ids, 'success' => $success );  | 
                                                        |
| 1250 | +		return array('REG_ID' => $reg_ids, 'success' => $success); | 
                                                        |
| 1251 | 1251 | }  | 
                                                        
| 1252 | 1252 | |
| 1253 | 1253 | |
@@ -1259,37 +1259,37 @@ discard block  | 
                                                    ||
| 1259 | 1259 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not.  | 
                                                        
| 1260 | 1260 | * @return void  | 
                                                        
| 1261 | 1261 | */  | 
                                                        
| 1262 | -	protected function _reg_status_change_return( $STS_ID, $notify = false ) { | 
                                                        |
| 1262 | +	protected function _reg_status_change_return($STS_ID, $notify = false) { | 
                                                        |
| 1263 | 1263 | |
| 1264 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );  | 
                                                        |
| 1264 | +		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); | 
                                                        |
| 1265 | 1265 | |
| 1266 | 1266 | |
| 1267 | - $success = isset( $result['success'] ) && $result['success'];  | 
                                                        |
| 1267 | + $success = isset($result['success']) && $result['success'];  | 
                                                        |
| 1268 | 1268 | |
| 1269 | 1269 | //setup success message  | 
                                                        
| 1270 | -		if ( $success ) { | 
                                                        |
| 1271 | -			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; | 
                                                        |
| 1272 | - EE_Error::add_success( $msg );  | 
                                                        |
| 1270 | +		if ($success) { | 
                                                        |
| 1271 | +			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); | 
                                                        |
| 1272 | + EE_Error::add_success($msg);  | 
                                                        |
| 1273 | 1273 |  		} else { | 
                                                        
| 1274 | -			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); | 
                                                        |
| 1274 | +			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); | 
                                                        |
| 1275 | 1275 | }  | 
                                                        
| 1276 | 1276 | |
| 1277 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );  | 
                                                        |
| 1277 | +		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); | 
                                                        |
| 1278 | 1278 | //unset nonces  | 
                                                        
| 1279 | -		foreach ( $this->_req_data as $ref => $value ) { | 
                                                        |
| 1280 | -			if ( strpos( $ref, 'nonce' ) !== false ) { | 
                                                        |
| 1281 | - unset( $this->_req_data[$ref] );  | 
                                                        |
| 1279 | +		foreach ($this->_req_data as $ref => $value) { | 
                                                        |
| 1280 | +			if (strpos($ref, 'nonce') !== false) { | 
                                                        |
| 1281 | + unset($this->_req_data[$ref]);  | 
                                                        |
| 1282 | 1282 | continue;  | 
                                                        
| 1283 | 1283 | }  | 
                                                        
| 1284 | 1284 | |
| 1285 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );  | 
                                                        |
| 1285 | +			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); | 
                                                        |
| 1286 | 1286 | $this->_req_data[$ref] = $value;  | 
                                                        
| 1287 | 1287 | }  | 
                                                        
| 1288 | 1288 | |
| 1289 | 1289 | //merge request vars so that the reloaded list table contains any existing filter query params  | 
                                                        
| 1290 | - $route = array_merge( $this->_req_data, $route );  | 
                                                        |
| 1290 | + $route = array_merge($this->_req_data, $route);  | 
                                                        |
| 1291 | 1291 | |
| 1292 | - $this->_redirect_after_action( $success, '', '', $route, true );  | 
                                                        |
| 1292 | + $this->_redirect_after_action($success, '', '', $route, true);  | 
                                                        |
| 1293 | 1293 | |
| 1294 | 1294 | }  | 
                                                        
| 1295 | 1295 | |
@@ -1302,29 +1302,29 @@ discard block  | 
                                                    ||
| 1302 | 1302 |  	protected function _change_reg_status() { | 
                                                        
| 1303 | 1303 | $this->_req_data['return'] = 'view_registration';  | 
                                                        
| 1304 | 1304 | //set notify based on whether the send notifications toggle is set or not  | 
                                                        
| 1305 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );  | 
                                                        |
| 1306 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';  | 
                                                        |
| 1305 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);  | 
                                                        |
| 1306 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';  | 
                                                        |
| 1307 | 1307 | |
| 1308 | -		switch ( $this->_req_data['_reg_status_id'] ) { | 
                                                        |
| 1309 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :  | 
                                                        |
| 1310 | - $this->approve_registration( $notify );  | 
                                                        |
| 1308 | +		switch ($this->_req_data['_reg_status_id']) { | 
                                                        |
| 1309 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :  | 
                                                        |
| 1310 | + $this->approve_registration($notify);  | 
                                                        |
| 1311 | 1311 | break;  | 
                                                        
| 1312 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :  | 
                                                        |
| 1313 | - $this->pending_registration( $notify );  | 
                                                        |
| 1312 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :  | 
                                                        |
| 1313 | + $this->pending_registration($notify);  | 
                                                        |
| 1314 | 1314 | break;  | 
                                                        
| 1315 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :  | 
                                                        |
| 1316 | - $this->not_approve_registration( $notify );  | 
                                                        |
| 1315 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :  | 
                                                        |
| 1316 | + $this->not_approve_registration($notify);  | 
                                                        |
| 1317 | 1317 | break;  | 
                                                        
| 1318 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :  | 
                                                        |
| 1319 | - $this->decline_registration( $notify );  | 
                                                        |
| 1318 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :  | 
                                                        |
| 1319 | + $this->decline_registration($notify);  | 
                                                        |
| 1320 | 1320 | break;  | 
                                                        
| 1321 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :  | 
                                                        |
| 1322 | - $this->cancel_registration( $notify );  | 
                                                        |
| 1321 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :  | 
                                                        |
| 1322 | + $this->cancel_registration($notify);  | 
                                                        |
| 1323 | 1323 | break;  | 
                                                        
| 1324 | 1324 | default :  | 
                                                        
| 1325 | 1325 | $result['success'] = false;  | 
                                                        
| 1326 | - unset( $this->_req_data['return'] );  | 
                                                        |
| 1327 | - $this->_reg_status_change_return( '', false );  | 
                                                        |
| 1326 | + unset($this->_req_data['return']);  | 
                                                        |
| 1327 | +				$this->_reg_status_change_return('', false); | 
                                                        |
| 1328 | 1328 | break;  | 
                                                        
| 1329 | 1329 | }  | 
                                                        
| 1330 | 1330 | }  | 
                                                        
@@ -1337,8 +1337,8 @@ discard block  | 
                                                    ||
| 1337 | 1337 | * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        
| 1338 | 1338 | * @return void  | 
                                                        
| 1339 | 1339 | */  | 
                                                        
| 1340 | -	protected function approve_registration( $notify = false ) { | 
                                                        |
| 1341 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );  | 
                                                        |
| 1340 | +	protected function approve_registration($notify = false) { | 
                                                        |
| 1341 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);  | 
                                                        |
| 1342 | 1342 | }  | 
                                                        
| 1343 | 1343 | |
| 1344 | 1344 | |
@@ -1350,8 +1350,8 @@ discard block  | 
                                                    ||
| 1350 | 1350 | * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        
| 1351 | 1351 | * @return void  | 
                                                        
| 1352 | 1352 | */  | 
                                                        
| 1353 | -	protected function decline_registration( $notify = false ) { | 
                                                        |
| 1354 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );  | 
                                                        |
| 1353 | +	protected function decline_registration($notify = false) { | 
                                                        |
| 1354 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);  | 
                                                        |
| 1355 | 1355 | }  | 
                                                        
| 1356 | 1356 | |
| 1357 | 1357 | |
@@ -1363,8 +1363,8 @@ discard block  | 
                                                    ||
| 1363 | 1363 | * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        
| 1364 | 1364 | * @return void  | 
                                                        
| 1365 | 1365 | */  | 
                                                        
| 1366 | -	protected function cancel_registration( $notify = false ) { | 
                                                        |
| 1367 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );  | 
                                                        |
| 1366 | +	protected function cancel_registration($notify = false) { | 
                                                        |
| 1367 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);  | 
                                                        |
| 1368 | 1368 | }  | 
                                                        
| 1369 | 1369 | |
| 1370 | 1370 | |
@@ -1377,8 +1377,8 @@ discard block  | 
                                                    ||
| 1377 | 1377 | * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        
| 1378 | 1378 | * @return void  | 
                                                        
| 1379 | 1379 | */  | 
                                                        
| 1380 | -	protected function not_approve_registration( $notify = false ) { | 
                                                        |
| 1381 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );  | 
                                                        |
| 1380 | +	protected function not_approve_registration($notify = false) { | 
                                                        |
| 1381 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);  | 
                                                        |
| 1382 | 1382 | }  | 
                                                        
| 1383 | 1383 | |
| 1384 | 1384 | |
@@ -1389,8 +1389,8 @@ discard block  | 
                                                    ||
| 1389 | 1389 | * @param bool $notify whether or not to notify the registrant about their approval.  | 
                                                        
| 1390 | 1390 | * @return void  | 
                                                        
| 1391 | 1391 | */  | 
                                                        
| 1392 | -	protected function pending_registration( $notify = false ) { | 
                                                        |
| 1393 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );  | 
                                                        |
| 1392 | +	protected function pending_registration($notify = false) { | 
                                                        |
| 1393 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);  | 
                                                        |
| 1394 | 1394 | }  | 
                                                        
| 1395 | 1395 | |
| 1396 | 1396 | |
@@ -1404,77 +1404,77 @@ discard block  | 
                                                    ||
| 1404 | 1404 |  	public function _reg_details_meta_box() { | 
                                                        
| 1405 | 1405 | EEH_Autoloader::register_line_item_display_autoloaders();  | 
                                                        
| 1406 | 1406 | EEH_Autoloader::register_line_item_filter_autoloaders();  | 
                                                        
| 1407 | - EE_Registry::instance()->load_Helper( 'Line_Item' );  | 
                                                        |
| 1407 | +		EE_Registry::instance()->load_Helper('Line_Item'); | 
                                                        |
| 1408 | 1408 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();  | 
                                                        
| 1409 | 1409 | $this->_session = $transaction->session_data();  | 
                                                        
| 1410 | 1410 | |
| 1411 | 1411 | $filters = new EE_Line_Item_Filter_Collection();  | 
                                                        
| 1412 | - $filters->add( new EE_Specific_Tickets_Line_Item_Filter( array( $this->_registration->ticket() ) ) );  | 
                                                        |
| 1413 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() );  | 
                                                        |
| 1414 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration->is_cancelled() ? null : $this->_registration ) );  | 
                                                        |
| 1412 | + $filters->add(new EE_Specific_Tickets_Line_Item_Filter(array($this->_registration->ticket())));  | 
                                                        |
| 1413 | + $filters->add(new EE_Non_Zero_Line_Item_Filter());  | 
                                                        |
| 1414 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration->is_cancelled() ? null : $this->_registration));  | 
                                                        |
| 1415 | 1415 | |
| 1416 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );  | 
                                                        |
| 1416 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());  | 
                                                        |
| 1417 | 1417 | $filtered_line_item_tree = $line_item_filter_processor->process();  | 
                                                        
| 1418 | 1418 | |
| 1419 | 1419 | $this->_template_args['REG_ID'] = $this->_registration->ID();  | 
                                                        
| 1420 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );  | 
                                                        |
| 1421 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );  | 
                                                        |
| 1420 | +		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); | 
                                                        |
| 1421 | +		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); | 
                                                        |
| 1422 | 1422 | |
| 1423 | 1423 | |
| 1424 | 1424 | $attendee = $this->_registration->attendee();  | 
                                                        
| 1425 | 1425 | |
| 1426 | 1426 | |
| 1427 | -		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; | 
                                                        |
| 1428 | -		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; | 
                                                        |
| 1427 | +		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; | 
                                                        |
| 1428 | +		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; | 
                                                        |
| 1429 | 1429 | |
| 1430 | 1430 | |
| 1431 | 1431 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;  | 
                                                        
| 1432 | - $payment = $transaction->get_first_related( 'Payment' );  | 
                                                        |
| 1432 | +		$payment = $transaction->get_first_related('Payment'); | 
                                                        |
| 1433 | 1433 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;  | 
                                                        
| 1434 | - $payment_method = $payment->get_first_related( 'Payment_Method' );  | 
                                                        |
| 1434 | +		$payment_method = $payment->get_first_related('Payment_Method'); | 
                                                        |
| 1435 | 1435 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;  | 
                                                        
| 1436 | - $reg_status_class = 'status-' . $this->_registration->status_ID();  | 
                                                        |
| 1436 | + $reg_status_class = 'status-'.$this->_registration->status_ID();  | 
                                                        |
| 1437 | 1437 | $reg_details = array(  | 
                                                        
| 1438 | 1438 | 'payment_method' => $payment_method->name(),  | 
                                                        
| 1439 | 1439 | 'response_msg' => $payment->gateway_response(),  | 
                                                        
| 1440 | - 'registration_id' => $this->_registration->get( 'REG_code' ),  | 
                                                        |
| 1440 | +			'registration_id' => $this->_registration->get('REG_code'), | 
                                                        |
| 1441 | 1441 | 'registration_session' => $this->_registration->session_ID(),  | 
                                                        
| 1442 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',  | 
                                                        |
| 1443 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',  | 
                                                        |
| 1442 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',  | 
                                                        |
| 1443 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',  | 
                                                        |
| 1444 | 1444 | );  | 
                                                        
| 1445 | 1445 | |
| 1446 | 1446 | |
| 1447 | -		if ( isset( $reg_details['registration_id'] )) { | 
                                                        |
| 1447 | +		if (isset($reg_details['registration_id'])) { | 
                                                        |
| 1448 | 1448 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];  | 
                                                        
| 1449 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );  | 
                                                        |
| 1449 | +			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); | 
                                                        |
| 1450 | 1450 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';  | 
                                                        
| 1451 | 1451 | }  | 
                                                        
| 1452 | 1452 | |
| 1453 | -		if ( isset( $reg_details['payment_method'] ) ) { | 
                                                        |
| 1453 | +		if (isset($reg_details['payment_method'])) { | 
                                                        |
| 1454 | 1454 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];  | 
                                                        
| 1455 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );  | 
                                                        |
| 1455 | +			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); | 
                                                        |
| 1456 | 1456 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';  | 
                                                        
| 1457 | 1457 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];  | 
                                                        
| 1458 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );  | 
                                                        |
| 1458 | +			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); | 
                                                        |
| 1459 | 1459 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';  | 
                                                        
| 1460 | 1460 | }  | 
                                                        
| 1461 | 1461 | |
| 1462 | 1462 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];  | 
                                                        
| 1463 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );  | 
                                                        |
| 1463 | +		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); | 
                                                        |
| 1464 | 1464 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';  | 
                                                        
| 1465 | 1465 | |
| 1466 | 1466 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];  | 
                                                        
| 1467 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );  | 
                                                        |
| 1467 | +		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); | 
                                                        |
| 1468 | 1468 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';  | 
                                                        
| 1469 | 1469 | |
| 1470 | 1470 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];  | 
                                                        
| 1471 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );  | 
                                                        |
| 1471 | +		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); | 
                                                        |
| 1472 | 1472 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text';  | 
                                                        
| 1473 | 1473 | |
| 1474 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );  | 
                                                        |
| 1474 | +		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); | 
                                                        |
| 1475 | 1475 | |
| 1476 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';  | 
                                                        |
| 1477 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );  | 
                                                        |
| 1476 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';  | 
                                                        |
| 1477 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);  | 
                                                        |
| 1478 | 1478 | |
| 1479 | 1479 | }  | 
                                                        
| 1480 | 1480 | |
@@ -1490,23 +1490,23 @@ discard block  | 
                                                    ||
| 1490 | 1490 | */  | 
                                                        
| 1491 | 1491 |  	public function _reg_questions_meta_box() { | 
                                                        
| 1492 | 1492 | |
| 1493 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );  | 
                                                        |
| 1494 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 );  | 
                                                        |
| 1495 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 );  | 
                                                        |
| 1496 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 );  | 
                                                        |
| 1493 | +		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1); | 
                                                        |
| 1494 | +		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1); | 
                                                        |
| 1495 | +		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1); | 
                                                        |
| 1496 | +		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1); | 
                                                        |
| 1497 | 1497 | |
| 1498 | -		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') ); | 
                                                        |
| 1498 | +		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID')); | 
                                                        |
| 1499 | 1499 | |
| 1500 | 1500 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 1501 | 1501 | |
| 1502 | - EE_Registry::instance()->load_helper( 'Form_Fields' );  | 
                                                        |
| 1503 | - $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups );  | 
                                                        |
| 1502 | +		EE_Registry::instance()->load_helper('Form_Fields'); | 
                                                        |
| 1503 | + $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups);  | 
                                                        |
| 1504 | 1504 | |
| 1505 | 1505 | $this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form';  | 
                                                        
| 1506 | 1506 | $this->_template_args['REG_ID'] = $this->_registration->ID();  | 
                                                        
| 1507 | 1507 | |
| 1508 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';  | 
                                                        |
| 1509 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );  | 
                                                        |
| 1508 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';  | 
                                                        |
| 1509 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);  | 
                                                        |
| 1510 | 1510 | |
| 1511 | 1511 | }  | 
                                                        
| 1512 | 1512 | |
@@ -1521,7 +1521,7 @@ discard block  | 
                                                    ||
| 1521 | 1521 | * @param string $output  | 
                                                        
| 1522 | 1522 | * @return string  | 
                                                        
| 1523 | 1523 | */  | 
                                                        
| 1524 | -	public function form_before_question_group( $output ) { | 
                                                        |
| 1524 | +	public function form_before_question_group($output) { | 
                                                        |
| 1525 | 1525 | return '  | 
                                                        
| 1526 | 1526 | <table class="form-table ee-width-100">  | 
                                                        
| 1527 | 1527 | <tbody>  | 
                                                        
@@ -1538,13 +1538,13 @@ discard block  | 
                                                    ||
| 1538 | 1538 | * @param string $output  | 
                                                        
| 1539 | 1539 | * @return string  | 
                                                        
| 1540 | 1540 | */  | 
                                                        
| 1541 | -	public function form_after_question_group( $output ) { | 
                                                        |
| 1541 | +	public function form_after_question_group($output) { | 
                                                        |
| 1542 | 1542 | return '  | 
                                                        
| 1543 | 1543 | <tr class="hide-if-no-js">  | 
                                                        
| 1544 | 1544 | <th> </th>  | 
                                                        
| 1545 | 1545 | <td class="reg-admin-edit-attendee-question-td">  | 
                                                        
| 1546 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">  | 
                                                        |
| 1547 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>  | 
                                                        |
| 1546 | +					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> | 
                                                        |
| 1547 | +						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> | 
                                                        |
| 1548 | 1548 | <div class="dashicons dashicons-edit"></div>  | 
                                                        
| 1549 | 1549 | </a>  | 
                                                        
| 1550 | 1550 | </td>  | 
                                                        
@@ -1564,11 +1564,11 @@ discard block  | 
                                                    ||
| 1564 | 1564 | * @param string $label  | 
                                                        
| 1565 | 1565 | * @return string  | 
                                                        
| 1566 | 1566 | */  | 
                                                        
| 1567 | -	public function form_form_field_label_wrap( $label ) { | 
                                                        |
| 1567 | +	public function form_form_field_label_wrap($label) { | 
                                                        |
| 1568 | 1568 | return '  | 
                                                        
| 1569 | 1569 | <tr>  | 
                                                        
| 1570 | 1570 | <th>  | 
                                                        
| 1571 | - ' . $label . '  | 
                                                        |
| 1571 | + ' . $label.'  | 
                                                        |
| 1572 | 1572 | </th>';  | 
                                                        
| 1573 | 1573 | }  | 
                                                        
| 1574 | 1574 | |
@@ -1582,10 +1582,10 @@ discard block  | 
                                                    ||
| 1582 | 1582 | * @param string $label  | 
                                                        
| 1583 | 1583 | * @return string  | 
                                                        
| 1584 | 1584 | */  | 
                                                        
| 1585 | -	public function form_form_field_input__wrap( $input ) { | 
                                                        |
| 1585 | +	public function form_form_field_input__wrap($input) { | 
                                                        |
| 1586 | 1586 | return '  | 
                                                        
| 1587 | 1587 | <td class="reg-admin-attendee-questions-input-td disabled-input">  | 
                                                        
| 1588 | - ' . $input . '  | 
                                                        |
| 1588 | + ' . $input.'  | 
                                                        |
| 1589 | 1589 | </td>  | 
                                                        
| 1590 | 1590 | </tr>';  | 
                                                        
| 1591 | 1591 | }  | 
                                                        
@@ -1599,13 +1599,13 @@ discard block  | 
                                                    ||
| 1599 | 1599 | * @return void  | 
                                                        
| 1600 | 1600 | */  | 
                                                        
| 1601 | 1601 |  	protected function _update_attendee_registration_form() { | 
                                                        
| 1602 | - $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;  | 
                                                        |
| 1603 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;  | 
                                                        |
| 1604 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );  | 
                                                        |
| 1605 | - $success = $this->_save_attendee_registration_form( $REG_ID, $qstns );  | 
                                                        |
| 1602 | + $qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE;  | 
                                                        |
| 1603 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;  | 
                                                        |
| 1604 | +		$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); | 
                                                        |
| 1605 | + $success = $this->_save_attendee_registration_form($REG_ID, $qstns);  | 
                                                        |
| 1606 | 1606 |  		$what = __('Registration Form', 'event_espresso'); | 
                                                        
| 1607 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );  | 
                                                        |
| 1608 | -		$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); | 
                                                        |
| 1607 | +		$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); | 
                                                        |
| 1608 | +		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); | 
                                                        |
| 1609 | 1609 | |
| 1610 | 1610 | }  | 
                                                        
| 1611 | 1611 | |
@@ -1618,26 +1618,26 @@ discard block  | 
                                                    ||
| 1618 | 1618 | * @param bool $qstns  | 
                                                        
| 1619 | 1619 | * @return bool  | 
                                                        
| 1620 | 1620 | */  | 
                                                        
| 1621 | -	private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) { | 
                                                        |
| 1621 | +	private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) { | 
                                                        |
| 1622 | 1622 | |
| 1623 | -		if ( ! $REG_ID || ! $qstns ) { | 
                                                        |
| 1624 | -			EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1623 | +		if ( ! $REG_ID || ! $qstns) { | 
                                                        |
| 1624 | +			EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1625 | 1625 | }  | 
                                                        
| 1626 | 1626 | $success = TRUE;  | 
                                                        
| 1627 | 1627 | |
| 1628 | 1628 | // allow others to get in on this awesome fun :D  | 
                                                        
| 1629 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );  | 
                                                        |
| 1629 | +		do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); | 
                                                        |
| 1630 | 1630 | // loop thru questions... FINALLY!!!  | 
                                                        
| 1631 | 1631 | |
| 1632 | -		foreach ( $qstns as $QST_ID => $qstn ) { | 
                                                        |
| 1632 | +		foreach ($qstns as $QST_ID => $qstn) { | 
                                                        |
| 1633 | 1633 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer  | 
                                                        
| 1634 | -			if ( !is_array($qstn) ) { | 
                                                        |
| 1635 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);  | 
                                                        |
| 1634 | +			if ( ! is_array($qstn)) { | 
                                                        |
| 1635 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);  | 
                                                        |
| 1636 | 1636 | continue;  | 
                                                        
| 1637 | 1637 | }  | 
                                                        
| 1638 | 1638 | |
| 1639 | 1639 | |
| 1640 | -			foreach ( $qstn as $ANS_ID => $ANS_value ) { | 
                                                        |
| 1640 | +			foreach ($qstn as $ANS_ID => $ANS_value) { | 
                                                        |
| 1641 | 1641 | //get answer  | 
                                                        
| 1642 | 1642 | $query_params = array(  | 
                                                        
| 1643 | 1643 | 0 => array(  | 
                                                        
@@ -1648,8 +1648,8 @@ discard block  | 
                                                    ||
| 1648 | 1648 | );  | 
                                                        
| 1649 | 1649 | $answer = EEM_Answer::instance()->get_one($query_params);  | 
                                                        
| 1650 | 1650 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer  | 
                                                        
| 1651 | -				if ( ! $answer instanceof EE_Answer ) { | 
                                                        |
| 1652 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);  | 
                                                        |
| 1651 | +				if ( ! $answer instanceof EE_Answer) { | 
                                                        |
| 1652 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);  | 
                                                        |
| 1653 | 1653 | continue 2;  | 
                                                        
| 1654 | 1654 | }  | 
                                                        
| 1655 | 1655 | |
@@ -1663,7 +1663,7 @@ discard block  | 
                                                    ||
| 1663 | 1663 | |
| 1664 | 1664 | |
| 1665 | 1665 | //TODO: try changing this to use the model directly... not indirectly through creating a default object...  | 
                                                        
| 1666 | -	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { | 
                                                        |
| 1666 | +	private function _save_new_answer($REG_ID, $QST_ID, $ans) { | 
                                                        |
| 1667 | 1667 | $set_values = array(  | 
                                                        
| 1668 | 1668 | 'QST_ID' => $QST_ID,  | 
                                                        
| 1669 | 1669 | 'REG_ID' => $REG_ID,  | 
                                                        
@@ -1690,30 +1690,30 @@ discard block  | 
                                                    ||
| 1690 | 1690 | $registrations = $REG->get_all(array(  | 
                                                        
| 1691 | 1691 | array(  | 
                                                        
| 1692 | 1692 | 'TXN_ID'=>$this->_registration->transaction_ID(),  | 
                                                        
| 1693 | -				'REG_ID'=>array('!=',$this->_registration->ID()) | 
                                                        |
| 1693 | +				'REG_ID'=>array('!=', $this->_registration->ID()) | 
                                                        |
| 1694 | 1694 | ),  | 
                                                        
| 1695 | 1695 |  			'force_join'=>array('Attendee'))); | 
                                                        
| 1696 | 1696 | |
| 1697 | 1697 | $this->_template_args['attendees'] = array();  | 
                                                        
| 1698 | 1698 | $this->_template_args['attendee_notice'] = '';  | 
                                                        
| 1699 | 1699 |  		EE_Registry::instance()->load_helper('Array'); | 
                                                        
| 1700 | -		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) { | 
                                                        |
| 1701 | -			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1700 | +		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { | 
                                                        |
| 1701 | +			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1702 | 1702 | $this->_template_args['attendee_notice'] = EE_Error::get_notices();  | 
                                                        
| 1703 | 1703 |  		} else { | 
                                                        
| 1704 | 1704 | |
| 1705 | 1705 | $att_nmbr = 1;  | 
                                                        
| 1706 | -			foreach ( $registrations as $registration ) { | 
                                                        |
| 1706 | +			foreach ($registrations as $registration) { | 
                                                        |
| 1707 | 1707 | /* @var $registration EE_Registration */  | 
                                                        
| 1708 | 1708 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();  | 
                                                        
| 1709 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';  | 
                                                        |
| 1710 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';  | 
                                                        |
| 1711 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';  | 
                                                        |
| 1712 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';  | 
                                                        |
| 1709 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';  | 
                                                        |
| 1710 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';  | 
                                                        |
| 1711 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';  | 
                                                        |
| 1712 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';  | 
                                                        |
| 1713 | 1713 | |
| 1714 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );  | 
                                                        |
| 1714 | +				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); | 
                                                        |
| 1715 | 1715 | |
| 1716 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 1716 | +				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); | 
                                                        |
| 1717 | 1717 | |
| 1718 | 1718 | $att_nmbr++;  | 
                                                        
| 1719 | 1719 | }  | 
                                                        
@@ -1725,8 +1725,8 @@ discard block  | 
                                                    ||
| 1725 | 1725 | |
| 1726 | 1726 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL );  | 
                                                        
| 1727 | 1727 | }  | 
                                                        
| 1728 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';  | 
                                                        |
| 1729 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );  | 
                                                        |
| 1728 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';  | 
                                                        |
| 1729 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);  | 
                                                        |
| 1730 | 1730 | |
| 1731 | 1731 | }  | 
                                                        
| 1732 | 1732 | |
@@ -1747,11 +1747,11 @@ discard block  | 
                                                    ||
| 1747 | 1747 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();  | 
                                                        
| 1748 | 1748 | |
| 1749 | 1749 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not)  | 
                                                        
| 1750 | -		if ( ! $this->_registration->is_primary_registrant() ) { | 
                                                        |
| 1750 | +		if ( ! $this->_registration->is_primary_registrant()) { | 
                                                        |
| 1751 | 1751 | $primary_registration = $this->_registration->get_primary_registration();  | 
                                                        
| 1752 | 1752 | $primary_attendee = $primary_registration->attendee();  | 
                                                        
| 1753 | 1753 | |
| 1754 | -			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { | 
                                                        |
| 1754 | +			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { | 
                                                        |
| 1755 | 1755 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.  | 
                                                        
| 1756 | 1756 | $primary_registration = NULL;  | 
                                                        
| 1757 | 1757 | }  | 
                                                        
@@ -1760,28 +1760,28 @@ discard block  | 
                                                    ||
| 1760 | 1760 | }  | 
                                                        
| 1761 | 1761 | |
| 1762 | 1762 | $this->_template_args['ATT_ID'] = $attendee->ID();  | 
                                                        
| 1763 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;  | 
                                                        |
| 1764 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;  | 
                                                        |
| 1765 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;  | 
                                                        |
| 1763 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;  | 
                                                        |
| 1764 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;  | 
                                                        |
| 1765 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;  | 
                                                        |
| 1766 | 1766 | $this->_template_args['phone'] = $attendee->phone();  | 
                                                        
| 1767 | 1767 | |
| 1768 | - EE_Registry::instance()->load_helper( 'Formatter' );  | 
                                                        |
| 1769 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );  | 
                                                        |
| 1768 | +		EE_Registry::instance()->load_helper('Formatter'); | 
                                                        |
| 1769 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee);  | 
                                                        |
| 1770 | 1770 | |
| 1771 | 1771 | |
| 1772 | 1772 | //edit link  | 
                                                        
| 1773 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 1774 | -		$this->_template_args['att_edit_label'] = __('View/Edit Contact' ); | 
                                                        |
| 1773 | +		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); | 
                                                        |
| 1774 | +		$this->_template_args['att_edit_label'] = __('View/Edit Contact'); | 
                                                        |
| 1775 | 1775 | |
| 1776 | 1776 | //create link  | 
                                                        
| 1777 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';  | 
                                                        |
| 1777 | +		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; | 
                                                        |
| 1778 | 1778 |  		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); | 
                                                        
| 1779 | 1779 | |
| 1780 | 1780 | $this->_template_args['att_check'] = $att_check;  | 
                                                        
| 1781 | 1781 | |
| 1782 | 1782 | |
| 1783 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';  | 
                                                        |
| 1784 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );  | 
                                                        |
| 1783 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';  | 
                                                        |
| 1784 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);  | 
                                                        |
| 1785 | 1785 | }  | 
                                                        
| 1786 | 1786 | |
| 1787 | 1787 | |
@@ -1794,7 +1794,7 @@ discard block  | 
                                                    ||
| 1794 | 1794 | * @access protected  | 
                                                        
| 1795 | 1795 | * @return void  | 
                                                        
| 1796 | 1796 | */  | 
                                                        
| 1797 | -	protected function _trash_or_restore_registrations( $trash = TRUE ) { | 
                                                        |
| 1797 | +	protected function _trash_or_restore_registrations($trash = TRUE) { | 
                                                        |
| 1798 | 1798 | $REGM = EEM_Registration::instance();  | 
                                                        
| 1799 | 1799 | |
| 1800 | 1800 | $success = 1;  | 
                                                        
@@ -1804,26 +1804,26 @@ discard block  | 
                                                    ||
| 1804 | 1804 | $dtts = array();  | 
                                                        
| 1805 | 1805 | |
| 1806 | 1806 | //if empty _REG_ID then get out because there's nothing to do  | 
                                                        
| 1807 | -		if ( empty( $this->_req_data['_REG_ID'] ) ) { | 
                                                        |
| 1807 | +		if (empty($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1808 | 1808 |  			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); | 
                                                        
| 1809 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );  | 
                                                        |
| 1810 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE );  | 
                                                        |
| 1809 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);  | 
                                                        |
| 1810 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE);  | 
                                                        |
| 1811 | 1811 | }  | 
                                                        
| 1812 | 1812 | |
| 1813 | 1813 | //Checkboxes  | 
                                                        
| 1814 | -		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1814 | +		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1815 | 1815 | // if array has more than one element than success message should be plural  | 
                                                        
| 1816 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;  | 
                                                        |
| 1816 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;  | 
                                                        |
| 1817 | 1817 | // cycle thru checkboxes  | 
                                                        
| 1818 | -			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1818 | +			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1819 | 1819 | |
| 1820 | 1820 | $REG = $REGM->get_one_by_ID($REG_ID);  | 
                                                        
| 1821 | 1821 |  				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); | 
                                                        
| 1822 | -				if ( $payment_count > 0 ) { | 
                                                        |
| 1823 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );  | 
                                                        |
| 1822 | +				if ($payment_count > 0) { | 
                                                        |
| 1823 | +					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); | 
                                                        |
| 1824 | 1824 | $error = 1;  | 
                                                        
| 1825 | 1825 | $success = 0;  | 
                                                        
| 1826 | -					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1826 | +					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1827 | 1827 | continue; //can't trash this registration because it has payments.  | 
                                                        
| 1828 | 1828 | }  | 
                                                        
| 1829 | 1829 |  				$ticket = $REG->get_first_related('Ticket'); | 
                                                        
@@ -1832,7 +1832,7 @@ discard block  | 
                                                    ||
| 1832 | 1832 | $dtts = array_merge($dtts, $dtt);  | 
                                                        
| 1833 | 1833 | |
| 1834 | 1834 | $updated = $trash ? $REG->delete() : $REG->restore();  | 
                                                        
| 1835 | -				if ( !$updated ) { | 
                                                        |
| 1835 | +				if ( ! $updated) { | 
                                                        |
| 1836 | 1836 | $success = 0;  | 
                                                        
| 1837 | 1837 |  				} else { | 
                                                        
| 1838 | 1838 | $success = 2;  | 
                                                        
@@ -1847,7 +1847,7 @@ discard block  | 
                                                    ||
| 1847 | 1847 | $tickets[$ticket->ID()] = $ticket;  | 
                                                        
| 1848 | 1848 |  			$dtts = $ticket->get_many_related('Datetime'); | 
                                                        
| 1849 | 1849 | $updated = $trash ? $REG->delete() : $REG->restore();  | 
                                                        
| 1850 | -			if ( ! $updated ) { | 
                                                        |
| 1850 | +			if ( ! $updated) { | 
                                                        |
| 1851 | 1851 | $success = 0;  | 
                                                        
| 1852 | 1852 | }  | 
                                                        
| 1853 | 1853 | |
@@ -1857,10 +1857,10 @@ discard block  | 
                                                    ||
| 1857 | 1857 | EEM_Ticket::instance()->update_tickets_sold($tickets);  | 
                                                        
| 1858 | 1858 | EEM_Datetime::instance()->update_sold($dtts);  | 
                                                        
| 1859 | 1859 | |
| 1860 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );  | 
                                                        |
| 1861 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );  | 
                                                        |
| 1860 | +		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); | 
                                                        |
| 1861 | +		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); | 
                                                        |
| 1862 | 1862 | $overwrite_msgs = $error ? TRUE : FALSE;  | 
                                                        
| 1863 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );  | 
                                                        |
| 1863 | +		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); | 
                                                        |
| 1864 | 1864 | }  | 
                                                        
| 1865 | 1865 | |
| 1866 | 1866 | |
@@ -1884,16 +1884,16 @@ discard block  | 
                                                    ||
| 1884 | 1884 | $success = 1;  | 
                                                        
| 1885 | 1885 | |
| 1886 | 1886 | //Checkboxes  | 
                                                        
| 1887 | -		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1887 | +		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1888 | 1888 | // if array has more than one element than success message should be plural  | 
                                                        
| 1889 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;  | 
                                                        |
| 1889 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;  | 
                                                        |
| 1890 | 1890 | // cycle thru checkboxes  | 
                                                        
| 1891 | -			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1891 | +			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { | 
                                                        |
| 1892 | 1892 | $REG = $REG_MDL->get_one_by_ID($REG_ID);  | 
                                                        
| 1893 | - if ( ! $REG instanceof EE_Registration )  | 
                                                        |
| 1893 | + if ( ! $REG instanceof EE_Registration)  | 
                                                        |
| 1894 | 1894 | continue;  | 
                                                        
| 1895 | 1895 | $deleted = $this->_delete_registration($REG);  | 
                                                        
| 1896 | -				if ( !$deleted ) { | 
                                                        |
| 1896 | +				if ( ! $deleted) { | 
                                                        |
| 1897 | 1897 | $success = 0;  | 
                                                        
| 1898 | 1898 | }  | 
                                                        
| 1899 | 1899 | }  | 
                                                        
@@ -1903,15 +1903,15 @@ discard block  | 
                                                    ||
| 1903 | 1903 | $REG_ID = $this->_req_data['_REG_ID'];  | 
                                                        
| 1904 | 1904 | $REG = $REG_MDL->get_one_by_ID($REG_ID);  | 
                                                        
| 1905 | 1905 | $deleted = $this->_delete_registration($REG);  | 
                                                        
| 1906 | -			if ( ! $deleted ) { | 
                                                        |
| 1906 | +			if ( ! $deleted) { | 
                                                        |
| 1907 | 1907 | $success = 0;  | 
                                                        
| 1908 | 1908 | }  | 
                                                        
| 1909 | 1909 | |
| 1910 | 1910 | }  | 
                                                        
| 1911 | 1911 | |
| 1912 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );  | 
                                                        |
| 1913 | - $action_desc = __( 'permanently deleted.', 'event_espresso' );  | 
                                                        |
| 1914 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );  | 
                                                        |
| 1912 | +		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); | 
                                                        |
| 1913 | +		$action_desc = __('permanently deleted.', 'event_espresso'); | 
                                                        |
| 1914 | +		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); | 
                                                        |
| 1915 | 1915 | }  | 
                                                        
| 1916 | 1916 | |
| 1917 | 1917 | |
@@ -1923,31 +1923,31 @@ discard block  | 
                                                    ||
| 1923 | 1923 | * @param EE_Registration $REG registration to be deleted permenantly  | 
                                                        
| 1924 | 1924 | * @return boolean true = successful deletion, false = fail.  | 
                                                        
| 1925 | 1925 | */  | 
                                                        
| 1926 | -	protected function _delete_registration( EE_Registration $REG ) { | 
                                                        |
| 1926 | +	protected function _delete_registration(EE_Registration $REG) { | 
                                                        |
| 1927 | 1927 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.  | 
                                                        
| 1928 | 1928 |  		$TXN = $REG->get_first_related('Transaction'); | 
                                                        
| 1929 | 1929 |  		$REGS = $TXN->get_many_related('Registration'); | 
                                                        
| 1930 | 1930 | |
| 1931 | 1931 | $all_trashed = TRUE;  | 
                                                        
| 1932 | -		foreach ( $REGS as $registration ) { | 
                                                        |
| 1933 | -			if ( ! $registration->get('REG_deleted') ) | 
                                                        |
| 1932 | +		foreach ($REGS as $registration) { | 
                                                        |
| 1933 | +			if ( ! $registration->get('REG_deleted')) | 
                                                        |
| 1934 | 1934 | $all_trashed = FALSE;  | 
                                                        
| 1935 | 1935 | }  | 
                                                        
| 1936 | 1936 | |
| 1937 | -		if ( ! $all_trashed ) { | 
                                                        |
| 1938 | -			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 1937 | +		if ( ! $all_trashed) { | 
                                                        |
| 1938 | +			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 1939 | 1939 | return false;  | 
                                                        
| 1940 | 1940 | }  | 
                                                        
| 1941 | 1941 | |
| 1942 | 1942 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).  | 
                                                        
| 1943 | -		foreach ( $REGS as $registration ) { | 
                                                        |
| 1943 | +		foreach ($REGS as $registration) { | 
                                                        |
| 1944 | 1944 | |
| 1945 | 1945 | //delete related answers  | 
                                                        
| 1946 | 1946 |  			$registration->delete_related_permanently('Answer'); | 
                                                        
| 1947 | 1947 | |
| 1948 | 1948 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)  | 
                                                        
| 1949 | 1949 |  			$attendee = $registration->get_first_related('Attendee'); | 
                                                        
| 1950 | -			if ( $attendee instanceof EE_Attendee ) { | 
                                                        |
| 1950 | +			if ($attendee instanceof EE_Attendee) { | 
                                                        |
| 1951 | 1951 | $registration->_remove_relation_to($attendee, 'Attendee');  | 
                                                        
| 1952 | 1952 | }  | 
                                                        
| 1953 | 1953 | |
@@ -1957,7 +1957,7 @@ discard block  | 
                                                    ||
| 1957 | 1957 | //now delete permanently the checkins related to this registration.  | 
                                                        
| 1958 | 1958 |  			$registration->delete_related_permanently('Checkin'); | 
                                                        
| 1959 | 1959 | |
| 1960 | - if ( $registration->ID() === $REG->ID() )  | 
                                                        |
| 1960 | + if ($registration->ID() === $REG->ID())  | 
                                                        |
| 1961 | 1961 | continue; //we don't want to delete permanently the existing registration just yet.  | 
                                                        
| 1962 | 1962 | |
| 1963 | 1963 | //remove relation to transaction for these registrations if NOT the existing registrations  | 
                                                        
@@ -1990,34 +1990,34 @@ discard block  | 
                                                    ||
| 1990 | 1990 | * @return void  | 
                                                        
| 1991 | 1991 | */  | 
                                                        
| 1992 | 1992 |  	public function new_registration() { | 
                                                        
| 1993 | -		if ( ! $this->_set_reg_event() ) { | 
                                                        |
| 1994 | -			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); | 
                                                        |
| 1993 | +		if ( ! $this->_set_reg_event()) { | 
                                                        |
| 1994 | +			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); | 
                                                        |
| 1995 | 1995 | }  | 
                                                        
| 1996 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE );  | 
                                                        |
| 1996 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE);  | 
                                                        |
| 1997 | 1997 | |
| 1998 | 1998 | // gotta start with a clean slate if we're not coming here via ajax  | 
                                                        
| 1999 | -		if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { | 
                                                        |
| 2000 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );  | 
                                                        |
| 1999 | +		if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { | 
                                                        |
| 2000 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);  | 
                                                        |
| 2001 | 2001 | }  | 
                                                        
| 2002 | 2002 | |
| 2003 | - $this->_template_args['event_name'] = '' ;  | 
                                                        |
| 2003 | + $this->_template_args['event_name'] = '';  | 
                                                        |
| 2004 | 2004 | // event name  | 
                                                        
| 2005 | -		if ( $this->_reg_event ) { | 
                                                        |
| 2005 | +		if ($this->_reg_event) { | 
                                                        |
| 2006 | 2006 | $this->_template_args['event_name'] = $this->_reg_event->name();  | 
                                                        
| 2007 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );  | 
                                                        |
| 2008 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';  | 
                                                        |
| 2009 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;  | 
                                                        |
| 2007 | +			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); | 
                                                        |
| 2008 | +			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; | 
                                                        |
| 2009 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';  | 
                                                        |
| 2010 | 2010 | }  | 
                                                        
| 2011 | 2011 | |
| 2012 | 2012 | $this->_template_args['step_content'] = $this->_get_registration_step_content();  | 
                                                        
| 2013 | 2013 | |
| 2014 | -		if ( defined('DOING_AJAX' ) ) | 
                                                        |
| 2014 | +		if (defined('DOING_AJAX')) | 
                                                        |
| 2015 | 2015 | $this->_return_json();  | 
                                                        
| 2016 | 2016 | |
| 2017 | 2017 | |
| 2018 | 2018 | // grab header  | 
                                                        
| 2019 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';  | 
                                                        |
| 2020 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );  | 
                                                        |
| 2019 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';  | 
                                                        |
| 2020 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);  | 
                                                        |
| 2021 | 2021 | |
| 2022 | 2022 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );  | 
                                                        
| 2023 | 2023 | // the details template wrapper  | 
                                                        
@@ -2035,7 +2035,7 @@ discard block  | 
                                                    ||
| 2035 | 2035 | */  | 
                                                        
| 2036 | 2036 |  	protected function _get_registration_step_content() { | 
                                                        
| 2037 | 2037 | |
| 2038 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php';  | 
                                                        |
| 2038 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php';  | 
                                                        |
| 2039 | 2039 | $template_args = array(  | 
                                                        
| 2040 | 2040 | 'title' => '',  | 
                                                        
| 2041 | 2041 | 'content' => '',  | 
                                                        
@@ -2056,11 +2056,11 @@ discard block  | 
                                                    ||
| 2056 | 2056 | |
| 2057 | 2057 | //if the cart is empty then we know we're at step one so we'll display ticket selector  | 
                                                        
| 2058 | 2058 |  		$cart = EE_Registry::instance()->SSN->get_session_data('cart'); | 
                                                        
| 2059 | - $step = empty( $cart ) ? 'ticket' : 'questions';  | 
                                                        |
| 2060 | -		switch ( $step ) { | 
                                                        |
| 2059 | + $step = empty($cart) ? 'ticket' : 'questions';  | 
                                                        |
| 2060 | +		switch ($step) { | 
                                                        |
| 2061 | 2061 | case 'ticket' :  | 
                                                        
| 2062 | 2062 |  				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); | 
                                                        
| 2063 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );  | 
                                                        |
| 2063 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);  | 
                                                        |
| 2064 | 2064 |  				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); | 
                                                        
| 2065 | 2065 | $template_args['show_notification_toggle'] = FALSE;  | 
                                                        
| 2066 | 2066 | break;  | 
                                                        
@@ -2073,9 +2073,9 @@ discard block  | 
                                                    ||
| 2073 | 2073 | break;  | 
                                                        
| 2074 | 2074 | }  | 
                                                        
| 2075 | 2075 | |
| 2076 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.  | 
                                                        |
| 2076 | +		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. | 
                                                        |
| 2077 | 2077 | |
| 2078 | - return EEH_Template::display_template( $template_path, $template_args, TRUE );  | 
                                                        |
| 2078 | + return EEH_Template::display_template($template_path, $template_args, TRUE);  | 
                                                        |
| 2079 | 2079 | }  | 
                                                        
| 2080 | 2080 | |
| 2081 | 2081 | |
@@ -2089,11 +2089,11 @@ discard block  | 
                                                    ||
| 2089 | 2089 | * @return boolean  | 
                                                        
| 2090 | 2090 | */  | 
                                                        
| 2091 | 2091 |  	private function _set_reg_event() { | 
                                                        
| 2092 | -		if ( is_object( $this->_reg_event )) { | 
                                                        |
| 2092 | +		if (is_object($this->_reg_event)) { | 
                                                        |
| 2093 | 2093 | return TRUE;  | 
                                                        
| 2094 | 2094 | }  | 
                                                        
| 2095 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 2096 | -		if ( ! $EVT_ID ) { | 
                                                        |
| 2095 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 2096 | +		if ( ! $EVT_ID) { | 
                                                        |
| 2097 | 2097 | return FALSE;  | 
                                                        
| 2098 | 2098 | }  | 
                                                        
| 2099 | 2099 | |
@@ -2114,62 +2114,62 @@ discard block  | 
                                                    ||
| 2114 | 2114 |  	public function process_reg_step() { | 
                                                        
| 2115 | 2115 | |
| 2116 | 2116 | $this->_set_reg_event();  | 
                                                        
| 2117 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE );  | 
                                                        |
| 2117 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE);  | 
                                                        |
| 2118 | 2118 | |
| 2119 | 2119 | //what step are we on?  | 
                                                        
| 2120 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' );  | 
                                                        |
| 2121 | - $step = empty( $cart ) ? 'ticket' : 'questions';  | 
                                                        |
| 2120 | +		$cart = EE_Registry::instance()->SSN->get_session_data('cart'); | 
                                                        |
| 2121 | + $step = empty($cart) ? 'ticket' : 'questions';  | 
                                                        |
| 2122 | 2122 | |
| 2123 | 2123 | //if doing ajax then we need to verify the nonce  | 
                                                        
| 2124 | -		if ( 'DOING_AJAX' ) { | 
                                                        |
| 2125 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';  | 
                                                        |
| 2126 | - $this->_verify_nonce( $nonce, $this->_req_nonce );  | 
                                                        |
| 2124 | +		if ('DOING_AJAX') { | 
                                                        |
| 2125 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';  | 
                                                        |
| 2126 | + $this->_verify_nonce($nonce, $this->_req_nonce);  | 
                                                        |
| 2127 | 2127 | }  | 
                                                        
| 2128 | 2128 | |
| 2129 | -		switch ( $step ) { | 
                                                        |
| 2129 | +		switch ($step) { | 
                                                        |
| 2130 | 2130 | case 'ticket' :  | 
                                                        
| 2131 | 2131 | //process ticket selection  | 
                                                        
| 2132 | 2132 | $success = EED_Ticket_Selector::instance()->process_ticket_selections();  | 
                                                        
| 2133 | -				if ( $success ) { | 
                                                        |
| 2134 | -					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); | 
                                                        |
| 2133 | +				if ($success) { | 
                                                        |
| 2134 | +					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); | 
                                                        |
| 2135 | 2135 |  				} else { | 
                                                        
| 2136 | 2136 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE;  | 
                                                        
| 2137 | 2137 | }  | 
                                                        
| 2138 | -				if ( defined('DOING_AJAX') ) { | 
                                                        |
| 2138 | +				if (defined('DOING_AJAX')) { | 
                                                        |
| 2139 | 2139 | $this->new_registration(); //display next step  | 
                                                        
| 2140 | 2140 |  				} else { | 
                                                        
| 2141 | 2141 | $query_args['action'] = 'new_registration';  | 
                                                        
| 2142 | 2142 | $query_args['processing_registration'] = true;  | 
                                                        
| 2143 | 2143 | $query_args['event_id'] = $this->_reg_event->ID();  | 
                                                        
| 2144 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 2144 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 2145 | 2145 | }  | 
                                                        
| 2146 | 2146 | break;  | 
                                                        
| 2147 | 2147 | case 'questions' :  | 
                                                        
| 2148 | -				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { | 
                                                        |
| 2149 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );  | 
                                                        |
| 2148 | +				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { | 
                                                        |
| 2149 | +					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); | 
                                                        |
| 2150 | 2150 | }  | 
                                                        
| 2151 | 2151 | //process registration  | 
                                                        
| 2152 | 2152 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();  | 
                                                        
| 2153 | -				if ( ! $transaction instanceof EE_Transaction ) { | 
                                                        |
| 2153 | +				if ( ! $transaction instanceof EE_Transaction) { | 
                                                        |
| 2154 | 2154 | $query_args = array(  | 
                                                        
| 2155 | 2155 | 'action' => 'new_registration',  | 
                                                        
| 2156 | 2156 | 'processing_registration' => true,  | 
                                                        
| 2157 | 2157 | 'event_id' => $this->_reg_event->ID()  | 
                                                        
| 2158 | 2158 | );  | 
                                                        
| 2159 | 2159 | |
| 2160 | -					if ( defined('DOING_AJAX' )) { | 
                                                        |
| 2160 | +					if (defined('DOING_AJAX')) { | 
                                                        |
| 2161 | 2161 | //display registration form again because there are errors (maybe validation?)  | 
                                                        
| 2162 | 2162 | $this->new_registration();  | 
                                                        
| 2163 | 2163 | return;  | 
                                                        
| 2164 | 2164 |  					} else { | 
                                                        
| 2165 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 2165 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 2166 | 2166 | return;  | 
                                                        
| 2167 | 2167 | }  | 
                                                        
| 2168 | 2168 | }  | 
                                                        
| 2169 | 2169 | /** @type EE_Transaction_Payments $transaction_payments */  | 
                                                        
| 2170 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );  | 
                                                        |
| 2170 | +				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); | 
                                                        |
| 2171 | 2171 | // maybe update status, and make sure to save transaction if not done already  | 
                                                        
| 2172 | -				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { | 
                                                        |
| 2172 | +				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { | 
                                                        |
| 2173 | 2173 | $transaction->save();  | 
                                                        
| 2174 | 2174 | }  | 
                                                        
| 2175 | 2175 | $query_args = array(  | 
                                                        
@@ -2177,8 +2177,8 @@ discard block  | 
                                                    ||
| 2177 | 2177 | 'TXN_ID' => $transaction->ID(),  | 
                                                        
| 2178 | 2178 | 'page' => 'espresso_transactions'  | 
                                                        
| 2179 | 2179 | );  | 
                                                        
| 2180 | -				EE_Error::add_success( __('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso') ); | 
                                                        |
| 2181 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 2180 | +				EE_Error::add_success(__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')); | 
                                                        |
| 2181 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 2182 | 2182 | break;  | 
                                                        
| 2183 | 2183 | }  | 
                                                        
| 2184 | 2184 | |
@@ -2198,7 +2198,7 @@ discard block  | 
                                                    ||
| 2198 | 2198 | * @return void  | 
                                                        
| 2199 | 2199 | */  | 
                                                        
| 2200 | 2200 |  	protected function _attendee_contact_list_table() { | 
                                                        
| 2201 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 2201 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 2202 | 2202 |  		$this->_search_btn_label = __('Contacts', 'event_espresso'); | 
                                                        
| 2203 | 2203 | $this->display_admin_list_table_page_with_no_sidebar();  | 
                                                        
| 2204 | 2204 | }  | 
                                                        
@@ -2213,10 +2213,10 @@ discard block  | 
                                                    ||
| 2213 | 2213 | * @access public  | 
                                                        
| 2214 | 2214 | * @return array  | 
                                                        
| 2215 | 2215 | */  | 
                                                        
| 2216 | -	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { | 
                                                        |
| 2216 | +	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { | 
                                                        |
| 2217 | 2217 | |
| 2218 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 2219 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );  | 
                                                        |
| 2218 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 2219 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');  | 
                                                        |
| 2220 | 2220 | $ATT_MDL = EEM_Attendee::instance();  | 
                                                        
| 2221 | 2221 | |
| 2222 | 2222 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';  | 
                                                        
@@ -2244,47 +2244,47 @@ discard block  | 
                                                    ||
| 2244 | 2244 | $orderby = 'ATT_lname';  | 
                                                        
| 2245 | 2245 | }  | 
                                                        
| 2246 | 2246 | |
| 2247 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';  | 
                                                        |
| 2247 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';  | 
                                                        |
| 2248 | 2248 | |
| 2249 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 2250 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;  | 
                                                        |
| 2251 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;  | 
                                                        |
| 2249 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 2250 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;  | 
                                                        |
| 2251 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;  | 
                                                        |
| 2252 | 2252 | |
| 2253 | 2253 | $_where = array();  | 
                                                        
| 2254 | 2254 | |
| 2255 | -		if ( isset( $this->_req_data['s'] ) ) { | 
                                                        |
| 2256 | - $sstr = '%' . $this->_req_data['s'] . '%';  | 
                                                        |
| 2255 | +		if (isset($this->_req_data['s'])) { | 
                                                        |
| 2256 | + $sstr = '%'.$this->_req_data['s'].'%';  | 
                                                        |
| 2257 | 2257 | $_where['OR'] = array(  | 
                                                        
| 2258 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr),  | 
                                                        |
| 2259 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2260 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 2261 | - 'ATT_fname' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2262 | - 'ATT_lname' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2263 | - 'ATT_short_bio' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2264 | -				'ATT_email' => array('LIKE', $sstr ), | 
                                                        |
| 2265 | - 'ATT_address' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2266 | - 'ATT_address2' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2267 | - 'ATT_city' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2268 | - 'Country.CNT_name' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2269 | -				'State.STA_name' => array('LIKE', $sstr ), | 
                                                        |
| 2270 | - 'ATT_phone' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2271 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2272 | - 'Registration.REG_code' => array( 'LIKE', $sstr ),  | 
                                                        |
| 2273 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 2274 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr )  | 
                                                        |
| 2258 | +				'Registration.Event.EVT_name' => array('LIKE', $sstr), | 
                                                        |
| 2259 | +				'Registration.Event.EVT_desc' => array('LIKE', $sstr), | 
                                                        |
| 2260 | +				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), | 
                                                        |
| 2261 | +				'ATT_fname' => array('LIKE', $sstr), | 
                                                        |
| 2262 | +				'ATT_lname' => array('LIKE', $sstr), | 
                                                        |
| 2263 | +				'ATT_short_bio' => array('LIKE', $sstr), | 
                                                        |
| 2264 | +				'ATT_email' => array('LIKE', $sstr), | 
                                                        |
| 2265 | +				'ATT_address' => array('LIKE', $sstr), | 
                                                        |
| 2266 | +				'ATT_address2' => array('LIKE', $sstr), | 
                                                        |
| 2267 | +				'ATT_city' => array('LIKE', $sstr), | 
                                                        |
| 2268 | +				'Country.CNT_name' => array('LIKE', $sstr), | 
                                                        |
| 2269 | +				'State.STA_name' => array('LIKE', $sstr), | 
                                                        |
| 2270 | +				'ATT_phone' => array('LIKE', $sstr), | 
                                                        |
| 2271 | +				'Registration.REG_final_price' => array('LIKE', $sstr), | 
                                                        |
| 2272 | +				'Registration.REG_code' => array('LIKE', $sstr), | 
                                                        |
| 2273 | +				'Registration.REG_count' => array('LIKE', $sstr), | 
                                                        |
| 2274 | +				'Registration.REG_group_size' => array('LIKE', $sstr) | 
                                                        |
| 2275 | 2275 | );  | 
                                                        
| 2276 | 2276 | }  | 
                                                        
| 2277 | 2277 | |
| 2278 | 2278 | |
| 2279 | - $offset = ($current_page-1)*$per_page;  | 
                                                        |
| 2280 | - $limit = $count ? NULL : array( $offset, $per_page );  | 
                                                        |
| 2279 | + $offset = ($current_page - 1) * $per_page;  | 
                                                        |
| 2280 | + $limit = $count ? NULL : array($offset, $per_page);  | 
                                                        |
| 2281 | 2281 | |
| 2282 | -		if ( $trash ) { | 
                                                        |
| 2283 | - $_where['status'] = array( '!=', 'publish' );  | 
                                                        |
| 2284 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));  | 
                                                        |
| 2282 | +		if ($trash) { | 
                                                        |
| 2283 | +			$_where['status'] = array('!=', 'publish'); | 
                                                        |
| 2284 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));  | 
                                                        |
| 2285 | 2285 |  		} else { | 
                                                        
| 2286 | - $_where['status'] = array( 'IN', array( 'publish' ) );  | 
                                                        |
| 2287 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );  | 
                                                        |
| 2286 | +			$_where['status'] = array('IN', array('publish')); | 
                                                        |
| 2287 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));  | 
                                                        |
| 2288 | 2288 | }  | 
                                                        
| 2289 | 2289 | |
| 2290 | 2290 | return $all_attendees;  | 
                                                        
@@ -2301,10 +2301,10 @@ discard block  | 
                                                    ||
| 2301 | 2301 | */  | 
                                                        
| 2302 | 2302 |  	protected function _resend_registration() { | 
                                                        
| 2303 | 2303 | $this->_process_resend_registration();  | 
                                                        
| 2304 | -		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( | 
                                                        |
| 2304 | +		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( | 
                                                        |
| 2305 | 2305 | 'action' => 'default'  | 
                                                        
| 2306 | 2306 | );  | 
                                                        
| 2307 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 2307 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 2308 | 2308 | }  | 
                                                        
| 2309 | 2309 | |
| 2310 | 2310 | |
@@ -2312,17 +2312,17 @@ discard block  | 
                                                    ||
| 2312 | 2312 | |
| 2313 | 2313 | |
| 2314 | 2314 | |
| 2315 | -	public function _registrations_report(){ | 
                                                        |
| 2316 | - EE_Registry::instance()->load_helper( 'File' );  | 
                                                        |
| 2315 | +	public function _registrations_report() { | 
                                                        |
| 2316 | +		EE_Registry::instance()->load_helper('File'); | 
                                                        |
| 2317 | 2317 | $new_request_args = array(  | 
                                                        
| 2318 | 2318 | 'export' => 'report',  | 
                                                        
| 2319 | 2319 | 'action' => 'registrations_report_for_event',  | 
                                                        
| 2320 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,  | 
                                                        |
| 2320 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,  | 
                                                        |
| 2321 | 2321 | );  | 
                                                        
| 2322 | 2322 | $this->_req_data = array_merge($this->_req_data, $new_request_args);  | 
                                                        
| 2323 | 2323 | |
| 2324 | -		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { | 
                                                        |
| 2325 | - require_once(EE_CLASSES . 'EE_Export.class.php');  | 
                                                        |
| 2324 | +		if (is_readable(EE_CLASSES.'EE_Export.class.php')) { | 
                                                        |
| 2325 | + require_once(EE_CLASSES.'EE_Export.class.php');  | 
                                                        |
| 2326 | 2326 | $EE_Export = EE_Export::instance($this->_req_data);  | 
                                                        
| 2327 | 2327 | $EE_Export->export();  | 
                                                        
| 2328 | 2328 | }  | 
                                                        
@@ -2330,19 +2330,19 @@ discard block  | 
                                                    ||
| 2330 | 2330 | |
| 2331 | 2331 | |
| 2332 | 2332 | |
| 2333 | -	public function _contact_list_export(){ | 
                                                        |
| 2334 | - EE_Registry::instance()->load_helper( 'File' );  | 
                                                        |
| 2335 | -		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { | 
                                                        |
| 2336 | - require_once(EE_CLASSES . 'EE_Export.class.php');  | 
                                                        |
| 2333 | +	public function _contact_list_export() { | 
                                                        |
| 2334 | +		EE_Registry::instance()->load_helper('File'); | 
                                                        |
| 2335 | +		if (is_readable(EE_CLASSES.'EE_Export.class.php')) { | 
                                                        |
| 2336 | + require_once(EE_CLASSES.'EE_Export.class.php');  | 
                                                        |
| 2337 | 2337 | $EE_Export = EE_Export::instance($this->_req_data);  | 
                                                        
| 2338 | 2338 | $EE_Export->export_attendees();  | 
                                                        
| 2339 | 2339 | }  | 
                                                        
| 2340 | 2340 | }  | 
                                                        
| 2341 | 2341 | |
| 2342 | -	public function _contact_list_report(){ | 
                                                        |
| 2343 | - EE_Registry::instance()->load_helper( 'File' );  | 
                                                        |
| 2344 | -		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { | 
                                                        |
| 2345 | - require_once(EE_CLASSES . 'EE_Export.class.php');  | 
                                                        |
| 2342 | +	public function _contact_list_report() { | 
                                                        |
| 2343 | +		EE_Registry::instance()->load_helper('File'); | 
                                                        |
| 2344 | +		if (is_readable(EE_CLASSES.'EE_Export.class.php')) { | 
                                                        |
| 2345 | + require_once(EE_CLASSES.'EE_Export.class.php');  | 
                                                        |
| 2346 | 2346 | $EE_Export = EE_Export::instance($this->_req_data);  | 
                                                        
| 2347 | 2347 | $EE_Export->report_attendees();  | 
                                                        
| 2348 | 2348 | }  | 
                                                        
@@ -2361,73 +2361,73 @@ discard block  | 
                                                    ||
| 2361 | 2361 | * @return void  | 
                                                        
| 2362 | 2362 | */  | 
                                                        
| 2363 | 2363 |  	protected function _duplicate_attendee() { | 
                                                        
| 2364 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';  | 
                                                        |
| 2364 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';  | 
                                                        |
| 2365 | 2365 | //verify we have necessary info  | 
                                                        
| 2366 | -		if ( empty($this->_req_data['_REG_ID'] )  ) { | 
                                                        |
| 2367 | -			EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ ); | 
                                                        |
| 2368 | - $query_args = array( 'action' => $action );  | 
                                                        |
| 2366 | +		if (empty($this->_req_data['_REG_ID'])) { | 
                                                        |
| 2367 | +			EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); | 
                                                        |
| 2368 | +			$query_args = array('action' => $action); | 
                                                        |
| 2369 | 2369 |  			$this->_redirect_after_action('', '', '', $query_args, TRUE); | 
                                                        
| 2370 | 2370 | }  | 
                                                        
| 2371 | 2371 | |
| 2372 | 2372 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.  | 
                                                        
| 2373 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );  | 
                                                        |
| 2373 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);  | 
                                                        |
| 2374 | 2374 | $attendee = $registration->attendee();  | 
                                                        
| 2375 | 2375 | |
| 2376 | 2376 | //remove relation of existing attendee on registration  | 
                                                        
| 2377 | - $registration->_remove_relation_to($attendee, 'Attendee' );  | 
                                                        |
| 2377 | + $registration->_remove_relation_to($attendee, 'Attendee');  | 
                                                        |
| 2378 | 2378 | //new attendee  | 
                                                        
| 2379 | 2379 | $new_attendee = clone $attendee;  | 
                                                        
| 2380 | - $new_attendee->set( 'ATT_ID', 0 );  | 
                                                        |
| 2380 | +		$new_attendee->set('ATT_ID', 0); | 
                                                        |
| 2381 | 2381 | $new_attendee->save();  | 
                                                        
| 2382 | 2382 | |
| 2383 | 2383 | //add new attendee to reg  | 
                                                        
| 2384 | - $registration->_add_relation_to( $new_attendee, 'Attendee');  | 
                                                        |
| 2384 | + $registration->_add_relation_to($new_attendee, 'Attendee');  | 
                                                        |
| 2385 | 2385 | |
| 2386 | -		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') ); | 
                                                        |
| 2386 | +		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso')); | 
                                                        |
| 2387 | 2387 | |
| 2388 | 2388 | //redirect to edit page for attendee  | 
                                                        
| 2389 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );  | 
                                                        |
| 2389 | +		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); | 
                                                        |
| 2390 | 2390 | |
| 2391 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE );  | 
                                                        |
| 2391 | +		$this->_redirect_after_action('', '', '', $query_args, TRUE); | 
                                                        |
| 2392 | 2392 | }  | 
                                                        
| 2393 | 2393 | |
| 2394 | 2394 | |
| 2395 | 2395 | //related to cpt routes  | 
                                                        
| 2396 | 2396 |  	protected function _insert_update_cpt_item($post_id, $post) { | 
                                                        
| 2397 | 2397 | $success = true;  | 
                                                        
| 2398 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );  | 
                                                        |
| 2398 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);  | 
                                                        |
| 2399 | 2399 | //for attendee updates  | 
                                                        
| 2400 | -		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { | 
                                                        |
| 2400 | +		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { | 
                                                        |
| 2401 | 2401 | //note we should only be UPDATING attendees at this point.  | 
                                                        
| 2402 | 2402 | $updated_fields = array(  | 
                                                        
| 2403 | 2403 | 'ATT_fname' => $this->_req_data['ATT_fname'],  | 
                                                        
| 2404 | 2404 | 'ATT_lname' => $this->_req_data['ATT_lname'],  | 
                                                        
| 2405 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],  | 
                                                        |
| 2405 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],  | 
                                                        |
| 2406 | 2406 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',  | 
                                                        
| 2407 | 2407 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',  | 
                                                        
| 2408 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',  | 
                                                        |
| 2409 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',  | 
                                                        |
| 2410 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',  | 
                                                        |
| 2411 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',  | 
                                                        |
| 2412 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',  | 
                                                        |
| 2413 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''  | 
                                                        |
| 2408 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',  | 
                                                        |
| 2409 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',  | 
                                                        |
| 2410 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',  | 
                                                        |
| 2411 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',  | 
                                                        |
| 2412 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',  | 
                                                        |
| 2413 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''  | 
                                                        |
| 2414 | 2414 | );  | 
                                                        
| 2415 | -			foreach ( $updated_fields as $field => $value ) { | 
                                                        |
| 2415 | +			foreach ($updated_fields as $field => $value) { | 
                                                        |
| 2416 | 2416 | $attendee->set($field, $value);  | 
                                                        
| 2417 | 2417 | }  | 
                                                        
| 2418 | 2418 | |
| 2419 | 2419 | $success = $attendee->save();  | 
                                                        
| 2420 | 2420 | |
| 2421 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );  | 
                                                        |
| 2422 | -			foreach ( $attendee_update_callbacks as $a_callback ) { | 
                                                        |
| 2423 | -				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { | 
                                                        |
| 2424 | -					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) ); | 
                                                        |
| 2421 | +			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); | 
                                                        |
| 2422 | +			foreach ($attendee_update_callbacks as $a_callback) { | 
                                                        |
| 2423 | +				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { | 
                                                        |
| 2424 | +					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback)); | 
                                                        |
| 2425 | 2425 | }  | 
                                                        
| 2426 | 2426 | }  | 
                                                        
| 2427 | 2427 | }  | 
                                                        
| 2428 | 2428 | |
| 2429 | - if ( $success === FALSE )  | 
                                                        |
| 2430 | -			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 2429 | + if ($success === FALSE)  | 
                                                        |
| 2430 | +			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 2431 | 2431 | |
| 2432 | 2432 | }  | 
                                                        
| 2433 | 2433 | |
@@ -2447,17 +2447,17 @@ discard block  | 
                                                    ||
| 2447 | 2447 |  		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); | 
                                                        
| 2448 | 2448 |  		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); | 
                                                        
| 2449 | 2449 | |
| 2450 | -		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { | 
                                                        |
| 2451 | -			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); | 
                                                        |
| 2450 | +		if (post_type_supports('espresso_attendees', 'excerpt')) { | 
                                                        |
| 2451 | +			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); | 
                                                        |
| 2452 | 2452 | }  | 
                                                        
| 2453 | 2453 | |
| 2454 | -		if ( post_type_supports( 'espresso_attendees', 'comments') ) { | 
                                                        |
| 2454 | +		if (post_type_supports('espresso_attendees', 'comments')) { | 
                                                        |
| 2455 | 2455 |  			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); | 
                                                        
| 2456 | 2456 | }  | 
                                                        
| 2457 | 2457 | |
| 2458 | -		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); | 
                                                        |
| 2459 | -		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); | 
                                                        |
| 2460 | -		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); | 
                                                        |
| 2458 | +		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); | 
                                                        |
| 2459 | +		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); | 
                                                        |
| 2460 | +		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); | 
                                                        |
| 2461 | 2461 | }  | 
                                                        
| 2462 | 2462 | |
| 2463 | 2463 | |
@@ -2466,10 +2466,10 @@ discard block  | 
                                                    ||
| 2466 | 2466 | * @param WP_Post $post wp post object  | 
                                                        
| 2467 | 2467 | * @return string attendee contact info ( and form )  | 
                                                        
| 2468 | 2468 | */  | 
                                                        
| 2469 | -	public function attendee_contact_info( $post ) { | 
                                                        |
| 2469 | +	public function attendee_contact_info($post) { | 
                                                        |
| 2470 | 2470 | //get attendee object ( should already have it )  | 
                                                        
| 2471 | 2471 | $this->_template_args['attendee'] = $this->_cpt_model_obj;  | 
                                                        
| 2472 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';  | 
                                                        |
| 2472 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';  | 
                                                        |
| 2473 | 2473 | EEH_Template::display_template($template, $this->_template_args);  | 
                                                        
| 2474 | 2474 | }  | 
                                                        
| 2475 | 2475 | |
@@ -2485,12 +2485,12 @@ discard block  | 
                                                    ||
| 2485 | 2485 | $this->_template_args['attendee'] = $this->_cpt_model_obj;  | 
                                                        
| 2486 | 2486 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(  | 
                                                        
| 2487 | 2487 | new EE_Question_Form_Input(  | 
                                                        
| 2488 | - EE_Question::new_instance( array(  | 
                                                        |
| 2488 | + EE_Question::new_instance(array(  | 
                                                        |
| 2489 | 2489 | 'QST_ID' => 0,  | 
                                                        
| 2490 | 2490 |  					'QST_display_text' => __('State/Province', 'event_espresso'), | 
                                                        
| 2491 | 2491 | 'QST_system' => 'admin-state'  | 
                                                        
| 2492 | 2492 | )),  | 
                                                        
| 2493 | - EE_Answer::new_instance( array(  | 
                                                        |
| 2493 | + EE_Answer::new_instance(array(  | 
                                                        |
| 2494 | 2494 | 'ANS_ID' => 0,  | 
                                                        
| 2495 | 2495 | 'ANS_value' => $this->_cpt_model_obj->state_ID()  | 
                                                        
| 2496 | 2496 | )),  | 
                                                        
@@ -2503,12 +2503,12 @@ discard block  | 
                                                    ||
| 2503 | 2503 | ));  | 
                                                        
| 2504 | 2504 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(  | 
                                                        
| 2505 | 2505 | new EE_Question_Form_Input(  | 
                                                        
| 2506 | - EE_Question::new_instance( array(  | 
                                                        |
| 2506 | + EE_Question::new_instance(array(  | 
                                                        |
| 2507 | 2507 | 'QST_ID' => 0,  | 
                                                        
| 2508 | 2508 |  					'QST_display_text' => __('Country', 'event_espresso'), | 
                                                        
| 2509 | 2509 | 'QST_system' => 'admin-country'  | 
                                                        
| 2510 | 2510 | )),  | 
                                                        
| 2511 | - EE_Answer::new_instance( array(  | 
                                                        |
| 2511 | + EE_Answer::new_instance(array(  | 
                                                        |
| 2512 | 2512 | 'ANS_ID' => 0,  | 
                                                        
| 2513 | 2513 | 'ANS_value' => $this->_cpt_model_obj->country_ID()  | 
                                                        
| 2514 | 2514 | )),  | 
                                                        
@@ -2519,8 +2519,8 @@ discard block  | 
                                                    ||
| 2519 | 2519 | 'append_qstn_id' => FALSE  | 
                                                        
| 2520 | 2520 | )  | 
                                                        
| 2521 | 2521 | ));  | 
                                                        
| 2522 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';  | 
                                                        |
| 2523 | - EEH_Template::display_template($template, $this->_template_args );  | 
                                                        |
| 2522 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';  | 
                                                        |
| 2523 | + EEH_Template::display_template($template, $this->_template_args);  | 
                                                        |
| 2524 | 2524 | |
| 2525 | 2525 | }  | 
                                                        
| 2526 | 2526 | |
@@ -2530,11 +2530,11 @@ discard block  | 
                                                    ||
| 2530 | 2530 | * @access protected  | 
                                                        
| 2531 | 2531 | * @return void  | 
                                                        
| 2532 | 2532 | */  | 
                                                        
| 2533 | -	public function attendee_registrations_meta_box( $post ) { | 
                                                        |
| 2533 | +	public function attendee_registrations_meta_box($post) { | 
                                                        |
| 2534 | 2534 | |
| 2535 | 2535 | $this->_template_args['attendee'] = $this->_cpt_model_obj;  | 
                                                        
| 2536 | 2536 |  		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); | 
                                                        
| 2537 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';  | 
                                                        |
| 2537 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';  | 
                                                        |
| 2538 | 2538 | EEH_Template::display_template($template, $this->_template_args);  | 
                                                        
| 2539 | 2539 | |
| 2540 | 2540 | }  | 
                                                        
@@ -2548,8 +2548,8 @@ discard block  | 
                                                    ||
| 2548 | 2548 | * @return string html for new form.  | 
                                                        
| 2549 | 2549 | */  | 
                                                        
| 2550 | 2550 |  	public function after_title_form_fields($post) { | 
                                                        
| 2551 | -		if ( $post->post_type == 'espresso_attendees' ) { | 
                                                        |
| 2552 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';  | 
                                                        |
| 2551 | +		if ($post->post_type == 'espresso_attendees') { | 
                                                        |
| 2552 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';  | 
                                                        |
| 2553 | 2553 | $template_args['attendee'] = $this->_cpt_model_obj;  | 
                                                        
| 2554 | 2554 | EEH_Template::display_template($template, $template_args);  | 
                                                        
| 2555 | 2555 | }  | 
                                                        
@@ -2566,21 +2566,21 @@ discard block  | 
                                                    ||
| 2566 | 2566 | * @access protected  | 
                                                        
| 2567 | 2567 | * @return void  | 
                                                        
| 2568 | 2568 | */  | 
                                                        
| 2569 | -	protected function _trash_or_restore_attendees( $trash = TRUE ) { | 
                                                        |
| 2569 | +	protected function _trash_or_restore_attendees($trash = TRUE) { | 
                                                        |
| 2570 | 2570 | |
| 2571 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 2571 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 2572 | 2572 | |
| 2573 | 2573 | $ATT_MDL = EEM_Attendee::instance();  | 
                                                        
| 2574 | 2574 | |
| 2575 | 2575 | $success = 1;  | 
                                                        
| 2576 | 2576 | //Checkboxes  | 
                                                        
| 2577 | -		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 2577 | +		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 2578 | 2578 | // if array has more than one element than success message should be plural  | 
                                                        
| 2579 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;  | 
                                                        |
| 2579 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;  | 
                                                        |
| 2580 | 2580 | // cycle thru checkboxes  | 
                                                        
| 2581 | -			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 2582 | -				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); | 
                                                        |
| 2583 | -				if ( !$updated ) { | 
                                                        |
| 2581 | +			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 2582 | +				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); | 
                                                        |
| 2583 | +				if ( ! $updated) { | 
                                                        |
| 2584 | 2584 | $success = 0;  | 
                                                        
| 2585 | 2585 | }  | 
                                                        
| 2586 | 2586 | }  | 
                                                        
@@ -2589,18 +2589,18 @@ discard block  | 
                                                    ||
| 2589 | 2589 | // grab single id and delete  | 
                                                        
| 2590 | 2590 | $ATT_ID = absint($this->_req_data['ATT_ID']);  | 
                                                        
| 2591 | 2591 | //get attendee  | 
                                                        
| 2592 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID );  | 
                                                        |
| 2592 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID);  | 
                                                        |
| 2593 | 2593 |  			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); | 
                                                        
| 2594 | 2594 | $updated = $att->save();  | 
                                                        
| 2595 | -			if ( ! $updated ) { | 
                                                        |
| 2595 | +			if ( ! $updated) { | 
                                                        |
| 2596 | 2596 | $success = 0;  | 
                                                        
| 2597 | 2597 | }  | 
                                                        
| 2598 | 2598 | |
| 2599 | 2599 | }  | 
                                                        
| 2600 | 2600 | |
| 2601 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );  | 
                                                        |
| 2602 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );  | 
                                                        |
| 2603 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );  | 
                                                        |
| 2601 | +		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); | 
                                                        |
| 2602 | +		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); | 
                                                        |
| 2603 | +		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); | 
                                                        |
| 2604 | 2604 | |
| 2605 | 2605 | }  | 
                                                        
| 2606 | 2606 | |
@@ -93,7 +93,7 @@  | 
                                                    ||
| 93 | 93 | *  | 
                                                        
| 94 | 94 | * @abstract  | 
                                                        
| 95 | 95 | * @access protected  | 
                                                        
| 96 | - * @return array  | 
                                                        |
| 96 | + * @return string[]  | 
                                                        |
| 97 | 97 | */  | 
                                                        
| 98 | 98 |  	protected function _get_table_filters() { | 
                                                        
| 99 | 99 | $filters = array();  | 
                                                        
@@ -1,4 +1,6 @@ discard block  | 
                                                    ||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); | 
                                                        |
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        |
| 2 | +	exit('No direct script access allowed'); | 
                                                        |
| 3 | +}  | 
                                                        |
| 2 | 4 | /**  | 
                                                        
| 3 | 5 | * Event Espresso  | 
                                                        
| 4 | 6 | *  | 
                                                        
@@ -244,10 +246,11 @@ discard block  | 
                                                    ||
| 244 | 246 | */  | 
                                                        
| 245 | 247 |  	function column_ATT_email( EE_Transaction $item ){ | 
                                                        
| 246 | 248 |  		$attendee = $item->primary_registration()->get_first_related('Attendee'); | 
                                                        
| 247 | - if ( !empty( $attendee ) )  | 
                                                        |
| 248 | -			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; | 
                                                        |
| 249 | - else  | 
                                                        |
| 250 | -			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); | 
                                                        |
| 249 | +		if ( !empty( $attendee ) ) { | 
                                                        |
| 250 | +					return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; | 
                                                        |
| 251 | +		} else { | 
                                                        |
| 252 | +					return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); | 
                                                        |
| 253 | + }  | 
                                                        |
| 251 | 254 | ;  | 
                                                        
| 252 | 255 | }  | 
                                                        
| 253 | 256 | |
@@ -33,8 +33,8 @@ discard block  | 
                                                    ||
| 33 | 33 | * @param \EE_Admin_Page $admin_page  | 
                                                        
| 34 | 34 | * @return EE_Admin_Transactions_List_Table  | 
                                                        
| 35 | 35 | */  | 
                                                        
| 36 | -	function __construct( EE_Admin_Page $admin_page ){ | 
                                                        |
| 37 | - parent::__construct( $admin_page );  | 
                                                        |
| 36 | +	function __construct(EE_Admin_Page $admin_page) { | 
                                                        |
| 37 | + parent::__construct($admin_page);  | 
                                                        |
| 38 | 38 | $this->_status = $this->_admin_page->get_transaction_status_array();  | 
                                                        
| 39 | 39 | |
| 40 | 40 | }  | 
                                                        
@@ -44,9 +44,9 @@ discard block  | 
                                                    ||
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 |  	protected function _setup_data() { | 
                                                        
| 47 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page );  | 
                                                        |
| 48 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';  | 
                                                        |
| 49 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );  | 
                                                        |
| 47 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page);  | 
                                                        |
| 48 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';  | 
                                                        |
| 49 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);  | 
                                                        |
| 50 | 50 | }  | 
                                                        
| 51 | 51 | |
| 52 | 52 | |
@@ -65,20 +65,20 @@ discard block  | 
                                                    ||
| 65 | 65 | );  | 
                                                        
| 66 | 66 | |
| 67 | 67 | $this->_columns = array(  | 
                                                        
| 68 | - 'TXN_ID' => __( 'ID', 'event_espresso' ),  | 
                                                        |
| 69 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ),  | 
                                                        |
| 70 | - 'TXN_total' => __( 'Total', 'event_espresso' ),  | 
                                                        |
| 71 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ),  | 
                                                        |
| 72 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),  | 
                                                        |
| 73 | - 'event_name' => __( 'Event', 'event_espresso' ),  | 
                                                        |
| 74 | - 'actions' => __( 'Actions', 'event_espresso' )  | 
                                                        |
| 68 | +			'TXN_ID' => __('ID', 'event_espresso'), | 
                                                        |
| 69 | +			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'), | 
                                                        |
| 70 | +			'TXN_total' => __('Total', 'event_espresso'), | 
                                                        |
| 71 | +			'TXN_paid' => __('Paid', 'event_espresso'), | 
                                                        |
| 72 | +			'ATT_fname' => __('Primary Registrant', 'event_espresso'), | 
                                                        |
| 73 | +			'event_name' => __('Event', 'event_espresso'), | 
                                                        |
| 74 | +			'actions' => __('Actions', 'event_espresso') | 
                                                        |
| 75 | 75 | );  | 
                                                        
| 76 | 76 | |
| 77 | 77 | $this->_sortable_columns = array(  | 
                                                        
| 78 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ),  | 
                                                        |
| 79 | - 'event_name' => array( 'event_name'=> FALSE ),  | 
                                                        |
| 80 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ),  | 
                                                        |
| 81 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted  | 
                                                        |
| 78 | +			'TXN_ID' => array('TXN_ID' => FALSE), | 
                                                        |
| 79 | +			'event_name' => array('event_name'=> FALSE), | 
                                                        |
| 80 | +			'ATT_fname'	=> array('ATT_fname'=> FALSE), | 
                                                        |
| 81 | +			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted | 
                                                        |
| 82 | 82 | );  | 
                                                        
| 83 | 83 | |
| 84 | 84 | $this->_primary_column = 'TXN_ID';  | 
                                                        
@@ -88,11 +88,11 @@ discard block  | 
                                                    ||
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | |
| 91 | -	protected function _get_row_class( $item ) { | 
                                                        |
| 92 | - $class = parent::_get_row_class( $item );  | 
                                                        |
| 91 | +	protected function _get_row_class($item) { | 
                                                        |
| 92 | + $class = parent::_get_row_class($item);  | 
                                                        |
| 93 | 93 | //add status class  | 
                                                        
| 94 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID();  | 
                                                        |
| 95 | -		if ( $this->_has_checkbox_column ) { | 
                                                        |
| 94 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID();  | 
                                                        |
| 95 | +		if ($this->_has_checkbox_column) { | 
                                                        |
| 96 | 96 | $class .= ' has-checkbox-column';  | 
                                                        
| 97 | 97 | }  | 
                                                        
| 98 | 98 | return $class;  | 
                                                        
@@ -109,8 +109,8 @@ discard block  | 
                                                    ||
| 109 | 109 | */  | 
                                                        
| 110 | 110 |  	protected function _get_table_filters() { | 
                                                        
| 111 | 111 | $filters = array();  | 
                                                        
| 112 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));  | 
                                                        |
| 113 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );  | 
                                                        |
| 112 | +		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); | 
                                                        |
| 113 | +		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); | 
                                                        |
| 114 | 114 | ob_start();  | 
                                                        
| 115 | 115 | ?>  | 
                                                        
| 116 | 116 | <label for="txn-filter-start-date">Display Transactions from </label>  | 
                                                        
@@ -128,9 +128,9 @@ discard block  | 
                                                    ||
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 |  	protected function _add_view_counts() { | 
                                                        
| 131 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );  | 
                                                        |
| 132 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );  | 
                                                        |
| 133 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );  | 
                                                        |
| 131 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');  | 
                                                        |
| 132 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');  | 
                                                        |
| 133 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');  | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | 135 | |
| 136 | 136 | |
@@ -139,29 +139,29 @@ discard block  | 
                                                    ||
| 139 | 139 | * @param \EE_Transaction $item  | 
                                                        
| 140 | 140 | * @return string  | 
                                                        
| 141 | 141 | */  | 
                                                        
| 142 | -   function column_TXN_ID( EE_Transaction $item ){ | 
                                                        |
| 143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 144 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';  | 
                                                        |
| 142 | +   function column_TXN_ID(EE_Transaction $item) { | 
                                                        |
| 143 | +    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); | 
                                                        |
| 144 | +	   $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; | 
                                                        |
| 145 | 145 | |
| 146 | 146 | //txn timestamp  | 
                                                        
| 147 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>';  | 
                                                        |
| 147 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';  | 
                                                        |
| 148 | 148 | return $content;  | 
                                                        
| 149 | 149 | }  | 
                                                        
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | |
| 153 | -	protected function _get_txn_timestamp( EE_Transaction $item ) { | 
                                                        |
| 153 | +	protected function _get_txn_timestamp(EE_Transaction $item) { | 
                                                        |
| 154 | 154 | //txn timestamp  | 
                                                        
| 155 | 155 | // is TXN less than 2 hours old ?  | 
                                                        
| 156 | 156 | if (  | 
                                                        
| 157 | - ( ( time() - EE_Registry::instance()->SSN->lifespan() )  | 
                                                        |
| 158 | - < $item->datetime( false, true )  | 
                                                        |
| 157 | + ((time() - EE_Registry::instance()->SSN->lifespan())  | 
                                                        |
| 158 | + < $item->datetime(false, true)  | 
                                                        |
| 159 | 159 | )  | 
                                                        
| 160 | - && ( $item->failed() || $item->is_abandoned() )  | 
                                                        |
| 160 | + && ($item->failed() || $item->is_abandoned())  | 
                                                        |
| 161 | 161 |  		) { | 
                                                        
| 162 | - $timestamp = __( 'TXN in progress...', 'event_espresso' );  | 
                                                        |
| 162 | +			$timestamp = __('TXN in progress...', 'event_espresso'); | 
                                                        |
| 163 | 163 |  	   } else { | 
                                                        
| 164 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' );  | 
                                                        |
| 164 | +			$timestamp = $item->get_i18n_datetime('TXN_timestamp'); | 
                                                        |
| 165 | 165 | }  | 
                                                        
| 166 | 166 | return $timestamp;  | 
                                                        
| 167 | 167 | }  | 
                                                        
@@ -173,8 +173,8 @@ discard block  | 
                                                    ||
| 173 | 173 | * @param \EE_Transaction $item  | 
                                                        
| 174 | 174 | * @return string  | 
                                                        
| 175 | 175 | */  | 
                                                        
| 176 | -	function column_cb($item ){ | 
                                                        |
| 177 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());  | 
                                                        |
| 176 | +	function column_cb($item) { | 
                                                        |
| 177 | +		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); | 
                                                        |
| 178 | 178 | }  | 
                                                        
| 179 | 179 | |
| 180 | 180 | |
@@ -185,11 +185,11 @@ discard block  | 
                                                    ||
| 185 | 185 | * @param \EE_Transaction $item  | 
                                                        
| 186 | 186 | * @return string  | 
                                                        
| 187 | 187 | */  | 
                                                        
| 188 | -	function column_TXN_timestamp( EE_Transaction $item ){ | 
                                                        |
| 189 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 190 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>';  | 
                                                        |
| 188 | +	function column_TXN_timestamp(EE_Transaction $item) { | 
                                                        |
| 189 | +		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); | 
                                                        |
| 190 | +		$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; | 
                                                        |
| 191 | 191 | //status  | 
                                                        
| 192 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';  | 
                                                        |
| 192 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';  | 
                                                        |
| 193 | 193 | return $txn_date;  | 
                                                        
| 194 | 194 | }  | 
                                                        
| 195 | 195 | |
@@ -199,11 +199,11 @@ discard block  | 
                                                    ||
| 199 | 199 | * @param \EE_Transaction $item  | 
                                                        
| 200 | 200 | * @return string  | 
                                                        
| 201 | 201 | */  | 
                                                        
| 202 | -	function column_TXN_total( EE_Transaction $item ){ | 
                                                        |
| 203 | -		if ( $item->get('TXN_total') > 0 ) { | 
                                                        |
| 204 | -			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; | 
                                                        |
| 202 | +	function column_TXN_total(EE_Transaction $item) { | 
                                                        |
| 203 | +		if ($item->get('TXN_total') > 0) { | 
                                                        |
| 204 | +			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; | 
                                                        |
| 205 | 205 |  		} else { | 
                                                        
| 206 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';  | 
                                                        |
| 206 | +			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; | 
                                                        |
| 207 | 207 | }  | 
                                                        
| 208 | 208 | }  | 
                                                        
| 209 | 209 | |
@@ -213,19 +213,19 @@ discard block  | 
                                                    ||
| 213 | 213 | * @param \EE_Transaction $item  | 
                                                        
| 214 | 214 | * @return mixed|string  | 
                                                        
| 215 | 215 | */  | 
                                                        
| 216 | -	function column_TXN_paid( EE_Transaction $item ){ | 
                                                        |
| 216 | +	function column_TXN_paid(EE_Transaction $item) { | 
                                                        |
| 217 | 217 |  		$transaction_total = $item->get('TXN_total'); | 
                                                        
| 218 | 218 |  		$transaction_paid = $item->get('TXN_paid'); | 
                                                        
| 219 | 219 | |
| 220 | -		if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) { | 
                                                        |
| 220 | +		if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) { | 
                                                        |
| 221 | 221 | // paid in full  | 
                                                        
| 222 | 222 | $span_class = 'txn-overview-full-payment-spn';  | 
                                                        
| 223 | 223 | |
| 224 | -		} elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) { | 
                                                        |
| 224 | +		} elseif (($transaction_total > 0) && ($transaction_paid > 0)) { | 
                                                        |
| 225 | 225 | // monies owing  | 
                                                        
| 226 | 226 | $span_class = 'txn-overview-part-payment-spn';  | 
                                                        
| 227 | 227 | |
| 228 | -		} elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) { | 
                                                        |
| 228 | +		} elseif (($transaction_total > 0) && ($transaction_paid == 0)) { | 
                                                        |
| 229 | 229 | // no payments made  | 
                                                        
| 230 | 230 | $span_class = 'txn-overview-no-payment-spn';  | 
                                                        
| 231 | 231 | |
@@ -235,11 +235,11 @@ discard block  | 
                                                    ||
| 235 | 235 | }  | 
                                                        
| 236 | 236 | |
| 237 | 237 | $payment_method = $item->payment_method();  | 
                                                        
| 238 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );  | 
                                                        |
| 238 | +		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); | 
                                                        |
| 239 | 239 | |
| 240 | -		$content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; | 
                                                        |
| 241 | -		if ( $transaction_paid > 0 ) { | 
                                                        |
| 242 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';  | 
                                                        |
| 240 | +		$content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; | 
                                                        |
| 241 | +		if ($transaction_paid > 0) { | 
                                                        |
| 242 | +			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; | 
                                                        |
| 243 | 243 | }  | 
                                                        
| 244 | 244 | return $content;  | 
                                                        
| 245 | 245 | }  | 
                                                        
@@ -250,13 +250,13 @@ discard block  | 
                                                    ||
| 250 | 250 | * @param \EE_Transaction $item  | 
                                                        
| 251 | 251 | * @return string|void  | 
                                                        
| 252 | 252 | */  | 
                                                        
| 253 | -	function column_ATT_fname( EE_Transaction $item ){ | 
                                                        |
| 253 | +	function column_ATT_fname(EE_Transaction $item) { | 
                                                        |
| 254 | 254 | $primary_reg = $item->primary_registration();  | 
                                                        
| 255 | 255 |  		$attendee = $primary_reg->get_first_related('Attendee'); | 
                                                        
| 256 | -		if ( $attendee instanceof EE_Attendee ) { | 
                                                        |
| 257 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 258 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();  | 
                                                        |
| 259 | - $content .= '<br>' . $attendee->email();  | 
                                                        |
| 256 | +		if ($attendee instanceof EE_Attendee) { | 
                                                        |
| 257 | +			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); | 
                                                        |
| 258 | +			$content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); | 
                                                        |
| 259 | + $content .= '<br>'.$attendee->email();  | 
                                                        |
| 260 | 260 | return $content;  | 
                                                        
| 261 | 261 | }  | 
                                                        
| 262 | 262 |  		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); | 
                                                        
@@ -268,10 +268,10 @@ discard block  | 
                                                    ||
| 268 | 268 | * @param \EE_Transaction $item  | 
                                                        
| 269 | 269 | * @return string|void  | 
                                                        
| 270 | 270 | */  | 
                                                        
| 271 | -	function column_ATT_email( EE_Transaction $item ){ | 
                                                        |
| 271 | +	function column_ATT_email(EE_Transaction $item) { | 
                                                        |
| 272 | 272 |  		$attendee = $item->primary_registration()->get_first_related('Attendee'); | 
                                                        
| 273 | - if ( !empty( $attendee ) )  | 
                                                        |
| 274 | -			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; | 
                                                        |
| 273 | + if ( ! empty($attendee))  | 
                                                        |
| 274 | +			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; | 
                                                        |
| 275 | 275 | else  | 
                                                        
| 276 | 276 |  			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); | 
                                                        
| 277 | 277 | ;  | 
                                                        
@@ -283,20 +283,20 @@ discard block  | 
                                                    ||
| 283 | 283 | * @param \EE_Transaction $item  | 
                                                        
| 284 | 284 | * @return string|void  | 
                                                        
| 285 | 285 | */  | 
                                                        
| 286 | -    function column_event_name( EE_Transaction $item ){ | 
                                                        |
| 286 | +    function column_event_name(EE_Transaction $item) { | 
                                                        |
| 287 | 287 | $actions = array();  | 
                                                        
| 288 | 288 |  		$event = $item->primary_registration()->get_first_related('Event'); | 
                                                        
| 289 | -		if ( !empty( $event ) ) { | 
                                                        |
| 290 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );  | 
                                                        |
| 289 | +		if ( ! empty($event)) { | 
                                                        |
| 290 | +			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); | 
                                                        |
| 291 | 291 |  			$event_name = $event->get('EVT_name'); | 
                                                        
| 292 | 292 | |
| 293 | 293 | //filter this view by transactions for this event  | 
                                                        
| 294 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );  | 
                                                        |
| 295 | -			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { | 
                                                        |
| 296 | -				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; | 
                                                        |
| 294 | +			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); | 
                                                        |
| 295 | +			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { | 
                                                        |
| 296 | +				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; | 
                                                        |
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
| 299 | -			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); | 
                                                        |
| 299 | +			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); | 
                                                        |
| 300 | 300 |  		} else { | 
                                                        
| 301 | 301 |  			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); | 
                                                        
| 302 | 302 | }  | 
                                                        
@@ -308,33 +308,33 @@ discard block  | 
                                                    ||
| 308 | 308 | * @param \EE_Transaction $item  | 
                                                        
| 309 | 309 | * @return string  | 
                                                        
| 310 | 310 | */  | 
                                                        
| 311 | -    function column_actions( EE_Transaction $item ){ | 
                                                        |
| 311 | +    function column_actions(EE_Transaction $item) { | 
                                                        |
| 312 | 312 | |
| 313 | 313 | $registration = $item->primary_registration();  | 
                                                        
| 314 | 314 | $attendee = $registration->attendee();  | 
                                                        
| 315 | - EE_Registry::instance()->load_helper( 'MSG_Template' );  | 
                                                        |
| 315 | +		EE_Registry::instance()->load_helper('MSG_Template'); | 
                                                        |
| 316 | 316 | |
| 317 | 317 | //Build row actions  | 
                                                        
| 318 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 318 | +		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); | 
                                                        |
| 319 | 319 | $dl_invoice_lnk_url = $registration->invoice_url();  | 
                                                        
| 320 | 320 | $dl_receipt_lnk_url = $registration->receipt_url();  | 
                                                        
| 321 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );  | 
                                                        |
| 322 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 321 | +		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); | 
                                                        |
| 322 | +		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); | 
                                                        |
| 323 | 323 | |
| 324 | 324 | //Build row actions  | 
                                                        
| 325 | 325 | $view_lnk = '  | 
                                                        
| 326 | 326 | <li>  | 
                                                        
| 327 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">  | 
                                                        |
| 327 | +				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> | 
                                                        |
| 328 | 328 | <span class="dashicons dashicons-cart"></span>  | 
                                                        
| 329 | 329 | </a>  | 
                                                        
| 330 | 330 | </li>';  | 
                                                        
| 331 | 331 | |
| 332 | 332 | |
| 333 | 333 | //only show invoice link if message type is active.  | 
                                                        
| 334 | -	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { | 
                                                        |
| 334 | +	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { | 
                                                        |
| 335 | 335 | $dl_invoice_lnk = '  | 
                                                        
| 336 | 336 | <li>  | 
                                                        
| 337 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">  | 
                                                        |
| 337 | +			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> | 
                                                        |
| 338 | 338 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>  | 
                                                        
| 339 | 339 | </a>  | 
                                                        
| 340 | 340 | </li>';  | 
                                                        
@@ -343,10 +343,10 @@ discard block  | 
                                                    ||
| 343 | 343 | }  | 
                                                        
| 344 | 344 | |
| 345 | 345 | //only show receipt link if message type is active.  | 
                                                        
| 346 | -	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { | 
                                                        |
| 346 | +	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { | 
                                                        |
| 347 | 347 | $dl_receipt_lnk = '  | 
                                                        
| 348 | 348 | <li>  | 
                                                        
| 349 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">  | 
                                                        |
| 349 | +			<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> | 
                                                        |
| 350 | 350 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span>  | 
                                                        
| 351 | 351 | </a>  | 
                                                        
| 352 | 352 | </li>';  | 
                                                        
@@ -355,10 +355,10 @@ discard block  | 
                                                    ||
| 355 | 355 | }  | 
                                                        
| 356 | 356 | |
| 357 | 357 | //only show payment reminder link if the message type is active.  | 
                                                        
| 358 | -      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { | 
                                                        |
| 359 | - $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '  | 
                                                        |
| 358 | +      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) { | 
                                                        |
| 359 | +		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? ' | 
                                                        |
| 360 | 360 | <li>  | 
                                                        
| 361 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">  | 
                                                        |
| 361 | +				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> | 
                                                        |
| 362 | 362 | <span class="dashicons dashicons-email-alt"></span>  | 
                                                        
| 363 | 363 | </a>  | 
                                                        
| 364 | 364 | </li>' : '';  | 
                                                        
@@ -367,14 +367,14 @@ discard block  | 
                                                    ||
| 367 | 367 | $send_pay_lnk = '';  | 
                                                        
| 368 | 368 | }  | 
                                                        
| 369 | 369 | |
| 370 | - $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '  | 
                                                        |
| 370 | +		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' | 
                                                        |
| 371 | 371 | <li>  | 
                                                        
| 372 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">  | 
                                                        |
| 372 | +				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> | 
                                                        |
| 373 | 373 | <span class="dashicons dashicons-clipboard"></span>  | 
                                                        
| 374 | 374 | </a>  | 
                                                        
| 375 | 375 | </li>' : '';  | 
                                                        
| 376 | 376 | |
| 377 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );  | 
                                                        |
| 377 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul');  | 
                                                        |
| 378 | 378 | }  | 
                                                        
| 379 | 379 | |
| 380 | 380 | |
@@ -1,26 +1,26 @@ discard block  | 
                                                    ||
| 1 | 1 |  <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * Event Espresso  | 
                                                        |
| 4 | - *  | 
                                                        |
| 5 | - * Event Registration and Management Plugin for WordPress  | 
                                                        |
| 6 | - *  | 
                                                        |
| 7 | - * @ package Event Espresso  | 
                                                        |
| 8 | - * @ author Seth Shoultes  | 
                                                        |
| 9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved.  | 
                                                        |
| 10 | - * @ license	{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing * | 
                                                        |
| 11 | - * @ link		{@link http://www.eventespresso.com} | 
                                                        |
| 12 | - * @ since 4.0  | 
                                                        |
| 13 | - *  | 
                                                        |
| 14 | - * ------------------------------------------------------------------------  | 
                                                        |
| 15 | - *  | 
                                                        |
| 16 | - * Transactions Table class  | 
                                                        |
| 17 | - *  | 
                                                        |
| 18 | - * @package Event Espresso  | 
                                                        |
| 19 | - * @subpackage includes/admin_screens/Transactions_List_Table.class.php  | 
                                                        |
| 20 | - * @author Brent Christensen  | 
                                                        |
| 21 | - *  | 
                                                        |
| 22 | - * ------------------------------------------------------------------------  | 
                                                        |
| 23 | - */  | 
                                                        |
| 3 | + * Event Espresso  | 
                                                        |
| 4 | + *  | 
                                                        |
| 5 | + * Event Registration and Management Plugin for WordPress  | 
                                                        |
| 6 | + *  | 
                                                        |
| 7 | + * @ package Event Espresso  | 
                                                        |
| 8 | + * @ author Seth Shoultes  | 
                                                        |
| 9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved.  | 
                                                        |
| 10 | +						 * @ license	{@link http://eventespresso.com/support/terms-conditions/}   * see Plugin Licensing * | 
                                                        |
| 11 | +						 * @ link		{@link http://www.eventespresso.com} | 
                                                        |
| 12 | + * @ since 4.0  | 
                                                        |
| 13 | + *  | 
                                                        |
| 14 | + * ------------------------------------------------------------------------  | 
                                                        |
| 15 | + *  | 
                                                        |
| 16 | + * Transactions Table class  | 
                                                        |
| 17 | + *  | 
                                                        |
| 18 | + * @package Event Espresso  | 
                                                        |
| 19 | + * @subpackage includes/admin_screens/Transactions_List_Table.class.php  | 
                                                        |
| 20 | + * @author Brent Christensen  | 
                                                        |
| 21 | + *  | 
                                                        |
| 22 | + * ------------------------------------------------------------------------  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 |  class EE_Admin_Transactions_List_Table extends EE_Admin_List_Table { | 
                                                        
@@ -140,7 +140,7 @@ discard block  | 
                                                    ||
| 140 | 140 | * @return string  | 
                                                        
| 141 | 141 | */  | 
                                                        
| 142 | 142 |     function column_TXN_ID( EE_Transaction $item ){ | 
                                                        
| 143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );  | 
                                                        |
| 144 | 144 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';  | 
                                                        
| 145 | 145 | |
| 146 | 146 | //txn timestamp  | 
                                                        
@@ -283,8 +283,8 @@ discard block  | 
                                                    ||
| 283 | 283 | * @param \EE_Transaction $item  | 
                                                        
| 284 | 284 | * @return string|void  | 
                                                        
| 285 | 285 | */  | 
                                                        
| 286 | -    function column_event_name( EE_Transaction $item ){ | 
                                                        |
| 287 | - $actions = array();  | 
                                                        |
| 286 | +	function column_event_name( EE_Transaction $item ){ | 
                                                        |
| 287 | + $actions = array();  | 
                                                        |
| 288 | 288 |  		$event = $item->primary_registration()->get_first_related('Event'); | 
                                                        
| 289 | 289 |  		if ( !empty( $event ) ) { | 
                                                        
| 290 | 290 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );  | 
                                                        
@@ -308,13 +308,13 @@ discard block  | 
                                                    ||
| 308 | 308 | * @param \EE_Transaction $item  | 
                                                        
| 309 | 309 | * @return string  | 
                                                        
| 310 | 310 | */  | 
                                                        
| 311 | -    function column_actions( EE_Transaction $item ){ | 
                                                        |
| 311 | +	function column_actions( EE_Transaction $item ){ | 
                                                        |
| 312 | 312 | |
| 313 | - $registration = $item->primary_registration();  | 
                                                        |
| 314 | - $attendee = $registration->attendee();  | 
                                                        |
| 313 | + $registration = $item->primary_registration();  | 
                                                        |
| 314 | + $attendee = $registration->attendee();  | 
                                                        |
| 315 | 315 | EE_Registry::instance()->load_helper( 'MSG_Template' );  | 
                                                        
| 316 | 316 | |
| 317 | - //Build row actions  | 
                                                        |
| 317 | + //Build row actions  | 
                                                        |
| 318 | 318 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );  | 
                                                        
| 319 | 319 | $dl_invoice_lnk_url = $registration->invoice_url();  | 
                                                        
| 320 | 320 | $dl_receipt_lnk_url = $registration->receipt_url();  | 
                                                        
@@ -354,8 +354,8 @@ discard block  | 
                                                    ||
| 354 | 354 | $dl_receipt_lnk = '';  | 
                                                        
| 355 | 355 | }  | 
                                                        
| 356 | 356 | |
| 357 | - //only show payment reminder link if the message type is active.  | 
                                                        |
| 358 | -      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { | 
                                                        |
| 357 | + //only show payment reminder link if the message type is active.  | 
                                                        |
| 358 | +	  		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { | 
                                                        |
| 359 | 359 | $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '  | 
                                                        
| 360 | 360 | <li>  | 
                                                        
| 361 | 361 | <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">  | 
                                                        
@@ -375,7 +375,7 @@ discard block  | 
                                                    ||
| 375 | 375 | </li>' : '';  | 
                                                        
| 376 | 376 | |
| 377 | 377 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );  | 
                                                        
| 378 | - }  | 
                                                        |
| 378 | + }  | 
                                                        |
| 379 | 379 | |
| 380 | 380 | |
| 381 | 381 | }  | 
                                                        
@@ -94,7 +94,7 @@  | 
                                                    ||
| 94 | 94 | * Handles attaching Message Templates to the Event on save.  | 
                                                        
| 95 | 95 | * @param EE_Event $evtobj EE event object  | 
                                                        
| 96 | 96 | * @param array $data The request data from the form  | 
                                                        
| 97 | - * @return bool success or fail  | 
                                                        |
| 97 | + * @return integer success or fail  | 
                                                        |
| 98 | 98 | */  | 
                                                        
| 99 | 99 |  	public function attach_evt_message_templates( $evtobj, $data ) { | 
                                                        
| 100 | 100 | //first we remove all existing relations on the Event for message types.  | 
                                                        
@@ -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 | /**  | 
                                                        
@@ -30,15 +30,15 @@ discard block  | 
                                                    ||
| 30 | 30 |  class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks { | 
                                                        
| 31 | 31 | |
| 32 | 32 | |
| 33 | -	public function __construct( EE_Admin_Page $adminpage ) { | 
                                                        |
| 33 | +	public function __construct(EE_Admin_Page $adminpage) { | 
                                                        |
| 34 | 34 | /**  | 
                                                        
| 35 | 35 | * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages  | 
                                                        
| 36 | 36 | */  | 
                                                        
| 37 | -		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) { | 
                                                        |
| 37 | +		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) { | 
                                                        |
| 38 | 38 | return;  | 
                                                        
| 39 | 39 | }  | 
                                                        
| 40 | -		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); | 
                                                        |
| 41 | - parent::__construct( $adminpage );  | 
                                                        |
| 40 | +		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); | 
                                                        |
| 41 | + parent::__construct($adminpage);  | 
                                                        |
| 42 | 42 | }  | 
                                                        
| 43 | 43 | |
| 44 | 44 | /**  | 
                                                        
@@ -49,13 +49,13 @@ discard block  | 
                                                    ||
| 49 | 49 | */  | 
                                                        
| 50 | 50 |  	protected function _extend_properties() { | 
                                                        
| 51 | 51 | |
| 52 | - define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );  | 
                                                        |
| 52 | +		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); | 
                                                        |
| 53 | 53 | $this->_ajax_func = array(  | 
                                                        
| 54 | 54 | 'ee_msgs_create_new_custom' => 'create_new_custom'  | 
                                                        
| 55 | 55 | );  | 
                                                        
| 56 | 56 | $this->_metaboxes = array(  | 
                                                        
| 57 | 57 | 0 => array(  | 
                                                        
| 58 | -				'page_route' => array('edit','create_new'), | 
                                                        |
| 58 | +				'page_route' => array('edit', 'create_new'), | 
                                                        |
| 59 | 59 | 'func' => 'messages_metabox',  | 
                                                        
| 60 | 60 |  				'label' => __('Notifications', 'event_espresso'), | 
                                                        
| 61 | 61 | 'priority' => 'high'  | 
                                                        
@@ -66,11 +66,11 @@ discard block  | 
                                                    ||
| 66 | 66 | $this->_scripts_styles = array(  | 
                                                        
| 67 | 67 | 'registers' => array(  | 
                                                        
| 68 | 68 | 'events_msg_admin' => array(  | 
                                                        
| 69 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',  | 
                                                        |
| 69 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',  | 
                                                        |
| 70 | 70 |  					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array') | 
                                                        
| 71 | 71 | ),  | 
                                                        
| 72 | 72 | 'events_msg_admin_css' => array(  | 
                                                        
| 73 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',  | 
                                                        |
| 73 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',  | 
                                                        |
| 74 | 74 | 'type' => 'css'  | 
                                                        
| 75 | 75 | )  | 
                                                        
| 76 | 76 | ),  | 
                                                        
@@ -82,8 +82,8 @@ discard block  | 
                                                    ||
| 82 | 82 | }  | 
                                                        
| 83 | 83 | |
| 84 | 84 | |
| 85 | -	public function caf_updates( $update_callbacks ) { | 
                                                        |
| 86 | - $update_callbacks[] = array( $this, 'attach_evt_message_templates' );  | 
                                                        |
| 85 | +	public function caf_updates($update_callbacks) { | 
                                                        |
| 86 | + $update_callbacks[] = array($this, 'attach_evt_message_templates');  | 
                                                        |
| 87 | 87 | return $update_callbacks;  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | 89 | |
@@ -96,13 +96,13 @@ discard block  | 
                                                    ||
| 96 | 96 | * @param array $data The request data from the form  | 
                                                        
| 97 | 97 | * @return bool success or fail  | 
                                                        
| 98 | 98 | */  | 
                                                        
| 99 | -	public function attach_evt_message_templates( $evtobj, $data ) { | 
                                                        |
| 99 | +	public function attach_evt_message_templates($evtobj, $data) { | 
                                                        |
| 100 | 100 | //first we remove all existing relations on the Event for message types.  | 
                                                        
| 101 | 101 |  		$evtobj->_remove_relations('Message_Template_Group'); | 
                                                        
| 102 | 102 | |
| 103 | 103 | //now let's just loop throught the selected templates and add relations!  | 
                                                        
| 104 | -		foreach( $data['event_message_templates_relation'] as $grp_ID ) { | 
                                                        |
| 105 | - $evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' );  | 
                                                        |
| 104 | +		foreach ($data['event_message_templates_relation'] as $grp_ID) { | 
                                                        |
| 105 | + $evtobj->_add_relation_to($grp_ID, 'Message_Template_Group');  | 
                                                        |
| 106 | 106 | }  | 
                                                        
| 107 | 107 | |
| 108 | 108 | //now save  | 
                                                        
@@ -115,10 +115,10 @@ discard block  | 
                                                    ||
| 115 | 115 | |
| 116 | 116 | //let's get the active messengers (b/c messenger objects have the active message templates)  | 
                                                        
| 117 | 117 | //convert 'evt_id' to 'EVT_ID'  | 
                                                        
| 118 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;  | 
                                                        |
| 119 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];  | 
                                                        |
| 118 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;  | 
                                                        |
| 119 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];  | 
                                                        |
| 120 | 120 | |
| 121 | - $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];  | 
                                                        |
| 121 | + $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];  | 
                                                        |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | $EEM_controller = new EE_messages;  | 
                                                        
@@ -127,11 +127,11 @@ discard block  | 
                                                    ||
| 127 | 127 | |
| 128 | 128 | //empty messengers?  | 
                                                        
| 129 | 129 | //Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.  | 
                                                        
| 130 | -		if ( empty( $active_messengers ) ) { | 
                                                        |
| 131 | -			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL ); | 
                                                        |
| 132 | -			$error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>'); | 
                                                        |
| 133 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>';  | 
                                                        |
| 134 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';  | 
                                                        |
| 130 | +		if (empty($active_messengers)) { | 
                                                        |
| 131 | +			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL); | 
                                                        |
| 132 | +			$error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>'); | 
                                                        |
| 133 | + $error_content = '<div class="error"><p>'.$error_msg.'</p></div>';  | 
                                                        |
| 134 | + $internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';  | 
                                                        |
| 135 | 135 | |
| 136 | 136 | echo $error_content;  | 
                                                        
| 137 | 137 | echo $internal_content;  | 
                                                        
@@ -140,39 +140,39 @@ discard block  | 
                                                    ||
| 140 | 140 | |
| 141 | 141 | $event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;  | 
                                                        
| 142 | 142 | //get content for active messengers  | 
                                                        
| 143 | -		foreach ( $active_messengers as $name => $messenger ) { | 
                                                        |
| 143 | +		foreach ($active_messengers as $name => $messenger) { | 
                                                        |
| 144 | 144 | //first check if there are any active message types for this messenger.  | 
                                                        
| 145 | - $active_mts = $EEM_controller->get_active_message_types_per_messenger( $name );  | 
                                                        |
| 146 | -			if ( empty( $active_mts ) ) { | 
                                                        |
| 145 | + $active_mts = $EEM_controller->get_active_message_types_per_messenger($name);  | 
                                                        |
| 146 | +			if (empty($active_mts)) { | 
                                                        |
| 147 | 147 | continue;  | 
                                                        
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
| 150 | -			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) ); | 
                                                        |
| 150 | +			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id)); | 
                                                        |
| 151 | 151 | |
| 152 | -			if ( ! empty( $tcont ) ) { | 
                                                        |
| 152 | +			if ( ! empty($tcont)) { | 
                                                        |
| 153 | 153 | $tabs[$name] = $tcont;  | 
                                                        
| 154 | 154 | }  | 
                                                        
| 155 | 155 | }  | 
                                                        
| 156 | 156 | |
| 157 | 157 | |
| 158 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' );  | 
                                                        |
| 158 | +		EE_Registry::instance()->load_helper('Tabbed_Content'); | 
                                                        |
| 159 | 159 | //we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.  | 
                                                        
| 160 | 160 | $tabbed_content = EEH_Tabbed_Content::display($tabs);  | 
                                                        
| 161 | -		if ( is_wp_error($tabbed_content) ) { | 
                                                        |
| 161 | +		if (is_wp_error($tabbed_content)) { | 
                                                        |
| 162 | 162 | $tabbed_content = $tabbed_content->get_error_message();  | 
                                                        
| 163 | 163 | }  | 
                                                        
| 164 | 164 | |
| 165 | 165 | $notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey">  | 
                                                        
| 166 | -				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span> | 
                                                        |
| 166 | +				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span> | 
                                                        |
| 167 | 167 | </div><div class="ee-notices"></div>';  | 
                                                        
| 168 | 168 | |
| 169 | -		if ( defined('DOING_AJAX' ) ) { | 
                                                        |
| 169 | +		if (defined('DOING_AJAX')) { | 
                                                        |
| 170 | 170 | return $tabbed_content;  | 
                                                        
| 171 | 171 | }  | 
                                                        
| 172 | 172 | |
| 173 | - do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );  | 
                                                        |
| 174 | - echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';  | 
                                                        |
| 175 | - do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );  | 
                                                        |
| 173 | +		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); | 
                                                        |
| 174 | + echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';  | 
                                                        |
| 175 | +		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); | 
                                                        |
| 176 | 176 | |
| 177 | 177 | }  | 
                                                        
| 178 | 178 | |
@@ -186,22 +186,22 @@ discard block  | 
                                                    ||
| 186 | 186 | */  | 
                                                        
| 187 | 187 |  	public function create_new_custom() { | 
                                                        
| 188 | 188 | |
| 189 | -		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) { | 
                                                        |
| 190 | -			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) ); | 
                                                        |
| 189 | +		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { | 
                                                        |
| 190 | +			wp_die(__('You don\'t have privileges to do this action', 'event_espresso')); | 
                                                        |
| 191 | 191 | }  | 
                                                        
| 192 | 192 | |
| 193 | 193 | //let's clean up the _POST global a bit for downstream usage of name and description.  | 
                                                        
| 194 | - $_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : '';  | 
                                                        |
| 195 | - $_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : '';  | 
                                                        |
| 194 | + $_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : '';  | 
                                                        |
| 195 | + $_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : '';  | 
                                                        |
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | //set EE_Admin_Page object (see method details in EE_Admin_Hooks parent  | 
                                                        
| 199 | 199 | $this->_set_page_object();  | 
                                                        
| 200 | 200 | |
| 201 | 201 | //is this a template switch if so EE_Admin_Page child needs this object  | 
                                                        
| 202 | - $this->_page_object->set_hook_object( $this );  | 
                                                        |
| 202 | + $this->_page_object->set_hook_object($this);  | 
                                                        |
| 203 | 203 | |
| 204 | - $this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] );  | 
                                                        |
| 204 | + $this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']);  | 
                                                        |
| 205 | 205 | }  | 
                                                        
| 206 | 206 | |
| 207 | 207 | |
@@ -216,7 +216,7 @@ discard block  | 
                                                    ||
| 216 | 216 | * @return string (admin_footer contents)  | 
                                                        
| 217 | 217 | */  | 
                                                        
| 218 | 218 |  	public function edit_admin_footer() { | 
                                                        
| 219 | - $template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php';  | 
                                                        |
| 219 | + $template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php';  | 
                                                        |
| 220 | 220 | EEH_Template::display_template($template_path, array());  | 
                                                        
| 221 | 221 | }  | 
                                                        
| 222 | 222 | |
@@ -6,8 +6,9 @@  | 
                                                    ||
| 6 | 6 | * @package Event Espresso  | 
                                                        
| 7 | 7 | * @subpackage messages  | 
                                                        
| 8 | 8 | */  | 
                                                        
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) | 
                                                        |
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { | 
                                                        |
| 10 | 10 |  	exit('NO direct script access allowed'); | 
                                                        
| 11 | +}  | 
                                                        |
| 11 | 12 | |
| 12 | 13 | /**  | 
                                                        
| 13 | 14 | *  | 
                                                        
@@ -478,7 +478,7 @@ discard block  | 
                                                    ||
| 478 | 478 | /**  | 
                                                        
| 479 | 479 | * generates Business Report showing total registratiopns per day  | 
                                                        
| 480 | 480 | * @access private  | 
                                                        
| 481 | - * @return void  | 
                                                        |
| 481 | + * @return string  | 
                                                        |
| 482 | 482 | */  | 
                                                        
| 483 | 483 |  	private function _registrations_per_day_report( $period = '-1 month' ) { | 
                                                        
| 484 | 484 | |
@@ -535,7 +535,7 @@ discard block  | 
                                                    ||
| 535 | 535 | /**  | 
                                                        
| 536 | 536 | * generates Business Report showing total registratiopns per event  | 
                                                        
| 537 | 537 | * @access private  | 
                                                        
| 538 | - * @return void  | 
                                                        |
| 538 | + * @return string  | 
                                                        |
| 539 | 539 | */  | 
                                                        
| 540 | 540 |  	private function _get_registrations_per_event_report( $period = '-1 month' ) { | 
                                                        
| 541 | 541 | |
@@ -650,8 +650,6 @@ discard block  | 
                                                    ||
| 650 | 650 | /**  | 
                                                        
| 651 | 651 | * handles toggleing the checkin status for the registration,  | 
                                                        
| 652 | 652 | * @access protected  | 
                                                        
| 653 | - * @param boolean $check_in  | 
                                                        |
| 654 | - * @return void  | 
                                                        |
| 655 | 653 | */  | 
                                                        
| 656 | 654 |  	protected function _toggle_checkin_status() { | 
                                                        
| 657 | 655 | //first let's get the query args out of the way for the redirect  | 
                                                        
@@ -447,9 +447,9 @@ discard block  | 
                                                    ||
| 447 | 447 | |
| 448 | 448 | /**  | 
                                                        
| 449 | 449 | * generates Business Reports regarding Registrations  | 
                                                        
| 450 | - * @access protected  | 
                                                        |
| 451 | - * @return void  | 
                                                        |
| 452 | - */  | 
                                                        |
| 450 | + * @access protected  | 
                                                        |
| 451 | + * @return void  | 
                                                        |
| 452 | + */  | 
                                                        |
| 453 | 453 |  	protected function _registration_reports() { | 
                                                        
| 454 | 454 | |
| 455 | 455 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        
@@ -477,9 +477,9 @@ discard block  | 
                                                    ||
| 477 | 477 | |
| 478 | 478 | /**  | 
                                                        
| 479 | 479 | * generates Business Report showing total registratiopns per day  | 
                                                        
| 480 | - * @access private  | 
                                                        |
| 481 | - * @return void  | 
                                                        |
| 482 | - */  | 
                                                        |
| 480 | + * @access private  | 
                                                        |
| 481 | + * @return void  | 
                                                        |
| 482 | + */  | 
                                                        |
| 483 | 483 |  	private function _registrations_per_day_report( $period = '-1 month' ) { | 
                                                        
| 484 | 484 | |
| 485 | 485 | $report_ID = 'reg-admin-registrations-per-day-report-dv';  | 
                                                        
@@ -534,9 +534,9 @@ discard block  | 
                                                    ||
| 534 | 534 | |
| 535 | 535 | /**  | 
                                                        
| 536 | 536 | * generates Business Report showing total registratiopns per event  | 
                                                        
| 537 | - * @access private  | 
                                                        |
| 538 | - * @return void  | 
                                                        |
| 539 | - */  | 
                                                        |
| 537 | + * @access private  | 
                                                        |
| 538 | + * @return void  | 
                                                        |
| 539 | + */  | 
                                                        |
| 540 | 540 |  	private function _get_registrations_per_event_report( $period = '-1 month' ) { | 
                                                        
| 541 | 541 | |
| 542 | 542 | $report_ID = 'reg-admin-registrations-per-event-report-dv';  | 
                                                        
@@ -649,10 +649,10 @@ discard block  | 
                                                    ||
| 649 | 649 | |
| 650 | 650 | /**  | 
                                                        
| 651 | 651 | * handles toggleing the checkin status for the registration,  | 
                                                        
| 652 | - * @access protected  | 
                                                        |
| 653 | - * @param boolean $check_in  | 
                                                        |
| 654 | - * @return void  | 
                                                        |
| 655 | - */  | 
                                                        |
| 652 | + * @access protected  | 
                                                        |
| 653 | + * @param boolean $check_in  | 
                                                        |
| 654 | + * @return void  | 
                                                        |
| 655 | + */  | 
                                                        |
| 656 | 656 |  	protected function _toggle_checkin_status() { | 
                                                        
| 657 | 657 | //first let's get the query args out of the way for the redirect  | 
                                                        
| 658 | 658 | $query_args = array(  | 
                                                        
@@ -773,9 +773,9 @@ discard block  | 
                                                    ||
| 773 | 773 | |
| 774 | 774 | /**  | 
                                                        
| 775 | 775 | * generates HTML for the Event Registrations List Table  | 
                                                        
| 776 | - * @access protected  | 
                                                        |
| 777 | - * @return void  | 
                                                        |
| 778 | - */  | 
                                                        |
| 776 | + * @access protected  | 
                                                        |
| 777 | + * @return void  | 
                                                        |
| 778 | + */  | 
                                                        |
| 779 | 779 |  	protected function _event_registrations_list_table() { | 
                                                        
| 780 | 780 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        
| 781 | 781 |  		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; | 
                                                        
@@ -805,11 +805,11 @@ discard block  | 
                                                    ||
| 805 | 805 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,  | 
                                                        
| 806 | 806 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )  | 
                                                        
| 807 | 807 | ),  | 
                                                        
| 808 | - 'cancelled_status' => array(  | 
                                                        |
| 808 | + 'cancelled_status' => array(  | 
                                                        |
| 809 | 809 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,  | 
                                                        
| 810 | 810 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )  | 
                                                        
| 811 | 811 | ),  | 
                                                        
| 812 | - 'declined_status' => array(  | 
                                                        |
| 812 | + 'declined_status' => array(  | 
                                                        |
| 813 | 813 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,  | 
                                                        
| 814 | 814 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )  | 
                                                        
| 815 | 815 | ),  | 
                                                        
@@ -837,9 +837,9 @@ discard block  | 
                                                    ||
| 837 | 837 | /**  | 
                                                        
| 838 | 838 | * get_attendees  | 
                                                        
| 839 | 839 | * @param bool $count whether to return count or data.  | 
                                                        
| 840 | - * @access public  | 
                                                        |
| 841 | - * @return array  | 
                                                        |
| 842 | - */  | 
                                                        |
| 840 | + * @access public  | 
                                                        |
| 841 | + * @return array  | 
                                                        |
| 842 | + */  | 
                                                        |
| 843 | 843 |  	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { | 
                                                        
| 844 | 844 | |
| 845 | 845 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        
@@ -1,6 +1,7 @@ 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 | 6 | /**  | 
                                                        
| 6 | 7 | * Event Espresso  | 
                                                        
@@ -679,8 +680,9 @@ discard block  | 
                                                    ||
| 679 | 680 |  			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  ); | 
                                                        
| 680 | 681 | }  | 
                                                        
| 681 | 682 | |
| 682 | -		if ( defined('DOING_AJAX' ) ) | 
                                                        |
| 683 | - return $new_status;  | 
                                                        |
| 683 | +		if ( defined('DOING_AJAX' ) ) { | 
                                                        |
| 684 | + return $new_status;  | 
                                                        |
| 685 | + }  | 
                                                        |
| 684 | 686 | |
| 685 | 687 | $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );  | 
                                                        
| 686 | 688 | |
@@ -918,7 +920,7 @@ discard block  | 
                                                    ||
| 918 | 920 |  		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration | 
                                                        
| 919 | 921 |  		if($count){ | 
                                                        
| 920 | 922 | $registrations = EEM_Registration::instance()->count(array($query_params[0]));  | 
                                                        
| 921 | -		}else{ | 
                                                        |
| 923 | +		} else{ | 
                                                        |
| 922 | 924 | $registrations = EEM_Registration::instance()->get_all($query_params);  | 
                                                        
| 923 | 925 | |
| 924 | 926 | |
@@ -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 | /**  | 
                                                        
@@ -29,11 +29,11 @@ discard block  | 
                                                    ||
| 29 | 29 | */  | 
                                                        
| 30 | 30 |  class Extend_Registrations_Admin_Page extends Registrations_Admin_Page { | 
                                                        
| 31 | 31 | |
| 32 | -	public function __construct( $routing = TRUE ) { | 
                                                        |
| 33 | - parent::__construct( $routing );  | 
                                                        |
| 34 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');  | 
                                                        |
| 35 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');  | 
                                                        |
| 36 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');  | 
                                                        |
| 32 | +	public function __construct($routing = TRUE) { | 
                                                        |
| 33 | + parent::__construct($routing);  | 
                                                        |
| 34 | +		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); | 
                                                        |
| 35 | +		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); | 
                                                        |
| 36 | +		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | |
| 39 | 39 | |
@@ -42,11 +42,11 @@ discard block  | 
                                                    ||
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 |  	protected function _extend_page_config() { | 
                                                        
| 45 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';  | 
                                                        |
| 45 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';  | 
                                                        |
| 46 | 46 | |
| 47 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;  | 
                                                        |
| 48 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;  | 
                                                        |
| 49 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;  | 
                                                        |
| 47 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;  | 
                                                        |
| 48 | + $att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;  | 
                                                        |
| 49 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;  | 
                                                        |
| 50 | 50 | |
| 51 | 51 | $new_page_routes = array(  | 
                                                        
| 52 | 52 | 'reports' => array(  | 
                                                        
@@ -85,7 +85,7 @@ discard block  | 
                                                    ||
| 85 | 85 | )  | 
                                                        
| 86 | 86 | );  | 
                                                        
| 87 | 87 | |
| 88 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );  | 
                                                        |
| 88 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);  | 
                                                        |
| 89 | 89 | |
| 90 | 90 | $new_page_config = array(  | 
                                                        
| 91 | 91 | 'reports' => array(  | 
                                                        
@@ -99,7 +99,7 @@ discard block  | 
                                                    ||
| 99 | 99 | 'filename' => 'registrations_reports'  | 
                                                        
| 100 | 100 | )  | 
                                                        
| 101 | 101 | ),  | 
                                                        
| 102 | - 'help_tour' => array( 'Registration_Reports_Help_Tour' ),  | 
                                                        |
| 102 | +				'help_tour' => array('Registration_Reports_Help_Tour'), | 
                                                        |
| 103 | 103 | 'require_nonce' => FALSE  | 
                                                        
| 104 | 104 | ),  | 
                                                        
| 105 | 105 | 'event_registrations' => array(  | 
                                                        
@@ -130,8 +130,8 @@ discard block  | 
                                                    ||
| 130 | 130 | 'filename' => 'registrations_event_checkin_other'  | 
                                                        
| 131 | 131 | )  | 
                                                        
| 132 | 132 | ),  | 
                                                        
| 133 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ),  | 
                                                        |
| 134 | -				'qtips' => array('Registration_List_Table_Tips' ), | 
                                                        |
| 133 | +				'help_tour' => array('Event_Checkin_Help_Tour'), | 
                                                        |
| 134 | +				'qtips' => array('Registration_List_Table_Tips'), | 
                                                        |
| 135 | 135 | 'list_table' => 'EE_Event_Registrations_List_Table',  | 
                                                        
| 136 | 136 | 'metaboxes' => array(),  | 
                                                        
| 137 | 137 | 'require_nonce' => FALSE  | 
                                                        
@@ -152,7 +152,7 @@ discard block  | 
                                                    ||
| 152 | 152 | // var_dump($this->_req_data);  | 
                                                        
| 153 | 153 | // exit();  | 
                                                        
| 154 | 154 | |
| 155 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config );  | 
                                                        |
| 155 | + $this->_page_config = array_merge($this->_page_config, $new_page_config);  | 
                                                        |
| 156 | 156 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';  | 
                                                        
| 157 | 157 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';  | 
                                                        
| 158 | 158 | }  | 
                                                        
@@ -161,7 +161,7 @@ discard block  | 
                                                    ||
| 161 | 161 | |
| 162 | 162 |  	protected function _ajax_hooks() { | 
                                                        
| 163 | 163 | parent::_ajax_hooks();  | 
                                                        
| 164 | -		add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') ); | 
                                                        |
| 164 | +		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); | 
                                                        |
| 165 | 165 | }  | 
                                                        
| 166 | 166 | |
| 167 | 167 | |
@@ -171,12 +171,12 @@ discard block  | 
                                                    ||
| 171 | 171 | |
| 172 | 172 | //if newsletter message type is active then let's add filter and load js for it.  | 
                                                        
| 173 | 173 |  		EE_Registry::instance()->load_helper('MSG_Template'); | 
                                                        
| 174 | -		if ( EEH_MSG_Template::is_mt_active('newsletter') ) { | 
                                                        |
| 174 | +		if (EEH_MSG_Template::is_mt_active('newsletter')) { | 
                                                        |
| 175 | 175 | //enqueue newsletter js  | 
                                                        
| 176 | - wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE );  | 
                                                        |
| 177 | - wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION );  | 
                                                        |
| 176 | +			wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 177 | +			wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION); | 
                                                        |
| 178 | 178 | //hook in buttons for newsletter message type trigger.  | 
                                                        
| 179 | -			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 ); | 
                                                        |
| 179 | +			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10); | 
                                                        |
| 180 | 180 | }  | 
                                                        
| 181 | 181 | }  | 
                                                        
| 182 | 182 | |
@@ -188,12 +188,12 @@ discard block  | 
                                                    ||
| 188 | 188 | |
| 189 | 189 | //scripts  | 
                                                        
| 190 | 190 | global $is_IE;  | 
                                                        
| 191 | -		if ( $is_IE ) { | 
                                                        |
| 192 | - wp_enqueue_script( 'excanvas' );  | 
                                                        |
| 191 | +		if ($is_IE) { | 
                                                        |
| 192 | +			wp_enqueue_script('excanvas'); | 
                                                        |
| 193 | 193 | }  | 
                                                        
| 194 | 194 | |
| 195 | -		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL  . 'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE ); | 
                                                        |
| 196 | -		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE ); | 
                                                        |
| 195 | +		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 196 | +		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE); | 
                                                        |
| 197 | 197 | }  | 
                                                        
| 198 | 198 | |
| 199 | 199 | |
@@ -224,7 +224,7 @@ discard block  | 
                                                    ||
| 224 | 224 | 'slug' => 'all',  | 
                                                        
| 225 | 225 |  				'label' => __('All', 'event_espresso'), | 
                                                        
| 226 | 226 | 'count' => 0,  | 
                                                        
| 227 | - 'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(  | 
                                                        |
| 227 | + 'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(  | 
                                                        |
| 228 | 228 |  					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), | 
                                                        
| 229 | 229 |  					//'trash_registrations' => __('Trash Registrations', 'event_espresso') | 
                                                        
| 230 | 230 | )  | 
                                                        
@@ -242,7 +242,7 @@ discard block  | 
                                                    ||
| 242 | 242 | 'slug' => 'all',  | 
                                                        
| 243 | 243 |  				'label' => __('All', 'event_espresso'), | 
                                                        
| 244 | 244 | 'count' => 0,  | 
                                                        
| 245 | -				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') ) | 
                                                        |
| 245 | +				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')) | 
                                                        |
| 246 | 246 | ),  | 
                                                        
| 247 | 247 | );  | 
                                                        
| 248 | 248 | }  | 
                                                        
@@ -258,20 +258,20 @@ discard block  | 
                                                    ||
| 258 | 258 | */  | 
                                                        
| 259 | 259 |  	public function get_newsletter_form_content() { | 
                                                        
| 260 | 260 | //do a nonce check cause we're not coming in from an normal route here.  | 
                                                        
| 261 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';  | 
                                                        |
| 261 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';  | 
                                                        |
| 262 | 262 | $nonce_ref = 'get_newsletter_form_content_nonce';  | 
                                                        
| 263 | 263 | |
| 264 | - $this->_verify_nonce( $nonce, $nonce_ref );  | 
                                                        |
| 264 | + $this->_verify_nonce($nonce, $nonce_ref);  | 
                                                        |
| 265 | 265 | //let's get the mtp for the incoming MTP_ ID  | 
                                                        
| 266 | -		if ( !isset( $this->_req_data['GRP_ID'] ) ) { | 
                                                        |
| 267 | -			EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 266 | +		if ( ! isset($this->_req_data['GRP_ID'])) { | 
                                                        |
| 267 | +			EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 268 | 268 | $this->_template_args['success'] = FALSE;  | 
                                                        
| 269 | 269 | $this->_template_args['error'] = TRUE;  | 
                                                        
| 270 | 270 | $this->_return_json();  | 
                                                        
| 271 | 271 | }  | 
                                                        
| 272 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );  | 
                                                        |
| 273 | -		if ( ! $MTPG instanceof EE_Message_Template_Group ) { | 
                                                        |
| 274 | -			EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__  ); | 
                                                        |
| 272 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);  | 
                                                        |
| 273 | +		if ( ! $MTPG instanceof EE_Message_Template_Group) { | 
                                                        |
| 274 | +			EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 275 | 275 | $this->_template_args['success'] = FALSE;  | 
                                                        
| 276 | 276 | $this->_template_args['error'] = TRUE;  | 
                                                        
| 277 | 277 | $this->_return_json();  | 
                                                        
@@ -280,11 +280,11 @@ discard block  | 
                                                    ||
| 280 | 280 | $MTPs = $MTPG->context_templates();  | 
                                                        
| 281 | 281 | $MTPs = $MTPs['attendee'];  | 
                                                        
| 282 | 282 | $template_fields = array();  | 
                                                        
| 283 | -		foreach ( $MTPs as $MTP ) { | 
                                                        |
| 283 | +		foreach ($MTPs as $MTP) { | 
                                                        |
| 284 | 284 |  			$field = $MTP->get('MTP_template_field'); | 
                                                        
| 285 | -			if ( $field == 'content'  ) { | 
                                                        |
| 285 | +			if ($field == 'content') { | 
                                                        |
| 286 | 286 |  				$content = $MTP->get('MTP_content'); | 
                                                        
| 287 | -				if ( !empty( $content['newsletter_content'] ) ) { | 
                                                        |
| 287 | +				if ( ! empty($content['newsletter_content'])) { | 
                                                        |
| 288 | 288 | $template_fields['newsletter_content'] = $content['newsletter_content'];  | 
                                                        
| 289 | 289 | }  | 
                                                        
| 290 | 290 | continue;  | 
                                                        
@@ -297,7 +297,7 @@ discard block  | 
                                                    ||
| 297 | 297 | $this->_template_args['data'] = array(  | 
                                                        
| 298 | 298 | 'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',  | 
                                                        
| 299 | 299 | 'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',  | 
                                                        
| 300 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''  | 
                                                        |
| 300 | + 'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''  | 
                                                        |
| 301 | 301 | );  | 
                                                        
| 302 | 302 | $this->_return_json();  | 
                                                        
| 303 | 303 | }  | 
                                                        
@@ -313,8 +313,8 @@ discard block  | 
                                                    ||
| 313 | 313 | * @param EE_Admin_List_Table $list_table  | 
                                                        
| 314 | 314 | * @return string html string for extra buttons  | 
                                                        
| 315 | 315 | */  | 
                                                        
| 316 | -	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { | 
                                                        |
| 317 | -		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) { | 
                                                        |
| 316 | +	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { | 
                                                        |
| 317 | +		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) { | 
                                                        |
| 318 | 318 | return '';  | 
                                                        
| 319 | 319 | }  | 
                                                        
| 320 | 320 | |
@@ -323,13 +323,13 @@ discard block  | 
                                                    ||
| 323 | 323 | 'event_registrations',  | 
                                                        
| 324 | 324 | 'default'  | 
                                                        
| 325 | 325 | );  | 
                                                        
| 326 | -		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) { | 
                                                        |
| 327 | -			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) { | 
                                                        |
| 326 | +		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { | 
                                                        |
| 327 | +			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) { | 
                                                        |
| 328 | 328 | echo '';  | 
                                                        
| 329 | 329 |  			} else { | 
                                                        
| 330 | -				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' ); | 
                                                        |
| 331 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';  | 
                                                        |
| 332 | -				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') ); | 
                                                        |
| 330 | +				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>'); | 
                                                        |
| 331 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';  | 
                                                        |
| 332 | +				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); | 
                                                        |
| 333 | 333 | }  | 
                                                        
| 334 | 334 | }  | 
                                                        
| 335 | 335 | }  | 
                                                        
@@ -341,38 +341,38 @@ discard block  | 
                                                    ||
| 341 | 341 | $list_table = $this->_list_table_object;  | 
                                                        
| 342 | 342 | $codes = array();  | 
                                                        
| 343 | 343 | //need to templates for the newsletter message type for the template selector.  | 
                                                        
| 344 | -		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 ); | 
                                                        |
| 345 | - $mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );  | 
                                                        |
| 346 | -		foreach ( $mtps as $mtp ) { | 
                                                        |
| 344 | +		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); | 
                                                        |
| 345 | +		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); | 
                                                        |
| 346 | +		foreach ($mtps as $mtp) { | 
                                                        |
| 347 | 347 | $name = $mtp->name();  | 
                                                        
| 348 | 348 | $values[] = array(  | 
                                                        
| 349 | -				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name, | 
                                                        |
| 349 | +				'text' => empty($name) ? __('Global', 'event_espresso') : $name, | 
                                                        |
| 350 | 350 | 'id' => $mtp->ID()  | 
                                                        
| 351 | 351 | );  | 
                                                        
| 352 | 352 | }  | 
                                                        
| 353 | 353 | |
| 354 | 354 | //need to get a list of shortcodes that are available for the newsletter message type.  | 
                                                        
| 355 | 355 |  		EE_Registry::instance()->load_helper('MSG_Template'); | 
                                                        
| 356 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );  | 
                                                        |
| 357 | -		foreach ( $shortcodes as $field => $shortcode_array ) { | 
                                                        |
| 358 | -			$codes[$field] = implode(', ', array_keys($shortcode_array ) ); | 
                                                        |
| 356 | +		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); | 
                                                        |
| 357 | +		foreach ($shortcodes as $field => $shortcode_array) { | 
                                                        |
| 358 | +			$codes[$field] = implode(', ', array_keys($shortcode_array)); | 
                                                        |
| 359 | 359 | }  | 
                                                        
| 360 | 360 | |
| 361 | 361 | $shortcodes = $codes;  | 
                                                        
| 362 | 362 | |
| 363 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';  | 
                                                        |
| 363 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';  | 
                                                        |
| 364 | 364 | $form_template_args = array(  | 
                                                        
| 365 | 365 |  			'form_action' => admin_url('admin.php?page=espresso_registrations'), | 
                                                        
| 366 | 366 | 'form_route' => 'newsletter_selected_send',  | 
                                                        
| 367 | 367 | 'form_nonce_name' => 'newsletter_selected_send_nonce',  | 
                                                        
| 368 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),  | 
                                                        |
| 368 | +			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), | 
                                                        |
| 369 | 369 | 'redirect_back_to' => $this->_req_action,  | 
                                                        
| 370 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),  | 
                                                        |
| 371 | -			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ), | 
                                                        |
| 370 | +			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), | 
                                                        |
| 371 | +			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), | 
                                                        |
| 372 | 372 | 'shortcodes' => $shortcodes,  | 
                                                        
| 373 | 373 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'  | 
                                                        
| 374 | 374 | );  | 
                                                        
| 375 | - EEH_Template::display_template( $form_template, $form_template_args );  | 
                                                        |
| 375 | + EEH_Template::display_template($form_template, $form_template_args);  | 
                                                        |
| 376 | 376 | }  | 
                                                        
| 377 | 377 | |
| 378 | 378 | |
@@ -387,35 +387,35 @@ discard block  | 
                                                    ||
| 387 | 387 |  	protected function _newsletter_selected_send() { | 
                                                        
| 388 | 388 | $success = TRUE;  | 
                                                        
| 389 | 389 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating!  | 
                                                        
| 390 | -		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { | 
                                                        |
| 391 | -			EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 390 | +		if (empty($this->_req_data['newsletter_mtp_selected'])) { | 
                                                        |
| 391 | +			EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 392 | 392 | $success = FALSE;  | 
                                                        
| 393 | 393 | }  | 
                                                        
| 394 | 394 | |
| 395 | -		if ( $success ) { | 
                                                        |
| 395 | +		if ($success) { | 
                                                        |
| 396 | 396 | //update Message template in case there are any changes  | 
                                                        
| 397 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] );  | 
                                                        |
| 397 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']);  | 
                                                        |
| 398 | 398 | $MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array();  | 
                                                        
| 399 | -			if ( empty( $MTPs ) ) { | 
                                                        |
| 400 | -				EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 399 | +			if (empty($MTPs)) { | 
                                                        |
| 400 | +				EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 401 | 401 | $success = FALSE;  | 
                                                        
| 402 | 402 | }  | 
                                                        
| 403 | 403 | |
| 404 | 404 | //let's just update the specific fields  | 
                                                        
| 405 | -			foreach ( $MTPs['attendee'] as $MTP ) { | 
                                                        |
| 405 | +			foreach ($MTPs['attendee'] as $MTP) { | 
                                                        |
| 406 | 406 |  				$field = $MTP->get('MTP_template_field'); | 
                                                        
| 407 | 407 |  				$content = $MTP->get('MTP_content'); | 
                                                        
| 408 | 408 | $new_content = $content;  | 
                                                        
| 409 | -				switch( $field ) { | 
                                                        |
| 409 | +				switch ($field) { | 
                                                        |
| 410 | 410 | case 'from' :  | 
                                                        
| 411 | - $new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content;  | 
                                                        |
| 411 | + $new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content;  | 
                                                        |
| 412 | 412 | break;  | 
                                                        
| 413 | 413 | case 'subject' :  | 
                                                        
| 414 | - $new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content;  | 
                                                        |
| 414 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content;  | 
                                                        |
| 415 | 415 | break;  | 
                                                        
| 416 | 416 | case 'content' :  | 
                                                        
| 417 | 417 | $new_content = $content;  | 
                                                        
| 418 | - $new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];  | 
                                                        |
| 418 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];  | 
                                                        |
| 419 | 419 | break;  | 
                                                        
| 420 | 420 | default :  | 
                                                        
| 421 | 421 | continue;  | 
                                                        
@@ -426,20 +426,20 @@ discard block  | 
                                                    ||
| 426 | 426 | }  | 
                                                        
| 427 | 427 | |
| 428 | 428 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee).  | 
                                                        
| 429 | - $id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration';  | 
                                                        |
| 429 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration';  | 
                                                        |
| 430 | 430 | |
| 431 | 431 | //id_type will affect how we assemble the ids.  | 
                                                        
| 432 | - $ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array();  | 
                                                        |
| 432 | + $ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array();  | 
                                                        |
| 433 | 433 | |
| 434 | -			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) ); | 
                                                        |
| 434 | +			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); | 
                                                        |
| 435 | 435 | |
| 436 | 436 | //we do _action because ALL triggers are handled in EED_Messages.  | 
                                                        
| 437 | -			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() ); | 
                                                        |
| 437 | +			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID()); | 
                                                        |
| 438 | 438 | }  | 
                                                        
| 439 | 439 | $query_args = array(  | 
                                                        
| 440 | - 'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default'  | 
                                                        |
| 440 | + 'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default'  | 
                                                        |
| 441 | 441 | );  | 
                                                        
| 442 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 442 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 443 | 443 | }  | 
                                                        
| 444 | 444 | |
| 445 | 445 | |
@@ -452,16 +452,16 @@ discard block  | 
                                                    ||
| 452 | 452 | */  | 
                                                        
| 453 | 453 |  	protected function _registration_reports() { | 
                                                        
| 454 | 454 | |
| 455 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 455 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 456 | 456 | |
| 457 | 457 | $page_args = array();  | 
                                                        
| 458 | 458 | |
| 459 | - $page_args['admin_reports'][] = $this->_registrations_per_day_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month'  | 
                                                        |
| 460 | - $page_args['admin_reports'][] = $this->_get_registrations_per_event_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month'  | 
                                                        |
| 459 | +		$page_args['admin_reports'][] = $this->_registrations_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month' | 
                                                        |
| 460 | +		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month' | 
                                                        |
| 461 | 461 | // $page_args['admin_reports'][] = 'chart1';  | 
                                                        
| 462 | 462 | |
| 463 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';  | 
                                                        |
| 464 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );  | 
                                                        |
| 463 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';  | 
                                                        |
| 464 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);  | 
                                                        |
| 465 | 465 | |
| 466 | 466 | // EEH_Debug_Tools::printr( $page_args, '$page_args' );  | 
                                                        
| 467 | 467 | |
@@ -480,36 +480,36 @@ discard block  | 
                                                    ||
| 480 | 480 | * @access private  | 
                                                        
| 481 | 481 | * @return void  | 
                                                        
| 482 | 482 | */  | 
                                                        
| 483 | -	private function _registrations_per_day_report( $period = '-1 month' ) { | 
                                                        |
| 483 | +	private function _registrations_per_day_report($period = '-1 month') { | 
                                                        |
| 484 | 484 | |
| 485 | 485 | $report_ID = 'reg-admin-registrations-per-day-report-dv';  | 
                                                        
| 486 | 486 | $report_JS = 'espresso_reg_admin_regs_per_day';  | 
                                                        
| 487 | 487 | |
| 488 | - wp_enqueue_script( $report_JS );  | 
                                                        |
| 488 | + wp_enqueue_script($report_JS);  | 
                                                        |
| 489 | 489 | |
| 490 | 490 | $REG = EEM_Registration::instance();  | 
                                                        
| 491 | 491 | |
| 492 | - $results = $REG->get_registrations_per_day_report( $period );  | 
                                                        |
| 492 | + $results = $REG->get_registrations_per_day_report($period);  | 
                                                        |
| 493 | 493 | |
| 494 | 494 | //EEH_Debug_Tools::printr( $results, '$registrations_per_day' );  | 
                                                        
| 495 | 495 | $regs = array();  | 
                                                        
| 496 | - $xmin = date( 'Y-m-d', strtotime( '+1 year' ));  | 
                                                        |
| 496 | +		$xmin = date('Y-m-d', strtotime('+1 year')); | 
                                                        |
| 497 | 497 | $xmax = 0;  | 
                                                        
| 498 | 498 | $ymax = 0;  | 
                                                        
| 499 | 499 | $results = (array) $results;  | 
                                                        
| 500 | -		foreach ( $results as $result ) { | 
                                                        |
| 501 | - $regs[] = array( $result->regDate, (int)$result->total );  | 
                                                        |
| 502 | - $xmin = strtotime( $result->regDate ) < strtotime( $xmin ) ? $result->regDate : $xmin;  | 
                                                        |
| 503 | - $xmax = strtotime( $result->regDate ) > strtotime( $xmax ) ? $result->regDate : $xmax;  | 
                                                        |
| 500 | +		foreach ($results as $result) { | 
                                                        |
| 501 | + $regs[] = array($result->regDate, (int) $result->total);  | 
                                                        |
| 502 | + $xmin = strtotime($result->regDate) < strtotime($xmin) ? $result->regDate : $xmin;  | 
                                                        |
| 503 | + $xmax = strtotime($result->regDate) > strtotime($xmax) ? $result->regDate : $xmax;  | 
                                                        |
| 504 | 504 | $ymax = $result->total > $ymax ? $result->total : $ymax;  | 
                                                        
| 505 | 505 | }  | 
                                                        
| 506 | 506 | |
| 507 | - $xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));  | 
                                                        |
| 508 | - $xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));  | 
                                                        |
| 507 | +		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day')); | 
                                                        |
| 508 | +		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day')); | 
                                                        |
| 509 | 509 | // calculate # days between our min and max dates  | 
                                                        
| 510 | - $span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;  | 
                                                        |
| 510 | + $span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;  | 
                                                        |
| 511 | 511 | |
| 512 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' );  | 
                                                        |
| 512 | +		$report_title = __('Total Registrations per Day', 'event_espresso'); | 
                                                        |
| 513 | 513 | |
| 514 | 514 | $report_params = array(  | 
                                                        
| 515 | 515 | 'title' => $report_title,  | 
                                                        
@@ -520,9 +520,9 @@ discard block  | 
                                                    ||
| 520 | 520 | 'ymax' => ceil($ymax * 1.25),  | 
                                                        
| 521 | 521 | 'span' => $span,  | 
                                                        
| 522 | 522 | 'width' => ceil(900 / $span),  | 
                                                        
| 523 | -				'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title ) | 
                                                        |
| 523 | +				'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title) | 
                                                        |
| 524 | 524 | );  | 
                                                        
| 525 | - wp_localize_script( $report_JS, 'regPerDay', $report_params );  | 
                                                        |
| 525 | + wp_localize_script($report_JS, 'regPerDay', $report_params);  | 
                                                        |
| 526 | 526 | |
| 527 | 527 | return $report_ID;  | 
                                                        
| 528 | 528 | }  | 
                                                        
@@ -537,29 +537,29 @@ discard block  | 
                                                    ||
| 537 | 537 | * @access private  | 
                                                        
| 538 | 538 | * @return void  | 
                                                        
| 539 | 539 | */  | 
                                                        
| 540 | -	private function _get_registrations_per_event_report( $period = '-1 month' ) { | 
                                                        |
| 540 | +	private function _get_registrations_per_event_report($period = '-1 month') { | 
                                                        |
| 541 | 541 | |
| 542 | 542 | $report_ID = 'reg-admin-registrations-per-event-report-dv';  | 
                                                        
| 543 | 543 | $report_JS = 'espresso_reg_admin_regs_per_event';  | 
                                                        
| 544 | 544 | |
| 545 | - wp_enqueue_script( $report_JS );  | 
                                                        |
| 545 | + wp_enqueue_script($report_JS);  | 
                                                        |
| 546 | 546 | |
| 547 | - require_once ( EE_MODELS . 'EEM_Registration.model.php' );  | 
                                                        |
| 547 | + require_once (EE_MODELS.'EEM_Registration.model.php');  | 
                                                        |
| 548 | 548 | $REG = EEM_Registration::instance();  | 
                                                        
| 549 | 549 | |
| 550 | - $results = $REG->get_registrations_per_event_report( $period );  | 
                                                        |
| 550 | + $results = $REG->get_registrations_per_event_report($period);  | 
                                                        |
| 551 | 551 | //EEH_Debug_Tools::printr( $results, '$registrations_per_event' );  | 
                                                        
| 552 | 552 | $regs = array();  | 
                                                        
| 553 | 553 | $ymax = 0;  | 
                                                        
| 554 | 554 | $results = (array) $results;  | 
                                                        
| 555 | -		foreach ( $results as $result ) { | 
                                                        |
| 556 | - $regs[] = array( wp_trim_words( $result->event_name, 4, '...' ), (int)$result->total );  | 
                                                        |
| 555 | +		foreach ($results as $result) { | 
                                                        |
| 556 | + $regs[] = array(wp_trim_words($result->event_name, 4, '...'), (int) $result->total);  | 
                                                        |
| 557 | 557 | $ymax = $result->total > $ymax ? $result->total : $ymax;  | 
                                                        
| 558 | 558 | }  | 
                                                        
| 559 | 559 | |
| 560 | 560 | $span = $period == 'week' ? 9 : 33;  | 
                                                        
| 561 | 561 | |
| 562 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' );  | 
                                                        |
| 562 | +		$report_title = __('Total Registrations per Event', 'event_espresso'); | 
                                                        |
| 563 | 563 | |
| 564 | 564 | $report_params = array(  | 
                                                        
| 565 | 565 | 'title' => $report_title,  | 
                                                        
@@ -568,9 +568,9 @@ discard block  | 
                                                    ||
| 568 | 568 | 'ymax' => ceil($ymax * 1.25),  | 
                                                        
| 569 | 569 | 'span' => $span,  | 
                                                        
| 570 | 570 | 'width' => ceil(900 / $span),  | 
                                                        
| 571 | -			'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title ) | 
                                                        |
| 571 | +			'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title) | 
                                                        |
| 572 | 572 | );  | 
                                                        
| 573 | - wp_localize_script( $report_JS, 'regPerEvent', $report_params );  | 
                                                        |
| 573 | + wp_localize_script($report_JS, 'regPerEvent', $report_params);  | 
                                                        |
| 574 | 574 | |
| 575 | 575 | return $report_ID;  | 
                                                        
| 576 | 576 | }  | 
                                                        
@@ -584,8 +584,8 @@ discard block  | 
                                                    ||
| 584 | 584 | * @return void  | 
                                                        
| 585 | 585 | */  | 
                                                        
| 586 | 586 |  	protected function _registration_checkin_list_table() { | 
                                                        
| 587 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 588 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;  | 
                                                        |
| 587 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 588 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;  | 
                                                        |
| 589 | 589 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id);  | 
                                                        
| 590 | 590 |  		$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2'); | 
                                                        
| 591 | 591 | |
@@ -599,15 +599,15 @@ discard block  | 
                                                    ||
| 599 | 599 |  				'desc' => __('This indicates the attendee has been checked out', 'event_espresso') | 
                                                        
| 600 | 600 | )  | 
                                                        
| 601 | 601 | );  | 
                                                        
| 602 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );  | 
                                                        |
| 602 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);  | 
                                                        |
| 603 | 603 | |
| 604 | 604 | |
| 605 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 606 | -		$go_back_url = !empty( $reg_id )  ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : ''; | 
                                                        |
| 605 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 606 | +		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : ''; | 
                                                        |
| 607 | 607 | |
| 608 | -		$this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : ''; | 
                                                        |
| 609 | - $this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';  | 
                                                        |
| 610 | - $this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';  | 
                                                        |
| 608 | +		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : ''; | 
                                                        |
| 609 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';  | 
                                                        |
| 610 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';  | 
                                                        |
| 611 | 611 | |
| 612 | 612 | $this->display_admin_list_table_page_with_no_sidebar();  | 
                                                        
| 613 | 613 | }  | 
                                                        
@@ -620,24 +620,24 @@ discard block  | 
                                                    ||
| 620 | 620 | */  | 
                                                        
| 621 | 621 |  	public function toggle_checkin_status() { | 
                                                        
| 622 | 622 | //first make sure we have the necessary data  | 
                                                        
| 623 | -		if ( !isset( $this->_req_data['_regid'] ) ) { | 
                                                        |
| 624 | -			EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 623 | +		if ( ! isset($this->_req_data['_regid'])) { | 
                                                        |
| 624 | +			EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 625 | 625 | $this->_template_args['success'] = FALSE;  | 
                                                        
| 626 | 626 | $this->_template_args['error'] = TRUE;  | 
                                                        
| 627 | 627 | $this->_return_json();  | 
                                                        
| 628 | 628 | };  | 
                                                        
| 629 | 629 | |
| 630 | 630 | //do a nonce check cause we're not coming in from an normal route here.  | 
                                                        
| 631 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';  | 
                                                        |
| 631 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';  | 
                                                        |
| 632 | 632 | $nonce_ref = 'checkin_nonce';  | 
                                                        
| 633 | 633 | |
| 634 | - $this->_verify_nonce( $nonce, $nonce_ref );  | 
                                                        |
| 634 | + $this->_verify_nonce($nonce, $nonce_ref);  | 
                                                        |
| 635 | 635 | |
| 636 | 636 | //beautiful! Made it this far so let's get the status.  | 
                                                        
| 637 | 637 | $new_status = $this->_toggle_checkin_status();  | 
                                                        
| 638 | 638 | |
| 639 | 639 | //setup new class to return via ajax  | 
                                                        
| 640 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;  | 
                                                        |
| 640 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;  | 
                                                        |
| 641 | 641 | $this->_template_args['success'] = TRUE;  | 
                                                        
| 642 | 642 | $this->_return_json();  | 
                                                        
| 643 | 643 | }  | 
                                                        
@@ -657,32 +657,32 @@ discard block  | 
                                                    ||
| 657 | 657 | //first let's get the query args out of the way for the redirect  | 
                                                        
| 658 | 658 | $query_args = array(  | 
                                                        
| 659 | 659 | 'action' => 'event_registrations',  | 
                                                        
| 660 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,  | 
                                                        |
| 661 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL  | 
                                                        |
| 660 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,  | 
                                                        |
| 661 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL  | 
                                                        |
| 662 | 662 | );  | 
                                                        
| 663 | 663 | $new_status = FALSE;  | 
                                                        
| 664 | 664 | |
| 665 | 665 | // bulk action check in toggle  | 
                                                        
| 666 | -		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { | 
                                                        |
| 666 | +		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 667 | 667 | // cycle thru checkboxes  | 
                                                        
| 668 | -			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 669 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 668 | +			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 669 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 670 | 670 | $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);  | 
                                                        
| 671 | 671 | }  | 
                                                        
| 672 | 672 | |
| 673 | -		} elseif ( isset( $this->_req_data['_regid'] ) ) { | 
                                                        |
| 673 | +		} elseif (isset($this->_req_data['_regid'])) { | 
                                                        |
| 674 | 674 | //coming from ajax request  | 
                                                        
| 675 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;  | 
                                                        |
| 675 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;  | 
                                                        |
| 676 | 676 | $query_args['DTT_ID'] = $DTT_ID;  | 
                                                        
| 677 | 677 | $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);  | 
                                                        
| 678 | 678 |  		} else { | 
                                                        
| 679 | -			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  ); | 
                                                        |
| 679 | +			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 680 | 680 | }  | 
                                                        
| 681 | 681 | |
| 682 | -		if ( defined('DOING_AJAX' ) ) | 
                                                        |
| 682 | +		if (defined('DOING_AJAX')) | 
                                                        |
| 683 | 683 | return $new_status;  | 
                                                        
| 684 | 684 | |
| 685 | - $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );  | 
                                                        |
| 685 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 686 | 686 | |
| 687 | 687 | }  | 
                                                        
| 688 | 688 | |
@@ -698,11 +698,11 @@ discard block  | 
                                                    ||
| 698 | 698 | */  | 
                                                        
| 699 | 699 |  	private function _toggle_checkin($REG_ID, $DTT_ID) { | 
                                                        
| 700 | 700 | $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);  | 
                                                        
| 701 | - $new_status = $REG->toggle_checkin_status( $DTT_ID );  | 
                                                        |
| 702 | -		if ( $new_status !== FALSE ) { | 
                                                        |
| 703 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );  | 
                                                        |
| 701 | + $new_status = $REG->toggle_checkin_status($DTT_ID);  | 
                                                        |
| 702 | +		if ($new_status !== FALSE) { | 
                                                        |
| 703 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID));  | 
                                                        |
| 704 | 704 |  		} else { | 
                                                        
| 705 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );  | 
                                                        |
| 705 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);  | 
                                                        |
| 706 | 706 | $new_status = FALSE;  | 
                                                        
| 707 | 707 | }  | 
                                                        
| 708 | 708 | return $new_status;  | 
                                                        
@@ -718,28 +718,28 @@ discard block  | 
                                                    ||
| 718 | 718 |  	protected function _delete_checkin_rows() { | 
                                                        
| 719 | 719 | $query_args = array(  | 
                                                        
| 720 | 720 | 'action' => 'registration_checkins',  | 
                                                        
| 721 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,  | 
                                                        |
| 722 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0  | 
                                                        |
| 721 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,  | 
                                                        |
| 722 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0  | 
                                                        |
| 723 | 723 | );  | 
                                                        
| 724 | -		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { | 
                                                        |
| 725 | -			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { | 
                                                        |
| 724 | +		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 725 | +			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 726 | 726 | $errors = 0;  | 
                                                        
| 727 | -				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) { | 
                                                        |
| 727 | +				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { | 
                                                        |
| 728 | 728 | $errors++;  | 
                                                        
| 729 | 729 | }  | 
                                                        
| 730 | 730 | }  | 
                                                        
| 731 | 731 |  		} else { | 
                                                        
| 732 | -			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 733 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 732 | +			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 733 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 734 | 734 | }  | 
                                                        
| 735 | 735 | |
| 736 | -		if ( $errors > 0 ) { | 
                                                        |
| 737 | -			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 736 | +		if ($errors > 0) { | 
                                                        |
| 737 | +			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 738 | 738 |  		} else { | 
                                                        
| 739 | -			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') ); | 
                                                        |
| 739 | +			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); | 
                                                        |
| 740 | 740 | }  | 
                                                        
| 741 | 741 | |
| 742 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 742 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 743 | 743 | }  | 
                                                        
| 744 | 744 | |
| 745 | 745 | |
@@ -751,20 +751,20 @@ discard block  | 
                                                    ||
| 751 | 751 |  	protected function _delete_checkin_row() { | 
                                                        
| 752 | 752 | $query_args = array(  | 
                                                        
| 753 | 753 | 'action' => 'registration_checkins',  | 
                                                        
| 754 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,  | 
                                                        |
| 755 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0  | 
                                                        |
| 754 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,  | 
                                                        |
| 755 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0  | 
                                                        |
| 756 | 756 | );  | 
                                                        
| 757 | 757 | |
| 758 | -		if ( !empty( $this->_req_data['CHK_ID'] ) ) { | 
                                                        |
| 759 | -			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) { | 
                                                        |
| 760 | -				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 758 | +		if ( ! empty($this->_req_data['CHK_ID'])) { | 
                                                        |
| 759 | +			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { | 
                                                        |
| 760 | +				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 761 | 761 |  			} else { | 
                                                        
| 762 | -				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') ); | 
                                                        |
| 762 | +				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); | 
                                                        |
| 763 | 763 | }  | 
                                                        
| 764 | 764 |  		} else { | 
                                                        
| 765 | -			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); | 
                                                        |
| 765 | +			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); | 
                                                        |
| 766 | 766 | }  | 
                                                        
| 767 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );  | 
                                                        |
| 767 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);  | 
                                                        |
| 768 | 768 | }  | 
                                                        
| 769 | 769 | |
| 770 | 770 | |
@@ -777,8 +777,8 @@ discard block  | 
                                                    ||
| 777 | 777 | * @return void  | 
                                                        
| 778 | 778 | */  | 
                                                        
| 779 | 779 |  	protected function _event_registrations_list_table() { | 
                                                        
| 780 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 781 | -		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; | 
                                                        |
| 780 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 781 | +		$this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; | 
                                                        |
| 782 | 782 | |
| 783 | 783 | $legend_items = array(  | 
                                                        
| 784 | 784 | 'star-icon' => array(  | 
                                                        
@@ -802,31 +802,31 @@ discard block  | 
                                                    ||
| 802 | 802 |  				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso') | 
                                                        
| 803 | 803 | ),  | 
                                                        
| 804 | 804 | 'approved_status' => array(  | 
                                                        
| 805 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,  | 
                                                        |
| 806 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )  | 
                                                        |
| 805 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,  | 
                                                        |
| 806 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')  | 
                                                        |
| 807 | 807 | ),  | 
                                                        
| 808 | 808 | 'cancelled_status' => array(  | 
                                                        
| 809 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,  | 
                                                        |
| 810 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )  | 
                                                        |
| 809 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,  | 
                                                        |
| 810 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')  | 
                                                        |
| 811 | 811 | ),  | 
                                                        
| 812 | 812 | 'declined_status' => array(  | 
                                                        
| 813 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,  | 
                                                        |
| 814 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )  | 
                                                        |
| 813 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,  | 
                                                        |
| 814 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')  | 
                                                        |
| 815 | 815 | ),  | 
                                                        
| 816 | 816 | 'not_approved' => array(  | 
                                                        
| 817 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,  | 
                                                        |
| 818 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )  | 
                                                        |
| 817 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,  | 
                                                        |
| 818 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')  | 
                                                        |
| 819 | 819 | ),  | 
                                                        
| 820 | 820 | 'pending_status' => array(  | 
                                                        
| 821 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,  | 
                                                        |
| 822 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )  | 
                                                        |
| 821 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,  | 
                                                        |
| 822 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')  | 
                                                        |
| 823 | 823 | )/**/  | 
                                                        
| 824 | 824 | );  | 
                                                        
| 825 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );  | 
                                                        |
| 825 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);  | 
                                                        |
| 826 | 826 | |
| 827 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;  | 
                                                        |
| 828 | -		$this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : ''; | 
                                                        |
| 829 | - $this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';  | 
                                                        |
| 827 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;  | 
                                                        |
| 828 | +		$this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : ''; | 
                                                        |
| 829 | + $this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';  | 
                                                        |
| 830 | 830 | |
| 831 | 831 | $this->display_admin_list_table_page_with_no_sidebar();  | 
                                                        
| 832 | 832 | }  | 
                                                        
@@ -840,15 +840,15 @@ discard block  | 
                                                    ||
| 840 | 840 | * @access public  | 
                                                        
| 841 | 841 | * @return array  | 
                                                        
| 842 | 842 | */  | 
                                                        
| 843 | -	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { | 
                                                        |
| 843 | +	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') { | 
                                                        |
| 844 | 844 | |
| 845 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );  | 
                                                        |
| 846 | - require_once(EE_MODELS . 'EEM_Attendee.model.php');  | 
                                                        |
| 845 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 846 | + require_once(EE_MODELS.'EEM_Attendee.model.php');  | 
                                                        |
| 847 | 847 | //$ATT_MDL = EEM_Attendee::instance();  | 
                                                        
| 848 | 848 | |
| 849 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;  | 
                                                        |
| 850 | - $CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;  | 
                                                        |
| 851 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 849 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;  | 
                                                        |
| 850 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;  | 
                                                        |
| 851 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;  | 
                                                        |
| 852 | 852 | |
| 853 | 853 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;  | 
                                                        
| 854 | 854 | |
@@ -861,94 +861,94 @@ discard block  | 
                                                    ||
| 861 | 861 | // $orderby = 'reg.REG_final_price';  | 
                                                        
| 862 | 862 | }  | 
                                                        
| 863 | 863 | |
| 864 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';  | 
                                                        |
| 864 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';  | 
                                                        |
| 865 | 865 | |
| 866 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 867 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;  | 
                                                        |
| 866 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;  | 
                                                        |
| 867 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;  | 
                                                        |
| 868 | 868 | |
| 869 | 869 | |
| 870 | - $offset = ($current_page-1)*$per_page;  | 
                                                        |
| 871 | - $limit = $count ? NULL : array( $offset, $per_page );  | 
                                                        |
| 872 | -		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array())))); | 
                                                        |
| 873 | -		if ($EVT_ID){ | 
                                                        |
| 874 | - $query_params[0]['EVT_ID']=$EVT_ID;  | 
                                                        |
| 870 | + $offset = ($current_page - 1) * $per_page;  | 
                                                        |
| 871 | + $limit = $count ? NULL : array($offset, $per_page);  | 
                                                        |
| 872 | +		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); | 
                                                        |
| 873 | +		if ($EVT_ID) { | 
                                                        |
| 874 | + $query_params[0]['EVT_ID'] = $EVT_ID;  | 
                                                        |
| 875 | 875 | }  | 
                                                        
| 876 | -		if($CAT_ID){ | 
                                                        |
| 876 | +		if ($CAT_ID) { | 
                                                        |
| 877 | 877 |  			throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?"); | 
                                                        
| 878 | 878 | }  | 
                                                        
| 879 | 879 | |
| 880 | 880 | //if DTT is included we do multiple datetimes.  | 
                                                        
| 881 | -		if ( $DTT_ID ) { | 
                                                        |
| 881 | +		if ($DTT_ID) { | 
                                                        |
| 882 | 882 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;  | 
                                                        
| 883 | 883 | }  | 
                                                        
| 884 | 884 | |
| 885 | 885 | //make sure we only have default where on the current regs  | 
                                                        
| 886 | 886 | $query_params['default_where_conditions'] = 'this_model_only';  | 
                                                        
| 887 | 887 | |
| 888 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );  | 
                                                        |
| 888 | +		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); | 
                                                        |
| 889 | 889 | |
| 890 | -		$query_params[0]['STS_ID']= array('IN', $status_ids_array ); | 
                                                        |
| 890 | +		$query_params[0]['STS_ID'] = array('IN', $status_ids_array); | 
                                                        |
| 891 | 891 | |
| 892 | -		if($trash){ | 
                                                        |
| 893 | - $query_params[0]['Attendee.status']= EEM_CPT_Base::post_status_trashed;  | 
                                                        |
| 892 | +		if ($trash) { | 
                                                        |
| 893 | + $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;  | 
                                                        |
| 894 | 894 | }  | 
                                                        
| 895 | 895 | |
| 896 | -		if ( isset( $this->_req_data['s'] ) ) { | 
                                                        |
| 897 | - $sstr = '%' . $this->_req_data['s'] . '%';  | 
                                                        |
| 896 | +		if (isset($this->_req_data['s'])) { | 
                                                        |
| 897 | + $sstr = '%'.$this->_req_data['s'].'%';  | 
                                                        |
| 898 | 898 | $query_params[0]['OR'] = array(  | 
                                                        
| 899 | - 'Event.EVT_name' => array( 'LIKE', $sstr),  | 
                                                        |
| 900 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ),  | 
                                                        |
| 901 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 902 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ),  | 
                                                        |
| 903 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ),  | 
                                                        |
| 904 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),  | 
                                                        |
| 905 | -				'Attendee.ATT_email' => array('LIKE', $sstr ), | 
                                                        |
| 906 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ),  | 
                                                        |
| 907 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ),  | 
                                                        |
| 908 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ),  | 
                                                        |
| 909 | - 'REG_final_price' => array( 'LIKE', $sstr ),  | 
                                                        |
| 910 | - 'REG_code' => array( 'LIKE', $sstr ),  | 
                                                        |
| 911 | - 'REG_count' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 912 | - 'REG_group_size' => array( 'LIKE' , $sstr ),  | 
                                                        |
| 913 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ),  | 
                                                        |
| 914 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr )  | 
                                                        |
| 899 | +				'Event.EVT_name' => array('LIKE', $sstr), | 
                                                        |
| 900 | +				'Event.EVT_desc' => array('LIKE', $sstr), | 
                                                        |
| 901 | +				'Event.EVT_short_desc' => array('LIKE', $sstr), | 
                                                        |
| 902 | +				'Attendee.ATT_fname' => array('LIKE', $sstr), | 
                                                        |
| 903 | +				'Attendee.ATT_lname' => array('LIKE', $sstr), | 
                                                        |
| 904 | +				'Attendee.ATT_short_bio' => array('LIKE', $sstr), | 
                                                        |
| 905 | +				'Attendee.ATT_email' => array('LIKE', $sstr), | 
                                                        |
| 906 | +				'Attendee.ATT_address' => array('LIKE', $sstr), | 
                                                        |
| 907 | +				'Attendee.ATT_address2' => array('LIKE', $sstr), | 
                                                        |
| 908 | +				'Attendee.ATT_city' => array('LIKE', $sstr), | 
                                                        |
| 909 | +				'REG_final_price' => array('LIKE', $sstr), | 
                                                        |
| 910 | +				'REG_code' => array('LIKE', $sstr), | 
                                                        |
| 911 | +				'REG_count' => array('LIKE', $sstr), | 
                                                        |
| 912 | +				'REG_group_size' => array('LIKE', $sstr), | 
                                                        |
| 913 | +				'Ticket.TKT_name' => array('LIKE', $sstr), | 
                                                        |
| 914 | +				'Ticket.TKT_description' => array('LIKE', $sstr) | 
                                                        |
| 915 | 915 | );  | 
                                                        
| 916 | 916 | }  | 
                                                        
| 917 | 917 | |
| 918 | 918 | $query_params['order_by'][$orderby] = $sort;  | 
                                                        
| 919 | 919 | $query_params['limit'] = $limit;  | 
                                                        
| 920 | -		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration | 
                                                        |
| 921 | -		if($count){ | 
                                                        |
| 922 | - $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' ));  | 
                                                        |
| 923 | -		}else{ | 
                                                        |
| 920 | +		$query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration | 
                                                        |
| 921 | +		if ($count) { | 
                                                        |
| 922 | + $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only'));  | 
                                                        |
| 923 | +		} else { | 
                                                        |
| 924 | 924 | $registrations = EEM_Registration::instance()->get_all($query_params);  | 
                                                        
| 925 | 925 | |
| 926 | 926 | |
| 927 | 927 | // $registrations = EEM_Registration::instance();  | 
                                                        
| 928 | 928 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );  | 
                                                        
| 929 | -			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { | 
                                                        |
| 929 | +			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { | 
                                                        |
| 930 | 930 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );  | 
                                                        
| 931 | 931 | // name  | 
                                                        
| 932 | 932 | $first_registration = $registrations[0];  | 
                                                        
| 933 | 933 | $event_obj = $first_registration->event_obj();  | 
                                                        
| 934 | -				if($event_obj){ | 
                                                        |
| 934 | +				if ($event_obj) { | 
                                                        |
| 935 | 935 | $event_name = $first_registration->event_obj()->name();  | 
                                                        
| 936 | -					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; | 
                                                        |
| 936 | +					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; | 
                                                        |
| 937 | 937 | // edit event link  | 
                                                        
| 938 | -					if ( $event_name != '' ) { | 
                                                        |
| 939 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );  | 
                                                        |
| 940 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';  | 
                                                        |
| 941 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;  | 
                                                        |
| 938 | +					if ($event_name != '') { | 
                                                        |
| 939 | +						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); | 
                                                        |
| 940 | +						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; | 
                                                        |
| 941 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';  | 
                                                        |
| 942 | 942 | }  | 
                                                        
| 943 | 943 | |
| 944 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );  | 
                                                        |
| 945 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';  | 
                                                        |
| 944 | +					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); | 
                                                        |
| 945 | +					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; | 
                                                        |
| 946 | 946 | |
| 947 | 947 | $this->_template_args['before_admin_page_content'] = '  | 
                                                        
| 948 | 948 | <div id="admin-page-header">  | 
                                                        
| 949 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>  | 
                                                        |
| 950 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>  | 
                                                        |
| 951 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>  | 
                                                        |
| 949 | +					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> | 
                                                        |
| 950 | +					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> | 
                                                        |
| 951 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>  | 
                                                        |
| 952 | 952 | </div>  | 
                                                        
| 953 | 953 | ';  | 
                                                        
| 954 | 954 | }  | 
                                                        
@@ -135,7 +135,7 @@ discard block  | 
                                                    ||
| 135 | 135 | *  | 
                                                        
| 136 | 136 | * @access private  | 
                                                        
| 137 | 137 | * @param string $period  | 
                                                        
| 138 | - * @return int  | 
                                                        |
| 138 | + * @return string  | 
                                                        |
| 139 | 139 | */  | 
                                                        
| 140 | 140 |  	private function _revenue_per_day_report( $period = '-1 month' ) { | 
                                                        
| 141 | 141 | |
@@ -193,7 +193,7 @@ discard block  | 
                                                    ||
| 193 | 193 | *  | 
                                                        
| 194 | 194 | * @access private  | 
                                                        
| 195 | 195 | * @param string $period  | 
                                                        
| 196 | - * @return int  | 
                                                        |
| 196 | + * @return string  | 
                                                        |
| 197 | 197 | */  | 
                                                        
| 198 | 198 |  	private function _revenue_per_event_report( $period = '-1 month' ) { | 
                                                        
| 199 | 199 | |
@@ -105,10 +105,10 @@  | 
                                                    ||
| 105 | 105 | /**  | 
                                                        
| 106 | 106 | * _transaction_reports  | 
                                                        
| 107 | 107 | * generates Business Reports regarding Transactions  | 
                                                        
| 108 | - *  | 
                                                        |
| 108 | + *  | 
                                                        |
| 109 | 109 | * @access protected  | 
                                                        
| 110 | - * @return void  | 
                                                        |
| 111 | - */  | 
                                                        |
| 110 | + * @return void  | 
                                                        |
| 111 | + */  | 
                                                        |
| 112 | 112 |  	protected function _transaction_reports() { | 
                                                        
| 113 | 113 | |
| 114 | 114 | $page_args = array();  | 
                                                        
@@ -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 | /**  | 
                                                        
@@ -35,11 +35,11 @@ discard block  | 
                                                    ||
| 35 | 35 | * @param bool $routing  | 
                                                        
| 36 | 36 | * @return \Extend_Transactions_Admin_Page  | 
                                                        
| 37 | 37 | */  | 
                                                        
| 38 | -	public function __construct( $routing = TRUE ) { | 
                                                        |
| 39 | - parent::__construct( $routing );  | 
                                                        |
| 40 | - define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/');  | 
                                                        |
| 41 | - define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/');  | 
                                                        |
| 42 | - define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/');  | 
                                                        |
| 38 | +	public function __construct($routing = TRUE) { | 
                                                        |
| 39 | + parent::__construct($routing);  | 
                                                        |
| 40 | +		define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/'); | 
                                                        |
| 41 | +		define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/'); | 
                                                        |
| 42 | +		define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/'); | 
                                                        |
| 43 | 43 | }  | 
                                                        
| 44 | 44 | |
| 45 | 45 | |
@@ -51,7 +51,7 @@ discard block  | 
                                                    ||
| 51 | 51 | * @return void  | 
                                                        
| 52 | 52 | */  | 
                                                        
| 53 | 53 |  	protected function _extend_page_config() { | 
                                                        
| 54 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions';  | 
                                                        |
| 54 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions';  | 
                                                        |
| 55 | 55 | |
| 56 | 56 | $new_page_routes = array(  | 
                                                        
| 57 | 57 | 'reports' => array(  | 
                                                        
@@ -60,7 +60,7 @@ discard block  | 
                                                    ||
| 60 | 60 | )  | 
                                                        
| 61 | 61 | );  | 
                                                        
| 62 | 62 | |
| 63 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );  | 
                                                        |
| 63 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);  | 
                                                        |
| 64 | 64 | |
| 65 | 65 | $new_page_config = array(  | 
                                                        
| 66 | 66 | 'reports' => array(  | 
                                                        
@@ -74,11 +74,11 @@ discard block  | 
                                                    ||
| 74 | 74 | 'filename' => 'transactions_reports'  | 
                                                        
| 75 | 75 | )  | 
                                                        
| 76 | 76 | ),  | 
                                                        
| 77 | - 'help_tour' => array( 'Transaction_Reports_Help_Tour' ),  | 
                                                        |
| 77 | +				'help_tour' => array('Transaction_Reports_Help_Tour'), | 
                                                        |
| 78 | 78 | 'require_nonce' => FALSE  | 
                                                        
| 79 | 79 | )  | 
                                                        
| 80 | 80 | );  | 
                                                        
| 81 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config );  | 
                                                        |
| 81 | + $this->_page_config = array_merge($this->_page_config, $new_page_config);  | 
                                                        |
| 82 | 82 | }  | 
                                                        
| 83 | 83 | |
| 84 | 84 | |
@@ -94,8 +94,8 @@ discard block  | 
                                                    ||
| 94 | 94 |  		wp_enqueue_style('jquery-jqplot-css'); | 
                                                        
| 95 | 95 | //scripts  | 
                                                        
| 96 | 96 | global $is_IE;  | 
                                                        
| 97 | -		if ( $is_IE ) { | 
                                                        |
| 98 | - wp_enqueue_script( 'excanvas' );  | 
                                                        |
| 97 | +		if ($is_IE) { | 
                                                        |
| 98 | +			wp_enqueue_script('excanvas'); | 
                                                        |
| 99 | 99 | }  | 
                                                        
| 100 | 100 |  		wp_enqueue_script('jqplot-all'); | 
                                                        
| 101 | 101 | }  | 
                                                        
@@ -113,13 +113,13 @@ discard block  | 
                                                    ||
| 113 | 113 | |
| 114 | 114 | $page_args = array();  | 
                                                        
| 115 | 115 | |
| 116 | - $page_args['admin_reports'][] = $this->_revenue_per_day_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month'  | 
                                                        |
| 117 | - $page_args['admin_reports'][] = $this->_revenue_per_event_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month'  | 
                                                        |
| 116 | +		$page_args['admin_reports'][] = $this->_revenue_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month' | 
                                                        |
| 117 | +		$page_args['admin_reports'][] = $this->_revenue_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month' | 
                                                        |
| 118 | 118 | // $page_args['admin_reports'][] = 'chart1';  | 
                                                        
| 119 | 119 | |
| 120 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';  | 
                                                        |
| 120 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';  | 
                                                        |
| 121 | 121 |  		$this->_admin_page_title = __('Transactions', 'event_espresso'); | 
                                                        
| 122 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );  | 
                                                        |
| 122 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);  | 
                                                        |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | // the final template wrapper  | 
                                                        
@@ -137,37 +137,37 @@ discard block  | 
                                                    ||
| 137 | 137 | * @param string $period  | 
                                                        
| 138 | 138 | * @return int  | 
                                                        
| 139 | 139 | */  | 
                                                        
| 140 | -	private function _revenue_per_day_report( $period = '-1 month' ) { | 
                                                        |
| 140 | +	private function _revenue_per_day_report($period = '-1 month') { | 
                                                        |
| 141 | 141 | |
| 142 | 142 | $report_ID = 'txn-admin-revenue-per-day-report-dv';  | 
                                                        
| 143 | 143 | $report_JS = 'espresso_txn_admin_revenue_per_day';  | 
                                                        
| 144 | 144 | |
| 145 | -		wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); | 
                                                        |
| 145 | +		wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); | 
                                                        |
| 146 | 146 | |
| 147 | 147 | $TXN = EEM_Transaction::instance();  | 
                                                        
| 148 | 148 | |
| 149 | - $results = $TXN->get_revenue_per_day_report( $period );  | 
                                                        |
| 149 | + $results = $TXN->get_revenue_per_day_report($period);  | 
                                                        |
| 150 | 150 | //EEH_Debug_Tools::printr( $results, '$registrations_per_day' );  | 
                                                        
| 151 | 151 | $revenue = array();  | 
                                                        
| 152 | - $xmin = date( 'Y-m-d', strtotime( '+1 year' ));  | 
                                                        |
| 152 | +		$xmin = date('Y-m-d', strtotime('+1 year')); | 
                                                        |
| 153 | 153 | $xmax = 0;  | 
                                                        
| 154 | 154 | $ymax = 0;  | 
                                                        
| 155 | 155 | |
| 156 | 156 | $results = (array) $results;  | 
                                                        
| 157 | 157 | |
| 158 | -		foreach ( $results as $result ) { | 
                                                        |
| 159 | - $revenue[] = array( $result->txnDate, (float)$result->revenue );  | 
                                                        |
| 160 | - $xmin = strtotime( $result->txnDate ) < strtotime( $xmin ) ? $result->txnDate : $xmin;  | 
                                                        |
| 161 | - $xmax = strtotime( $result->txnDate ) > strtotime( $xmax ) ? $result->txnDate : $xmax;  | 
                                                        |
| 158 | +		foreach ($results as $result) { | 
                                                        |
| 159 | + $revenue[] = array($result->txnDate, (float) $result->revenue);  | 
                                                        |
| 160 | + $xmin = strtotime($result->txnDate) < strtotime($xmin) ? $result->txnDate : $xmin;  | 
                                                        |
| 161 | + $xmax = strtotime($result->txnDate) > strtotime($xmax) ? $result->txnDate : $xmax;  | 
                                                        |
| 162 | 162 | $ymax = $result->revenue > $ymax ? $result->revenue : $ymax;  | 
                                                        
| 163 | 163 | }  | 
                                                        
| 164 | 164 | |
| 165 | - $xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));  | 
                                                        |
| 166 | - $xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));  | 
                                                        |
| 165 | +		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day')); | 
                                                        |
| 166 | +		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day')); | 
                                                        |
| 167 | 167 | // calculate # days between our min and max dates  | 
                                                        
| 168 | - $span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;  | 
                                                        |
| 168 | + $span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;  | 
                                                        |
| 169 | 169 | |
| 170 | - $report_title = __( 'Total Revenue per Day' );  | 
                                                        |
| 170 | +		$report_title = __('Total Revenue per Day'); | 
                                                        |
| 171 | 171 | |
| 172 | 172 | $report_params = array(  | 
                                                        
| 173 | 173 | 'title' => $report_title,  | 
                                                        
@@ -178,9 +178,9 @@ discard block  | 
                                                    ||
| 178 | 178 | 'ymax' => ceil($ymax * 1.25),  | 
                                                        
| 179 | 179 | 'span' => $span,  | 
                                                        
| 180 | 180 | 'width' => ceil(900 / $span),  | 
                                                        
| 181 | -			'noTxnMsg'	=> sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) | 
                                                        |
| 181 | +			'noTxnMsg'	=> sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) | 
                                                        |
| 182 | 182 | );  | 
                                                        
| 183 | - wp_localize_script( $report_JS, 'txnRevPerDay', $report_params );  | 
                                                        |
| 183 | + wp_localize_script($report_JS, 'txnRevPerDay', $report_params);  | 
                                                        |
| 184 | 184 | |
| 185 | 185 | return $report_ID;  | 
                                                        
| 186 | 186 | }  | 
                                                        
@@ -195,29 +195,29 @@ discard block  | 
                                                    ||
| 195 | 195 | * @param string $period  | 
                                                        
| 196 | 196 | * @return int  | 
                                                        
| 197 | 197 | */  | 
                                                        
| 198 | -	private function _revenue_per_event_report( $period = '-1 month' ) { | 
                                                        |
| 198 | +	private function _revenue_per_event_report($period = '-1 month') { | 
                                                        |
| 199 | 199 | |
| 200 | 200 | $report_ID = 'txn-admin-revenue-per-event-report-dv';  | 
                                                        
| 201 | 201 | $report_JS = 'espresso_txn_admin_revenue_per_event';  | 
                                                        
| 202 | 202 | |
| 203 | -		wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); | 
                                                        |
| 203 | +		wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); | 
                                                        |
| 204 | 204 | |
| 205 | 205 | $TXN = EEM_Transaction::instance();  | 
                                                        
| 206 | 206 | |
| 207 | - $results = $TXN->get_revenue_per_event_report( $period );  | 
                                                        |
| 207 | + $results = $TXN->get_revenue_per_event_report($period);  | 
                                                        |
| 208 | 208 | |
| 209 | 209 | //EEH_Debug_Tools::printr( $results, '$registrations_per_event' );  | 
                                                        
| 210 | 210 | $revenue = array();  | 
                                                        
| 211 | 211 | $results = (array) $results;  | 
                                                        
| 212 | -		foreach ( $results as $result ) { | 
                                                        |
| 213 | - $event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ));  | 
                                                        |
| 214 | - $event_name = wp_trim_words( $event_name, 5, '...' );  | 
                                                        |
| 215 | - $revenue[] = array( $event_name, (float)$result->revenue );  | 
                                                        |
| 212 | +		foreach ($results as $result) { | 
                                                        |
| 213 | + $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8'));  | 
                                                        |
| 214 | + $event_name = wp_trim_words($event_name, 5, '...');  | 
                                                        |
| 215 | + $revenue[] = array($event_name, (float) $result->revenue);  | 
                                                        |
| 216 | 216 | }  | 
                                                        
| 217 | 217 | |
| 218 | 218 | $span = $period == 'week' ? 9 : 33;  | 
                                                        
| 219 | 219 | |
| 220 | - $report_title = __( 'Total Revenue per Event' );  | 
                                                        |
| 220 | +		$report_title = __('Total Revenue per Event'); | 
                                                        |
| 221 | 221 | |
| 222 | 222 | $report_params = array(  | 
                                                        
| 223 | 223 | 'title' => $report_title,  | 
                                                        
@@ -225,9 +225,9 @@ discard block  | 
                                                    ||
| 225 | 225 | 'revenue' => $revenue,  | 
                                                        
| 226 | 226 | 'span' => $span,  | 
                                                        
| 227 | 227 | 'width' => ceil(900 / $span),  | 
                                                        
| 228 | -			'noTxnMsg'	=> sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) | 
                                                        |
| 228 | +			'noTxnMsg'	=> sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) | 
                                                        |
| 229 | 229 | );  | 
                                                        
| 230 | - wp_localize_script( $report_JS, 'revenuePerEvent', $report_params );  | 
                                                        |
| 230 | + wp_localize_script($report_JS, 'revenuePerEvent', $report_params);  | 
                                                        |
| 231 | 231 | |
| 232 | 232 | return $report_ID;  | 
                                                        
| 233 | 233 | }  | 
                                                        
@@ -6,8 +6,9 @@  | 
                                                    ||
| 6 | 6 | * @package Event Espresso  | 
                                                        
| 7 | 7 | * @subpackage messages  | 
                                                        
| 8 | 8 | */  | 
                                                        
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) | 
                                                        |
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { | 
                                                        |
| 10 | 10 |  	exit('NO direct script access allowed'); | 
                                                        
| 11 | +}  | 
                                                        |
| 11 | 12 | |
| 12 | 13 | /**  | 
                                                        
| 13 | 14 | *  | 
                                                        
@@ -56,7 +56,7 @@  | 
                                                    ||
| 56 | 56 | /**  | 
                                                        
| 57 | 57 | * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths  | 
                                                        
| 58 | 58 | * @param array $paths original helper paths array  | 
                                                        
| 59 | - * @return array new array of paths  | 
                                                        |
| 59 | + * @return string[] new array of paths  | 
                                                        |
| 60 | 60 | */  | 
                                                        
| 61 | 61 |  	public function caf_helper_paths( $paths ) { | 
                                                        
| 62 | 62 | $paths[] = EE_CAF_CORE . 'helpers' . DS;  | 
                                                        
@@ -1,29 +1,29 @@  | 
                                                    ||
| 1 | 1 |  <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file.  | 
                                                        |
| 4 | - */  | 
                                                        |
| 3 | + * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file.  | 
                                                        |
| 4 | + */  | 
                                                        |
| 5 | 5 | /**  | 
                                                        
| 6 | - * Event Espresso  | 
                                                        |
| 7 | - *  | 
                                                        |
| 8 | - * Event Registration and Management Plugin for WordPress  | 
                                                        |
| 9 | - *  | 
                                                        |
| 10 | - * @ package Event Espresso  | 
                                                        |
| 11 | - * @ author Seth Shoultes  | 
                                                        |
| 12 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved.  | 
                                                        |
| 13 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing *  | 
                                                        |
| 14 | - * @ link http://www.eventespresso.com  | 
                                                        |
| 15 | - * @ version 4.0  | 
                                                        |
| 16 | - *  | 
                                                        |
| 17 | - * ------------------------------------------------------------------------  | 
                                                        |
| 18 | - *  | 
                                                        |
| 19 | - * EE_Brewing_Regular class. Just a wrapper to help namespace activity for the functionality of this file.  | 
                                                        |
| 20 | - *  | 
                                                        |
| 21 | - * @package Event Espresso  | 
                                                        |
| 22 | - * @subpackage /caffeinated/brewing_regular.php  | 
                                                        |
| 23 | - * @author Darren Ethier  | 
                                                        |
| 24 | - *  | 
                                                        |
| 25 | - * ------------------------------------------------------------------------  | 
                                                        |
| 26 | - */  | 
                                                        |
| 6 | + * Event Espresso  | 
                                                        |
| 7 | + *  | 
                                                        |
| 8 | + * Event Registration and Management Plugin for WordPress  | 
                                                        |
| 9 | + *  | 
                                                        |
| 10 | + * @ package Event Espresso  | 
                                                        |
| 11 | + * @ author Seth Shoultes  | 
                                                        |
| 12 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved.  | 
                                                        |
| 13 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing *  | 
                                                        |
| 14 | + * @ link http://www.eventespresso.com  | 
                                                        |
| 15 | + * @ version 4.0  | 
                                                        |
| 16 | + *  | 
                                                        |
| 17 | + * ------------------------------------------------------------------------  | 
                                                        |
| 18 | + *  | 
                                                        |
| 19 | + * EE_Brewing_Regular class. Just a wrapper to help namespace activity for the functionality of this file.  | 
                                                        |
| 20 | + *  | 
                                                        |
| 21 | + * @package Event Espresso  | 
                                                        |
| 22 | + * @subpackage /caffeinated/brewing_regular.php  | 
                                                        |
| 23 | + * @author Darren Ethier  | 
                                                        |
| 24 | + *  | 
                                                        |
| 25 | + * ------------------------------------------------------------------------  | 
                                                        |
| 26 | + */  | 
                                                        |
| 27 | 27 | // defined some new constants related to caffeinated folder  | 
                                                        
| 28 | 28 |  define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); | 
                                                        
| 29 | 29 |  define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); | 
                                                        
@@ -25,30 +25,30 @@ discard block  | 
                                                    ||
| 25 | 25 | * ------------------------------------------------------------------------  | 
                                                        
| 26 | 26 | */  | 
                                                        
| 27 | 27 | // defined some new constants related to caffeinated folder  | 
                                                        
| 28 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); | 
                                                        |
| 29 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); | 
                                                        |
| 30 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); | 
                                                        |
| 31 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); | 
                                                        |
| 28 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); | 
                                                        |
| 29 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); | 
                                                        |
| 30 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); | 
                                                        |
| 31 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); | 
                                                        |
| 32 | 32 |  class EE_Brewing_Regular extends EE_Base { | 
                                                        
| 33 | 33 | |
| 34 | 34 |  	public function __construct() { | 
                                                        
| 35 | -		if ( defined( 'EE_CAFF_PATH' )) { | 
                                                        |
| 35 | +		if (defined('EE_CAFF_PATH')) { | 
                                                        |
| 36 | 36 | // activation  | 
                                                        
| 37 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ));  | 
                                                        |
| 37 | +			add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); | 
                                                        |
| 38 | 38 | // load caff init  | 
                                                        
| 39 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ));  | 
                                                        |
| 39 | +			add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); | 
                                                        |
| 40 | 40 | // make it so the PDF receipt doesn't show our shameless plug  | 
                                                        
| 41 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' );  | 
                                                        |
| 41 | +			add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); | 
                                                        |
| 42 | 42 | // add caffeinated modules  | 
                                                        
| 43 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' ));  | 
                                                        |
| 43 | +			add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); | 
                                                        |
| 44 | 44 | // load caff scripts  | 
                                                        
| 45 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 );  | 
                                                        |
| 45 | +			add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); | 
                                                        |
| 46 | 46 | |
| 47 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 );  | 
                                                        |
| 47 | +			add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); | 
                                                        |
| 48 | 48 | |
| 49 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) );  | 
                                                        |
| 49 | +			add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); | 
                                                        |
| 50 | 50 | // caffeinated constructed  | 
                                                        
| 51 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' );  | 
                                                        |
| 51 | +			do_action('AHEE__EE_Brewing_Regular__construct__complete'); | 
                                                        |
| 52 | 52 | }  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | |
@@ -58,8 +58,8 @@ discard block  | 
                                                    ||
| 58 | 58 | * @param array $paths original helper paths array  | 
                                                        
| 59 | 59 | * @return array new array of paths  | 
                                                        
| 60 | 60 | */  | 
                                                        
| 61 | -	public function caf_helper_paths( $paths ) { | 
                                                        |
| 62 | - $paths[] = EE_CAF_CORE . 'helpers' . DS;  | 
                                                        |
| 61 | +	public function caf_helper_paths($paths) { | 
                                                        |
| 62 | + $paths[] = EE_CAF_CORE.'helpers'.DS;  | 
                                                        |
| 63 | 63 | return $paths;  | 
                                                        
| 64 | 64 | }  | 
                                                        
| 65 | 65 | |
@@ -75,22 +75,22 @@ discard block  | 
                                                    ||
| 75 | 75 | * Right now, we ASSUME the only price types in the system are default ones  | 
                                                        
| 76 | 76 | * @global type $wpdb  | 
                                                        
| 77 | 77 | */  | 
                                                        
| 78 | -	function initialize_caf_db_content(){ | 
                                                        |
| 78 | +	function initialize_caf_db_content() { | 
                                                        |
| 79 | 79 | // echo "initialize caf db content!";  | 
                                                        
| 80 | 80 | global $wpdb;  | 
                                                        
| 81 | 81 | |
| 82 | 82 | //use same method of getting creator id as the version introducing the change  | 
                                                        
| 83 | -		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); | 
                                                        |
| 83 | +		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); | 
                                                        |
| 84 | 84 | |
| 85 | 85 | $price_type_table = $wpdb->prefix."esp_price_type";  | 
                                                        
| 86 | 86 | $price_table = $wpdb->prefix."esp_price";  | 
                                                        
| 87 | 87 | |
| 88 | 88 |  		if ($wpdb->get_var("SHOW TABLES LIKE '$price_type_table'") == $price_type_table) { | 
                                                        
| 89 | 89 | |
| 90 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types  | 
                                                        |
| 91 | - $tax_price_type_count = $wpdb->get_var( $SQL );  | 
                                                        |
| 90 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types  | 
                                                        |
| 91 | + $tax_price_type_count = $wpdb->get_var($SQL);  | 
                                                        |
| 92 | 92 | |
| 93 | -			if ( $tax_price_type_count <= 1) { | 
                                                        |
| 93 | +			if ($tax_price_type_count <= 1) { | 
                                                        |
| 94 | 94 | $result = $wpdb->insert($price_type_table,  | 
                                                        
| 95 | 95 | array(  | 
                                                        
| 96 | 96 |  							'PRT_name'=>  __("Regional Tax", "event_espresso"), | 
                                                        
@@ -101,11 +101,11 @@ discard block  | 
                                                    ||
| 101 | 101 | 'PRT_wp_user' => $default_creator_id  | 
                                                        
| 102 | 102 | ),  | 
                                                        
| 103 | 103 | array(  | 
                                                        
| 104 | - '%s',//PRT_name  | 
                                                        |
| 105 | - '%d',//PBT_id  | 
                                                        |
| 106 | - '%d',//PRT_is_percent  | 
                                                        |
| 107 | - '%d',//PRT_order  | 
                                                        |
| 108 | - '%d',//PRT_deleted  | 
                                                        |
| 104 | + '%s', //PRT_name  | 
                                                        |
| 105 | + '%d', //PBT_id  | 
                                                        |
| 106 | + '%d', //PRT_is_percent  | 
                                                        |
| 107 | + '%d', //PRT_order  | 
                                                        |
| 108 | + '%d', //PRT_deleted  | 
                                                        |
| 109 | 109 | '%d', //PRT_wp_user  | 
                                                        
| 110 | 110 | ));  | 
                                                        
| 111 | 111 | //federal tax  | 
                                                        
@@ -119,14 +119,14 @@ discard block  | 
                                                    ||
| 119 | 119 | 'PRT_wp_user' => $default_creator_id,  | 
                                                        
| 120 | 120 | ),  | 
                                                        
| 121 | 121 | array(  | 
                                                        
| 122 | - '%s',//PRT_name  | 
                                                        |
| 123 | - '%d',//PBT_id  | 
                                                        |
| 124 | - '%d',//PRT_is_percent  | 
                                                        |
| 125 | - '%d',//PRT_order  | 
                                                        |
| 126 | - '%d',//PRT_deleted  | 
                                                        |
| 122 | + '%s', //PRT_name  | 
                                                        |
| 123 | + '%d', //PBT_id  | 
                                                        |
| 124 | + '%d', //PRT_is_percent  | 
                                                        |
| 125 | + '%d', //PRT_order  | 
                                                        |
| 126 | + '%d', //PRT_deleted  | 
                                                        |
| 127 | 127 | '%d' //PRT_wp_user  | 
                                                        
| 128 | 128 | ));  | 
                                                        
| 129 | -				if( $result){ | 
                                                        |
| 129 | +				if ($result) { | 
                                                        |
| 130 | 130 | $wpdb->insert($price_table,  | 
                                                        
| 131 | 131 | array(  | 
                                                        
| 132 | 132 | 'PRT_ID'=>$wpdb->insert_id,  | 
                                                        
@@ -141,15 +141,15 @@ discard block  | 
                                                    ||
| 141 | 141 | 'PRC_wp_user' => $default_creator_id  | 
                                                        
| 142 | 142 | ),  | 
                                                        
| 143 | 143 | array(  | 
                                                        
| 144 | - '%d',//PRT_id  | 
                                                        |
| 145 | - '%f',//PRC_amount  | 
                                                        |
| 146 | - '%s',//PRC_name  | 
                                                        |
| 147 | - '%s',//PRC_desc  | 
                                                        |
| 148 | - '%d',//PRC_is_default  | 
                                                        |
| 149 | - '%d',//PRC_overrides  | 
                                                        |
| 150 | - '%d',//PRC_deleted  | 
                                                        |
| 151 | - '%d',//PRC_order  | 
                                                        |
| 152 | - '%d',//PRC_parent  | 
                                                        |
| 144 | + '%d', //PRT_id  | 
                                                        |
| 145 | + '%f', //PRC_amount  | 
                                                        |
| 146 | + '%s', //PRC_name  | 
                                                        |
| 147 | + '%s', //PRC_desc  | 
                                                        |
| 148 | + '%d', //PRC_is_default  | 
                                                        |
| 149 | + '%d', //PRC_overrides  | 
                                                        |
| 150 | + '%d', //PRC_deleted  | 
                                                        |
| 151 | + '%d', //PRC_order  | 
                                                        |
| 152 | + '%d', //PRC_parent  | 
                                                        |
| 153 | 153 | '%d' //PRC_wp_user  | 
                                                        
| 154 | 154 | ));  | 
                                                        
| 155 | 155 | }  | 
                                                        
@@ -169,11 +169,11 @@ discard block  | 
                                                    ||
| 169 | 169 | * @param array $modules_to_register  | 
                                                        
| 170 | 170 | * @return array  | 
                                                        
| 171 | 171 | */  | 
                                                        
| 172 | -	public function caffeinated_modules_to_register( $modules_to_register = array() ){ | 
                                                        |
| 173 | -		if ( is_readable( EE_CAFF_PATH . 'modules' )) { | 
                                                        |
| 174 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR );  | 
                                                        |
| 175 | -			if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { | 
                                                        |
| 176 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register );  | 
                                                        |
| 172 | +	public function caffeinated_modules_to_register($modules_to_register = array()) { | 
                                                        |
| 173 | +		if (is_readable(EE_CAFF_PATH.'modules')) { | 
                                                        |
| 174 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR);  | 
                                                        |
| 175 | +			if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { | 
                                                        |
| 176 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);  | 
                                                        |
| 177 | 177 | }  | 
                                                        
| 178 | 178 | }  | 
                                                        
| 179 | 179 | return $modules_to_register;  | 
                                                        
@@ -181,19 +181,19 @@ discard block  | 
                                                    ||
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | |
| 184 | -	public function caffeinated_init(){ | 
                                                        |
| 184 | +	public function caffeinated_init() { | 
                                                        |
| 185 | 185 | // EE_Register_CPTs hooks  | 
                                                        
| 186 | -		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); | 
                                                        |
| 187 | -		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); | 
                                                        |
| 188 | -		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); | 
                                                        |
| 189 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE );  | 
                                                        |
| 186 | +		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); | 
                                                        |
| 187 | +		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); | 
                                                        |
| 188 | +		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); | 
                                                        |
| 189 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE);  | 
                                                        |
| 190 | 190 | // caffeinated_init__complete hook  | 
                                                        
| 191 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' );  | 
                                                        |
| 191 | +		do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); | 
                                                        |
| 192 | 192 | }  | 
                                                        
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | |
| 196 | -	public function enqueue_caffeinated_scripts(){ | 
                                                        |
| 196 | +	public function enqueue_caffeinated_scripts() { | 
                                                        |
| 197 | 197 | // sound of crickets...  | 
                                                        
| 198 | 198 | }  | 
                                                        
| 199 | 199 | |
@@ -202,23 +202,23 @@ discard block  | 
                                                    ||
| 202 | 202 | * callbacks below here  | 
                                                        
| 203 | 203 | */  | 
                                                        
| 204 | 204 | |
| 205 | -	public function filter_taxonomies( $taxonomy_array ) { | 
                                                        |
| 205 | +	public function filter_taxonomies($taxonomy_array) { | 
                                                        |
| 206 | 206 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE;  | 
                                                        
| 207 | 207 | return $taxonomy_array;  | 
                                                        
| 208 | 208 | }  | 
                                                        
| 209 | 209 | |
| 210 | 210 | |
| 211 | 211 | |
| 212 | -	public function filter_cpts( $cpt_array ) { | 
                                                        |
| 212 | +	public function filter_cpts($cpt_array) { | 
                                                        |
| 213 | 213 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE;  | 
                                                        
| 214 | 214 | return $cpt_array;  | 
                                                        
| 215 | 215 | }  | 
                                                        
| 216 | 216 | |
| 217 | 217 | |
| 218 | -	public function nav_metabox_items( $menuitems ) { | 
                                                        |
| 218 | +	public function nav_metabox_items($menuitems) { | 
                                                        |
| 219 | 219 | $menuitems[] = array(  | 
                                                        
| 220 | 220 |  			'title' => __('Venue List', 'event_espresso'), | 
                                                        
| 221 | - 'url' => get_post_type_archive_link( 'espresso_venues' ),  | 
                                                        |
| 221 | +			'url' => get_post_type_archive_link('espresso_venues'), | 
                                                        |
| 222 | 222 |  			'description' => __('Archive page for all venues.', 'event_espresso') | 
                                                        
| 223 | 223 | );  | 
                                                        
| 224 | 224 | return $menuitems;  | 
                                                        
@@ -229,9 +229,9 @@ discard block  | 
                                                    ||
| 229 | 229 | * @param array $payment_method_paths  | 
                                                        
| 230 | 230 | * @return array values are folder paths to payment method folders  | 
                                                        
| 231 | 231 | */  | 
                                                        
| 232 | -	public function caf_payment_methods( $payment_method_paths ) { | 
                                                        |
| 233 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR );  | 
                                                        |
| 234 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths );  | 
                                                        |
| 232 | +	public function caf_payment_methods($payment_method_paths) { | 
                                                        |
| 233 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR);  | 
                                                        |
| 234 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths);  | 
                                                        |
| 235 | 235 | return $payment_method_paths;  | 
                                                        
| 236 | 236 | }  | 
                                                        
| 237 | 237 | }  | 
                                                        
@@ -1,4 +1,6 @@  | 
                                                    ||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); | 
                                                        |
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { | 
                                                        |
| 2 | +	exit('No direct script access allowed'); | 
                                                        |
| 3 | +}  | 
                                                        |
| 2 | 4 | /**  | 
                                                        
| 3 | 5 | * Event Espresso  | 
                                                        
| 4 | 6 | *  |