Completed
Branch FET-8347-separate-logging (f2247f)
by
unknown
96:17 queued 87:38
created
admin_pages/general_settings/General_Settings_Admin_Page.core.php 4 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -419,8 +420,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
950 952
 		if ( $items ) {
951 953
 			foreach ( $items as $item ) {
952 954
 				$pad = str_repeat( '&nbsp;', $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 );
Please login to merge, or discard this patch.
Spacing   +285 added lines, -286 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 			);
@@ -231,29 +231,29 @@  discard block
 block discarded – undo
231 231
 		//scripts
232 232
 		wp_enqueue_script('media-upload');
233 233
 		wp_enqueue_script('thickbox');
234
-		wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );
235
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
236
-		wp_enqueue_script( 'organization_settings' );
237
-		wp_enqueue_style( 'organization-css' );
238
-		$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'));
239
-		wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );
234
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE);
235
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
236
+		wp_enqueue_script('organization_settings');
237
+		wp_enqueue_style('organization-css');
238
+		$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'));
239
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
240 240
 
241 241
 	}
242 242
 
243 243
 	public function load_scripts_styles_country_settings() {
244 244
 		//scripts
245
-		wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );
246
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
247
-		wp_enqueue_script( 'gen_settings_countries' );
248
-		wp_enqueue_style( 'organization-css' );
245
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
246
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
247
+		wp_enqueue_script('gen_settings_countries');
248
+		wp_enqueue_style('organization-css');
249 249
 
250 250
 		global $eei18n_js_strings;
251
-		$eei18n_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' );
252
-		$eei18n_js_strings['error_occurred'] = __(  'An error occurred! Please refresh the page and try again.', 'event_espresso' );
253
-		$eei18n_js_strings['confirm_delete_state'] = __(  'Are you sure you want to delete this State / Province?', 'event_espresso' );
254
-		$protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
255
-		$eei18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php?page=espresso_general_settings' , $protocol );
256
-		wp_localize_script( 'gen_settings_countries', 'eei18n', $eei18n_js_strings );
251
+		$eei18n_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');
252
+		$eei18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
253
+		$eei18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso');
254
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
255
+		$eei18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol);
256
+		wp_localize_script('gen_settings_countries', 'eei18n', $eei18n_js_strings);
257 257
 	}
258 258
 
259 259
 
@@ -264,37 +264,37 @@  discard block
 block discarded – undo
264 264
 
265 265
 		// Check to make sure all of the main pages are setup properly,
266 266
 		// if not create the default pages and display an admin notice
267
-		EE_Registry::instance()->load_helper( 'Activation' );
267
+		EE_Registry::instance()->load_helper('Activation');
268 268
 		EEH_Activation::verify_default_pages_exist();
269 269
 
270 270
 		$this->_transient_garbage_collection();
271 271
 		$this->_template_args['values'] = $this->_yes_no_values;
272 272
 
273
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
-		$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;
273
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
+		$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;
275 275
 
276
-		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
277
-		$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;
276
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL;
277
+		$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;
278 278
 
279
-		$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;
280
-		$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;
279
+		$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;
280
+		$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;
281 281
 
282
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
-		$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;
282
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
+		$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;
284 284
 
285
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
286
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
287
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
285
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
286
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
287
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
288 288
 		$this->display_admin_page_with_sidebar();
289 289
 
290 290
 	}
291 291
 
292 292
 	protected function _update_espresso_page_settings() {
293 293
 		// capture incoming request data
294
-		$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;
295
-		$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;
296
-		$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;
297
-		$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;
294
+		$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;
295
+		$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;
296
+		$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;
297
+		$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;
298 298
 		// pack critical_pages into an array
299 299
 		$critical_pages = array(
300 300
 			'reg_page_id' 				=> $reg_page_id,
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
 			'thank_you_page_id' 	=> $thank_you_page_id,
303 303
 			'cancel_page_id' 		=> $cancel_page_id
304 304
 		);
305
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
305
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
306 306
 			// has the page changed ?
307
-			if ( EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id ) {
307
+			if (EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id) {
308 308
 				// grab post object for old page
309
-				$post = get_post( EE_Registry::instance()->CFG->core->$critical_page_name );
309
+				$post = get_post(EE_Registry::instance()->CFG->core->$critical_page_name);
310 310
 				// update post shortcodes for old page
311
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
311
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
312 312
 				// grab post object for new page
313
-				$post = get_post( $critical_page_id );
313
+				$post = get_post($critical_page_id);
314 314
 				// update post shortcodes for new page
315
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
315
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
316 316
 			}
317 317
 		}
318 318
 		// set page IDs
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
322 322
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
323 323
 
324
-		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 );
324
+		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 325
 
326 326
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
327
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
327
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
328 328
 		$query_args = array(
329 329
 			'action' => 'critical_pages'
330 330
 			);
331
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
331
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
332 332
 
333 333
 	}
334 334
 
@@ -343,35 +343,35 @@  discard block
 block discarded – undo
343 343
 
344 344
 	protected function _your_organization_settings() {
345 345
 
346
-		$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' ) : '';
347
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
348
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
349
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
350
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
351
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
352
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
353
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
354
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
355
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
356
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
357
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
358
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
359
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
360
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
361
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
362
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
346
+		$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') : '';
347
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
348
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
349
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
350
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
351
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
352
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
353
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
354
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
355
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
356
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
357
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
358
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
359
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
360
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
361
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
362
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
363 363
 		//UXIP settings
364
-		$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;
364
+		$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 365
 
366
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
367
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
366
+		EE_Registry::instance()->load_helper('Form_Fields');
367
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
368 368
 		$this->_template_args['states'] = new EE_Question_Form_Input(
369
-				EE_Question::new_instance ( array(
369
+				EE_Question::new_instance(array(
370 370
 					'QST_ID'=> 0,
371 371
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
372 372
 					'QST_system'=>'admin-state'
373 373
 				)),
374
-				EE_Answer::new_instance ( array(
374
+				EE_Answer::new_instance(array(
375 375
 					'ANS_ID' => 0,
376 376
 					'ANS_value' => $STA_ID
377 377
 				)),
@@ -383,14 +383,14 @@  discard block
 block discarded – undo
383 383
 				)
384 384
 			);
385 385
 
386
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
386
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
387 387
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
388
-				EE_Question::new_instance ( array(
388
+				EE_Question::new_instance(array(
389 389
 					'QST_ID'=> 0,
390 390
 					'QST_display_text'=> __('Country', 'event_espresso'),
391 391
 					'QST_system'=>'admin-country'
392 392
 				)),
393
-				EE_Answer::new_instance ( array(
393
+				EE_Answer::new_instance(array(
394 394
 					'ANS_ID' => 0,
395 395
 					'ANS_value' => $CNT_ISO
396 396
 				)),
@@ -402,51 +402,51 @@  discard block
 block discarded – undo
402 402
 				)
403 403
 			);
404 404
 
405
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
406
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
405
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
406
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
407 407
 
408 408
 		//PUE verification stuff
409
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
410
-		$verify_fail = get_option( $ver_option_key );
411
-		$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>';
409
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
410
+		$verify_fail = get_option($ver_option_key);
411
+		$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>';
412 412
 
413
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
414
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
415
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
413
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
414
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
415
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
416 416
 
417 417
 		$this->display_admin_page_with_sidebar();
418 418
 	}
419 419
 
420 420
 	protected function _update_your_organization_settings() {
421
-		if ( is_main_site() )
422
-			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
-		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;
424
-		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;
425
-		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;
426
-		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;
427
-		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;
428
-		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;
429
-		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;
430
-		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;
431
-		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;
432
-		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;
433
-		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;
434
-		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;
435
-		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;
436
-		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;
437
-		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;
438
-		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;
439
-		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;
440
-		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;
441
-
442
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
443
-
444
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
421
+		if (is_main_site())
422
+			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
+		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;
424
+		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;
425
+		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;
426
+		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;
427
+		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;
428
+		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;
429
+		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;
430
+		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;
431
+		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;
432
+		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;
433
+		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;
434
+		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;
435
+		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;
436
+		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;
437
+		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;
438
+		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;
439
+		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;
440
+		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;
441
+
442
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
443
+
444
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
445 445
 
446 446
 		$what = 'Your Organization Settings';
447
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
447
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
448 448
 
449
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
449
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
450 450
 
451 451
 	}
452 452
 
@@ -457,36 +457,36 @@  discard block
 block discarded – undo
457 457
 	protected function _admin_option_settings() {
458 458
 
459 459
 		$this->_template_args['values'] = $this->_yes_no_values;
460
-		$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;
461
-		$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;
462
-		$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;
463
-		$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;
464
-		$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;
465
-		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
466
-		$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;
467
-
468
-		$this->_set_add_edit_form_tags( 'update_admin_option_settings' );
469
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
460
+		$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;
461
+		$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;
462
+		$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;
463
+		$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;
464
+		$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;
465
+		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
466
+		$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;
467
+
468
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
469
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
470 470
 		$this->_template_args['template_args'] = $this->_template_args;
471
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );
471
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);
472 472
 		$this->display_admin_page_with_sidebar();
473 473
 	}
474 474
 
475 475
 	protected function _update_admin_option_settings() {
476
-		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;
477
-		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;
478
-		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;
479
-		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;
480
-		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;
481
-		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;
482
-		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;
476
+		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;
477
+		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;
478
+		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;
479
+		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;
480
+		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;
481
+		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;
482
+		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;
483 483
 
484
-		EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );
484
+		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin);
485 485
 
486 486
 		$what = 'Admin Options';
487
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );
488
-		$success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );
489
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );
487
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);
488
+		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success);
489
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings'));
490 490
 
491 491
 	}
492 492
 
@@ -499,21 +499,21 @@  discard block
 block discarded – undo
499 499
 
500 500
 	protected function _country_settings() {
501 501
 
502
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
503
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
502
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
503
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
504 504
 
505 505
 		//load field generator helper
506
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
506
+		EE_Registry::instance()->load_helper('Form_Fields');
507 507
 
508 508
 		$this->_template_args['values'] = $this->_yes_no_values;
509 509
 
510 510
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
511
-				EE_Question::new_instance ( array(
511
+				EE_Question::new_instance(array(
512 512
 					'QST_ID'=> 0,
513 513
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
514 514
 					'QST_system'=>'admin-country'
515 515
 				)),
516
-				EE_Answer::new_instance ( array(
516
+				EE_Answer::new_instance(array(
517 517
 					'ANS_ID' => 0,
518 518
 					'ANS_value' => $CNT_ISO
519 519
 				)),
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
 			);
527 527
 //		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' );
528 528
 
529
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
530
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
529
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
530
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
531 531
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
532 532
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
533 533
 
534
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
535
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
536
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
534
+		$this->_set_add_edit_form_tags('update_country_settings');
535
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
536
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
537 537
 		$this->display_admin_page_with_no_sidebar();
538 538
 	}
539 539
 
@@ -546,44 +546,44 @@  discard block
 block discarded – undo
546 546
 	 * 		@param 	string 		$CNT_ISO
547 547
 	 * 		@return 		mixed		string | array
548 548
 	 */
549
-	public function display_country_settings( $CNT_ISO = '' ) {
549
+	public function display_country_settings($CNT_ISO = '') {
550 550
 
551
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
552
-		if ( ! $CNT_ISO ) {
551
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
552
+		if ( ! $CNT_ISO) {
553 553
 			return '';
554 554
 		}
555 555
 
556 556
 		// for ajax
557
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
558
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
559
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
560
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
561
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
562
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
557
+		EE_Registry::instance()->load_helper('Form_Fields');
558
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
559
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
560
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
561
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
562
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
563 563
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
564 564
 		$country_input_types = array(
565
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
566
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
567
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
568
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
569
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
570
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
571
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
572
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
573
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
574
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
575
-			'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' => '' ))),
576
-			'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 ),
577
-			'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 ),
578
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
579
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
565
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
566
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
567
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
568
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
569
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
570
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
571
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
572
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
573
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
574
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
575
+			'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' => ''))),
576
+			'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),
577
+			'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),
578
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
579
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
580 580
 		);
581
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
582
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
581
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
582
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
583 583
 
584
-		if ( defined( 'DOING_AJAX' )) {
585
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
586
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
584
+		if (defined('DOING_AJAX')) {
585
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
586
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
587 587
 			die();
588 588
 		} else {
589 589
 			return $country_details_settings;
@@ -601,50 +601,50 @@  discard block
 block discarded – undo
601 601
 	 * 		@param 	string 		$CNT_ISO
602 602
 	 * 		@return 		string
603 603
 	 */
604
-	public function display_country_states( $CNT_ISO = '' ) {
604
+	public function display_country_states($CNT_ISO = '') {
605 605
 
606
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
606
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
607 607
 
608
-		if ( ! $CNT_ISO ) {
608
+		if ( ! $CNT_ISO) {
609 609
 			return '';
610 610
 		}
611 611
 		// for ajax
612
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
613
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
614
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
615
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
616
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
617
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
612
+		EE_Registry::instance()->load_helper('Form_Fields');
613
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
614
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
615
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
616
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
617
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
618 618
 
619 619
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
620 620
 //			global $wpdb;
621 621
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
622 622
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
623
-		if ( $states ) {
624
-			foreach ( $states as $STA_ID => $state ) {
625
-				if ( $state instanceof EE_State ) {
623
+		if ($states) {
624
+			foreach ($states as $STA_ID => $state) {
625
+				if ($state instanceof EE_State) {
626 626
 					//STA_abbrev 	STA_name 	STA_active
627 627
 					$state_input_types = array(
628
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
629
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
630
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
628
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
629
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
630
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
631 631
 					);
632
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
633
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
634
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
632
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
633
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
634
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
635 635
 				}
636 636
 			}
637 637
 		} else {
638 638
 			$this->_template_args['states'] = FALSE;
639 639
 		}
640 640
 //		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' );
641
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
641
+		$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 642
 
643
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
643
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
644 644
 
645
-		if ( defined( 'DOING_AJAX' )) {
646
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
647
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
645
+		if (defined('DOING_AJAX')) {
646
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
647
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
648 648
 			die();
649 649
 		} else {
650 650
 			return $state_details_settings;
@@ -665,39 +665,38 @@  discard block
 block discarded – undo
665 665
 
666 666
 		$success = TRUE;
667 667
 
668
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
669
-		if ( ! $CNT_ISO ) {
670
-			EE_Error::add_error( __( 'An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
668
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
669
+		if ( ! $CNT_ISO) {
670
+			EE_Error::add_error(__('An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
671 671
 			$success = FALSE;
672 672
 		}
673
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
674
-		if ( ! $STA_abbrev ) {
675
-			EE_Error::add_error( __( 'An error occurred. No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
673
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
674
+		if ( ! $STA_abbrev) {
675
+			EE_Error::add_error(__('An error occurred. No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
676 676
 			$success = FALSE;
677 677
 		}
678
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
679
-			FALSE;
680
-		if ( ! $STA_name ) {
681
-			EE_Error::add_error( __( 'An error occurred. No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
678
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE;
679
+		if ( ! $STA_name) {
680
+			EE_Error::add_error(__('An error occurred. No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
682 681
 			$success = FALSE;
683 682
 		}
684 683
 
685
-		if ( $success ) {
684
+		if ($success) {
686 685
 			$cols_n_values = array(
687 686
 				'CNT_ISO' => $CNT_ISO,
688 687
 				'STA_abbrev' => $STA_abbrev,
689 688
 				'STA_name' => $STA_name,
690 689
 				'STA_active' => TRUE
691 690
 			);
692
-			$success = EEM_State::instance()->insert ( $cols_n_values );
691
+			$success = EEM_State::instance()->insert($cols_n_values);
693 692
 		}
694 693
 
695
-		if ( defined( 'DOING_AJAX' )) {
696
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
697
-			echo json_encode( array( 'return_data' => $CNT_ISO, 'success' => __( 'The State was added successfully.', 'event_espresso' ), 'errors' => $notices['errors'] ));
694
+		if (defined('DOING_AJAX')) {
695
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
696
+			echo json_encode(array('return_data' => $CNT_ISO, 'success' => __('The State was added successfully.', 'event_espresso'), 'errors' => $notices['errors']));
698 697
 			die();
699 698
 		} else {
700
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
699
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
701 700
 		}
702 701
 	}
703 702
 
@@ -710,25 +709,25 @@  discard block
 block discarded – undo
710 709
 	 * 		@return 		boolean | void
711 710
 	 */
712 711
 	public function delete_state() {
713
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
714
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
715
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
716
-		if ( ! $STA_ID ) {
717
-			EE_Error::add_error( __( 'An error occurred. No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
712
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
713
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
714
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
715
+		if ( ! $STA_ID) {
716
+			EE_Error::add_error(__('An error occurred. No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
718 717
 			return FALSE;
719 718
 		}
720
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
721
-		if ( $success !== FALSE ) {
722
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
723
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
719
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
720
+		if ($success !== FALSE) {
721
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
722
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
724 723
 		}
725
-		if ( defined( 'DOING_AJAX' )) {
726
-			$notices = EE_Error::get_notices( FALSE, FALSE );
724
+		if (defined('DOING_AJAX')) {
725
+			$notices = EE_Error::get_notices(FALSE, FALSE);
727 726
 			$notices['return_data'] = TRUE;
728
-			echo json_encode( $notices );
727
+			echo json_encode($notices);
729 728
 			die();
730 729
 		} else {
731
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
730
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
732 731
 		}
733 732
 	}
734 733
 
@@ -744,63 +743,63 @@  discard block
 block discarded – undo
744 743
 	protected function _update_country_settings() {
745 744
 //		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' );
746 745
 		// grab the country ISO code
747
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
748
-		if ( ! $CNT_ISO ) {
749
-			EE_Error::add_error( __( 'An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
746
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
747
+		if ( ! $CNT_ISO) {
748
+			EE_Error::add_error(__('An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
750 749
 			return;
751 750
 		}
752 751
 		$cols_n_values = array();
753
-		$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;
754
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
755
-		$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;
756
-		$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';
757
-		$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';
758
-		$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';
759
-		$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'] ) : '$';
760
-		$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;
761
-		$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;
762
-		$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'] ) : '.';
763
-		$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'] ) : ',';
764
-		$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;
765
-		$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;
766
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
752
+		$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;
753
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
754
+		$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;
755
+		$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';
756
+		$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';
757
+		$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';
758
+		$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']) : '$';
759
+		$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;
760
+		$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;
761
+		$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']) : '.';
762
+		$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']) : ',';
763
+		$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;
764
+		$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;
765
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
767 766
 		// allow filtering of country data
768
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
767
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
769 768
 		//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' );
770 769
 		// where values
771
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
770
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
772 771
 		// run the update
773
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
772
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
774 773
 //		global $wpdb;
775 774
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
776 775
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
777
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
776
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
778 777
 			// allow filtering of states data
779
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
778
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
780 779
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
781 780
 			// loop thru state data ( looks like : states[75][STA_name] )
782
-			foreach( $states as $STA_ID => $state ) {
781
+			foreach ($states as $STA_ID => $state) {
783 782
 				$cols_n_values = array(
784 783
 					'CNT_ISO' 		=> $CNT_ISO,
785
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
786
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
787
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
784
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
785
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
786
+					'STA_active' 	=> (bool) absint($state['STA_active'])
788 787
 				);
789 788
 				// where values
790
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
789
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
791 790
 				// run the update
792
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
793
-				if ( $success !== FALSE ) {
794
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
791
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
792
+				if ($success !== FALSE) {
793
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
795 794
 				}
796 795
 			}
797 796
 		}
798 797
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
799
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
800
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
798
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
799
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
801 800
 			EE_Registry::instance()->CFG->update_espresso_config();
802 801
 		}
803
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
802
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
804 803
 	}
805 804
 
806 805
 
@@ -814,11 +813,11 @@  discard block
 block discarded – undo
814 813
 	 * 		@param 		string 		$label
815 814
 	 * 		@return 		string
816 815
 	 */
817
-	public function country_form_field_label_wrap( $label, $required_text ) {
816
+	public function country_form_field_label_wrap($label, $required_text) {
818 817
 		return '
819 818
 			<tr>
820 819
 				<th>
821
-					' . $label  . '
820
+					' . $label.'
822 821
 				</th>';
823 822
 	}
824 823
 
@@ -832,10 +831,10 @@  discard block
 block discarded – undo
832 831
 	 * 		@param 		string 		$label
833 832
 	 * 		@return 		string
834 833
 	 */
835
-	public function country_form_field_input__wrap( $input, $label ) {
834
+	public function country_form_field_input__wrap($input, $label) {
836 835
 		return '
837 836
 				<td class="general-settings-country-input-td">
838
-					' . $input . '
837
+					' . $input.'
839 838
 				</td>
840 839
 			</tr>';
841 840
 	}
@@ -851,7 +850,7 @@  discard block
 block discarded – undo
851 850
 	 * 		@param 		string 		$required_text
852 851
 	 * 		@return 		string
853 852
 	 */
854
-	public function state_form_field_label_wrap( $label, $required_text  ) {
853
+	public function state_form_field_label_wrap($label, $required_text) {
855 854
 		return $required_text;
856 855
 	}
857 856
 
@@ -865,10 +864,10 @@  discard block
 block discarded – undo
865 864
 	 * 		@param 		string 		$label
866 865
 	 * 		@return 		string
867 866
 	 */
868
-	public function state_form_field_input__wrap( $input, $label ) {
867
+	public function state_form_field_input__wrap($input, $label) {
869 868
 		return '
870 869
 				<td class="general-settings-country-state-input-td">
871
-					' . $input . '
870
+					' . $input.'
872 871
 				</td>';
873 872
 
874 873
 	}
@@ -891,10 +890,10 @@  discard block
 block discarded – undo
891 890
 	 * @param int $ee_page_id
892 891
 	 * @return string
893 892
 	 */
894
-	public static function edit_view_links( $ee_page_id ) {
895
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
893
+	public static function edit_view_links($ee_page_id) {
894
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
896 895
 		$links .= ' &nbsp;|&nbsp; ';
897
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
896
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
898 897
 		return $links;
899 898
 	}
900 899
 
@@ -907,27 +906,27 @@  discard block
 block discarded – undo
907 906
 	 * @param WP page object $ee_page
908 907
 	 * @return string
909 908
 	 */
910
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
909
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
911 910
 
912 911
 		// page status
913
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
912
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
914 913
 			$pg_colour = 'green';
915
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
914
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
916 915
 		 } else {
917 916
 			$pg_colour = 'red';
918
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
917
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
919 918
 		}
920 919
 
921 920
 		// shortcode status
922
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
921
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
923 922
 			$sc_colour = 'green';
924
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
923
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
925 924
 		 } else {
926 925
 			$sc_colour = 'red';
927
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
926
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
928 927
 		}
929 928
 
930
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
929
+		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 930
 
932 931
 	}
933 932
 
@@ -942,20 +941,20 @@  discard block
 block discarded – undo
942 941
 	 * @param unknown_type $level
943 942
 	 * @return unknown
944 943
 	 */
945
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
944
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
946 945
 		global $wpdb;
947
-		$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) );
946
+		$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 947
 
949
-		if ( $items ) {
950
-			foreach ( $items as $item ) {
951
-				$pad = str_repeat( '&nbsp;', $level * 3 );
952
-				if ( $item->ID == $default)
948
+		if ($items) {
949
+			foreach ($items as $item) {
950
+				$pad = str_repeat('&nbsp;', $level * 3);
951
+				if ($item->ID == $default)
953 952
 					$current = ' selected="selected"';
954 953
 				else
955 954
 					$current = '';
956 955
 
957
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
958
-				parent_dropdown( $default, $item->ID, $level +1 );
956
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
957
+				parent_dropdown($default, $item->ID, $level + 1);
959 958
 			}
960 959
 		} else {
961 960
 			return false;
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 
191 191
 	/**
192 192
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
193
-	*		@access protected
194
-	*		@return void
195
-	*/
193
+	 *		@access protected
194
+	 *		@return void
195
+	 */
196 196
 	protected function _set_page_routes() {
197 197
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198 198
 		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
380 380
 							'callback' => 'edit_message_template_help_tab'
381 381
 							),
382
-                        'message_templates_help_tab' => array(
383
-                            'title' => __('Message Templates', 'event_espresso'),
384
-                            'filename' => 'messages_templates'
385
-                            ),
382
+						'message_templates_help_tab' => array(
383
+							'title' => __('Message Templates', 'event_espresso'),
384
+							'filename' => 'messages_templates'
385
+							),
386 386
 						'message_template_shortcodes' => array(
387 387
 							'title' => __('Message Shortcodes', 'event_espresso'),
388 388
 							'callback' => 'message_template_shortcodes_help_tab'
389 389
 							),
390
-                        'message_preview_help_tab' => array(
391
-                            'title' => __('Message Preview', 'event_espresso'),
392
-                            'filename' => 'messages_preview'
393
-                            ),
390
+						'message_preview_help_tab' => array(
391
+							'title' => __('Message Preview', 'event_espresso'),
392
+							'filename' => 'messages_preview'
393
+							),
394 394
 					),
395 395
 				'require_nonce' => FALSE
396 396
 				),
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 					'order' => 20
416 416
 					),
417 417
 				'metaboxes' => array('_messages_settings_metaboxes'),
418
-                'help_tabs' => array(
418
+				'help_tabs' => array(
419 419
 						'messages_settings_help_tab' => array(
420 420
 							'title' => __('Messages Settings', 'event_espresso'),
421 421
 							'filename' => 'messages_settings'
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 							'title' => __('Activating / Deactivating Messengers', 'event_espresso'),
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431
-                    ),
431
+					),
432 432
 				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
433 433
 				'require_nonce' => FALSE
434 434
 				)
@@ -2106,9 +2106,9 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
 	/**
2108 2108
 	 * 	_learn_more_about_message_templates_link
2109
-	*	@access protected
2110
-	*	@return string
2111
-	*/
2109
+	 *	@access protected
2110
+	 *	@return string
2111
+	 */
2112 2112
 	protected function _learn_more_about_message_templates_link() {
2113 2113
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2114 2114
 	}
Please login to merge, or discard this patch.
Braces   +54 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 
4 5
 /**
5 6
  * Event Espresso
@@ -123,8 +124,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'];
Please login to merge, or discard this patch.
Spacing   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 
4 4
 /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @access public
74 74
 	 * @return void
75 75
 	 */
76
-	public function __construct( $routing = TRUE ) {
76
+	public function __construct($routing = TRUE) {
77 77
 		//make sure MSG Template helper is loaded.
78 78
 		EE_Registry::instance()->load_helper('MSG_Template');
79 79
 		//make sure messages autoloader is running
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
96 96
 
97
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;
97
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;
98 98
 
99
-		EE_Registry::instance()->load_lib( 'messages' );
99
+		EE_Registry::instance()->load_lib('messages');
100 100
 		//we're also going to set the active messengers and active message types in here.
101 101
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
102
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
103
-		$this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty(  $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();
102
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
103
+		$this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();
104 104
 
105 105
 
106 106
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @return void
119 119
 	 */
120 120
 	protected function _load_active_messenger_objects() {
121
-		foreach ( $this->_active_messengers as $messenger => $values ) {
122
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
123
-			$ref = str_replace( ' ', '_', $ref );
124
-			$classname = 'EE_' . $ref . '_messenger';
125
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
128
-
129
-			$a = new ReflectionClass( $classname );
121
+		foreach ($this->_active_messengers as $messenger => $values) {
122
+			$ref = ucwords(str_replace('_', ' ', $messenger));
123
+			$ref = str_replace(' ', '_', $ref);
124
+			$classname = 'EE_'.$ref.'_messenger';
125
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
126
+			if ( ! class_exists($classname))
127
+				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname));
128
+
129
+			$a = new ReflectionClass($classname);
130 130
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
131 131
 		}
132 132
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
145
-		foreach ( $this->_active_message_types as $message_type ) {
146
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147
-			$ref = str_replace( ' ', '_', $ref );
148
-			$classname = 'EE_' . $ref . '_message_type';
144
+		if (empty($this->_active_message_types)) return;
145
+		foreach ($this->_active_message_types as $message_type) {
146
+			$ref = ucwords(str_replace('_', ' ', $message_type));
147
+			$ref = str_replace(' ', '_', $ref);
148
+			$classname = 'EE_'.$ref.'_message_type';
149 149
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
150
+			if ( ! class_exists($classname))
151
+				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname));
152 152
 
153
-			$a = new ReflectionClass( $classname );
153
+			$a = new ReflectionClass($classname);
154 154
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
155 155
 		}
156 156
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 
159 159
 
160 160
 	protected function _ajax_hooks() {
161
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
162
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
163
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
164
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
165
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
161
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
162
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
163
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
164
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
165
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
166 166
 	}
167 167
 
168 168
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	*		@return void
195 195
 	*/
196 196
 	protected function _set_page_routes() {
197
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
197
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
198
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
199 199
 
200 200
 		$this->_page_routes = array(
201 201
 				'default'=> array(
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 				'insert_message_template' => array(
232 232
 					'func' => '_insert_or_update_message_template',
233 233
 					'capability' => 'ee_edit_messages',
234
-					'args' => array( 'new_template' => TRUE ),
234
+					'args' => array('new_template' => TRUE),
235 235
 					'noheader' => TRUE
236 236
 					 ),
237 237
 				'update_message_template' => array(
238 238
 					'func' => '_insert_or_update_message_template',
239 239
 					'capability' => 'ee_edit_message',
240 240
 					'obj_id' => $grp_id,
241
-					'args' => array( 'new_template' => FALSE ),
241
+					'args' => array('new_template' => FALSE),
242 242
 					'noheader' => TRUE
243 243
 					),
244 244
 				'trash_message_template' => array(
245 245
 					'func' => '_trash_or_restore_message_template',
246 246
 					'capability' => 'ee_delete_message',
247 247
 					'obj_id' => $grp_id,
248
-					'args' => array( 'trash' => TRUE, 'all' => TRUE ),
248
+					'args' => array('trash' => TRUE, 'all' => TRUE),
249 249
 					'noheader' => TRUE
250 250
 					),
251 251
 				'trash_message_template_context' => array(
252 252
 					'func' => '_trash_or_restore_message_template',
253 253
 					'capability' => 'ee_delete_message',
254 254
 					'obj_id' => $grp_id,
255
-					'args' => array( 'trash' => TRUE ),
255
+					'args' => array('trash' => TRUE),
256 256
 					'noheader' => TRUE
257 257
 					),
258 258
 				'restore_message_template' => array(
259 259
 					'func' => '_trash_or_restore_message_template',
260 260
 					'capability' => 'ee_delete_message',
261 261
 					'obj_id' => $grp_id,
262
-					'args' => array( 'trash' => FALSE, 'all' => TRUE ),
262
+					'args' => array('trash' => FALSE, 'all' => TRUE),
263 263
 					'noheader' => TRUE
264 264
 					),
265 265
 				'restore_message_template_context' => array(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 						'filename' => 'messages_overview_other',
339 339
 					),
340 340
 				),
341
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
341
+				'help_tour' => array('Messages_Overview_Help_Tour'),
342 342
 				'require_nonce' => FALSE
343 343
 				),
344 344
 			'custom_mtps' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					),
374 374
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
375 375
 				'has_metaboxes' => TRUE,
376
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
376
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
377 377
 				'help_tabs' => array(
378 378
 						'edit_message_template' => array(
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431 431
                     ),
432
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
432
+				'help_tour' => array('Messages_Settings_Help_Tour'),
433 433
 				'require_nonce' => FALSE
434 434
 				)
435 435
 			/*'reports' => array(
@@ -478,43 +478,43 @@  discard block
 block discarded – undo
478 478
 
479 479
 
480 480
 	public function messages_help_tab() {
481
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
482
-		EEH_Template::display_template( $templatepath, array());
481
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
482
+		EEH_Template::display_template($templatepath, array());
483 483
 	}
484 484
 
485 485
 
486 486
 	public function messengers_help_tab() {
487
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
488
-		EEH_Template::display_template( $templatepath, array());
487
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
488
+		EEH_Template::display_template($templatepath, array());
489 489
 	}
490 490
 
491 491
 
492 492
 	public function message_types_help_tab() {
493
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
494
-		EEH_Template::display_template( $templatepath, array());
493
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
494
+		EEH_Template::display_template($templatepath, array());
495 495
 	}
496 496
 
497 497
 
498 498
 	public function messages_overview_help_tab() {
499
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
500
-		EEH_Template::display_template( $templatepath, array());
499
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
500
+		EEH_Template::display_template($templatepath, array());
501 501
 	}
502 502
 
503 503
 
504 504
 	public function message_templates_help_tab() {
505
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
506
-		EEH_Template::display_template( $templatepath, array());
505
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
506
+		EEH_Template::display_template($templatepath, array());
507 507
 	}
508 508
 
509 509
 
510 510
 	public function edit_message_template_help_tab() {
511
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
512
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
513
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
514
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
515
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
516
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
517
-		EEH_Template::display_template( $templatepath, $args);
511
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
512
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
513
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
514
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
515
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
516
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
517
+		EEH_Template::display_template($templatepath, $args);
518 518
 	}
519 519
 
520 520
 
@@ -522,25 +522,25 @@  discard block
 block discarded – undo
522 522
 	public function message_template_shortcodes_help_tab() {
523 523
 		$this->_set_shortcodes();
524 524
 		$args['shortcodes'] = $this->_shortcodes;
525
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
526
-		EEH_Template::display_template( $template_path, $args );
525
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
526
+		EEH_Template::display_template($template_path, $args);
527 527
 	}
528 528
 
529 529
 
530 530
 
531 531
 	public function preview_message_help_tab() {
532
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
533
-		EEH_Template::display_template( $templatepath, array());
532
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
533
+		EEH_Template::display_template($templatepath, array());
534 534
 	}
535 535
 
536 536
 
537 537
 	public function settings_help_tab() {
538
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
539
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
540
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
538
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
539
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
540
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
541 541
 		$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>';
542 542
 		$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>';
543
-		EEH_Template::display_template( $templatepath, $args);
543
+		EEH_Template::display_template($templatepath, $args);
544 544
 	}
545 545
 
546 546
 
@@ -548,24 +548,24 @@  discard block
 block discarded – undo
548 548
 
549 549
 
550 550
 	public function load_scripts_styles() {
551
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
551
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
552 552
 		wp_enqueue_style('espresso_ee_msg');
553 553
 
554
-		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 );
554
+		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 555
 	}
556 556
 
557 557
 
558 558
 
559 559
 
560 560
 
561
-	public function wp_editor_css( $mce_css ) {
561
+	public function wp_editor_css($mce_css) {
562 562
 		//if we're on the edit_message_template route
563
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
563
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
564 564
 			$message_type_name = $this->_active_message_type_name;
565 565
 
566 566
 			//we're going to REPLACE the existing mce css
567 567
 			//we need to get the css file location from the active messenger
568
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
568
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
569 569
 		}
570 570
 
571 571
 		return $mce_css;
@@ -577,41 +577,41 @@  discard block
 block discarded – undo
577 577
 	public function load_scripts_styles_edit_message_template() {
578 578
 		;
579 579
 		$this->_set_shortcodes();
580
-		EE_Registry::$i18n_js_strings['confirm_default_reset'] = sprintf( __('Are you sure you want to reset the %s %s message templates?  Remember continuing will reset the templates for all contexts in this messenger and message type group.', 'event_espresso'), $this->_message_template_group->messenger_obj()->label['singular'], $this->_message_template_group->message_type_obj()->label['singular'] );
581
-		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' );
580
+		EE_Registry::$i18n_js_strings['confirm_default_reset'] = sprintf(__('Are you sure you want to reset the %s %s message templates?  Remember continuing will reset the templates for all contexts in this messenger and message type group.', 'event_espresso'), $this->_message_template_group->messenger_obj()->label['singular'], $this->_message_template_group->message_type_obj()->label['singular']);
581
+		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');
582 582
 
583 583
 
584
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
584
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
585 585
 
586 586
 		wp_enqueue_script('ee_admin_js');
587 587
 		wp_enqueue_script('ee_msgs_edit_js');
588 588
 
589
-		wp_localize_script( 'ee_msgs_edit_js', 'eei18n', EE_Registry::$i18n_js_strings );
589
+		wp_localize_script('ee_msgs_edit_js', 'eei18n', EE_Registry::$i18n_js_strings);
590 590
 
591 591
 		//add in special css for tiny_mce
592
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
592
+		add_filter('mce_css', array($this, 'wp_editor_css'));
593 593
 	}
594 594
 
595 595
 
596 596
 
597 597
 	public function load_scripts_styles_display_preview_message() {
598 598
 		$this->_set_message_template_group();
599
-		if ( isset( $this->_req_data['messenger'] ) ) {
599
+		if (isset($this->_req_data['messenger'])) {
600 600
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
601 601
 		}
602 602
 
603
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
603
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
604 604
 
605 605
 
606
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
606
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
607 607
 	}
608 608
 
609 609
 
610 610
 
611 611
 	public function load_scripts_styles_settings() {
612
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
613
-		wp_enqueue_style( 'ee-text-links' );
614
-		wp_enqueue_style( 'ee-message-settings' );
612
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
613
+		wp_enqueue_style('ee-text-links');
614
+		wp_enqueue_style('ee-message-settings');
615 615
 
616 616
 		wp_enqueue_script('ee-messages-settings');
617 617
 	}
@@ -647,9 +647,9 @@  discard block
 block discarded – undo
647 647
 
648 648
 	protected function _custom_mtps_preview() {
649 649
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
650
-		$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' ) . '" />';
650
+		$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').'" />';
651 651
 		$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>';
652
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
652
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
653 653
 	}
654 654
 
655 655
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 * @param bool $global whether to return just global (true) or custom templates (false)
672 672
 	 * @return array|WP_Error object
673 673
 	 */
674
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
674
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
675 675
 		global $espresso_wp_user;
676 676
 		// start with an empty array
677 677
 		$message_templates = array();
@@ -681,24 +681,24 @@  discard block
 block discarded – undo
681 681
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
682 682
 		$orderby = $this->_req_data['orderby'];
683 683
 
684
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
684
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
685 685
 
686
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
687
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
686
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
687
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
688 688
 
689
-		$offset = ($current_page-1)*$per_page;
690
-		$limit = $all ? NULL : array( $offset, $per_page );
689
+		$offset = ($current_page - 1) * $per_page;
690
+		$limit = $all ? NULL : array($offset, $per_page);
691 691
 
692 692
 
693 693
 		//options will match what is in the _views array property
694
-		switch( $type ) {
694
+		switch ($type) {
695 695
 
696 696
 			case 'in_use':
697
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
697
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
698 698
 				break;
699 699
 
700 700
 			default:
701
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
701
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
702 702
 
703 703
 		}
704 704
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		$imts = $installed_objects['message_types'];
735 735
 		$installed = array();
736 736
 
737
-		foreach ( $imts as $message_type ) {
737
+		foreach ($imts as $message_type) {
738 738
 			$installed[$message_type->name]['obj'] = $message_type;
739 739
 		}
740 740
 
@@ -766,24 +766,24 @@  discard block
 block discarded – undo
766 766
 	 * @access  protected
767 767
 	 * @return void
768 768
 	 */
769
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
769
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
770 770
 		//set values override any request data
771
-		$message_type = !empty( $message_type ) ? $message_type : '';
772
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
771
+		$message_type = ! empty($message_type) ? $message_type : '';
772
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
773 773
 
774
-		$messenger = !empty( $messenger ) ? $messenger : '';
775
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
774
+		$messenger = ! empty($messenger) ? $messenger : '';
775
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
776 776
 
777
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
778
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
777
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
778
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
779 779
 
780 780
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
781
-		if ( empty( $message_type ) || empty( $messenger )  )
781
+		if (empty($message_type) || empty($messenger))
782 782
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
783 783
 
784 784
 		//we need the GRP_ID for the template being used as the base for the new template
785
-		if ( empty( $GRP_ID ) )
786
-			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' ) );
785
+		if (empty($GRP_ID))
786
+			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'));
787 787
 
788 788
 		//let's just make sure the template gets generated!
789 789
 
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 	 * @param string $messenger    messenger slug
803 803
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
804 804
 	 */
805
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
806
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
805
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
806
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
807 807
 	}
808 808
 
809 809
 
@@ -814,36 +814,36 @@  discard block
 block discarded – undo
814 814
 	 * @return void
815 815
 	 */
816 816
 	protected function _edit_message_template() {
817
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
817
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
818 818
 
819 819
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
820
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
820
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
821 821
 
822
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
822
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
823 823
 
824 824
 		$this->_set_shortcodes(); //this also sets the _message_template property.
825 825
 		$message_template_group = $this->_message_template_group;
826 826
 		$c_label = $message_template_group->context_label();
827 827
 		$c_config = $message_template_group->contexts_config();
828 828
 
829
-		reset( $c_config );
830
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
829
+		reset($c_config);
830
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
831 831
 
832 832
 
833
-		if ( empty($GRP_ID) ) {
833
+		if (empty($GRP_ID)) {
834 834
 			$action = 'insert_message_template';
835 835
 			$button_both = FALSE;
836
-			$button_text = array( __( 'Save','event_espresso') );
836
+			$button_text = array(__('Save', 'event_espresso'));
837 837
 			$button_actions = array('something_different');
838 838
 			$referrer = FALSE;
839
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
839
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
840 840
 		} else {
841 841
 			$action = 'update_message_template';
842 842
 			$button_both = TRUE;
843 843
 			$button_text = array();
844 844
 			$button_actions = array();
845 845
 			$referrer = $this->_admin_base_url;
846
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
846
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
847 847
 		}
848 848
 
849 849
 		//set active messenger for this view
@@ -853,13 +853,13 @@  discard block
 block discarded – undo
853 853
 
854 854
 		//Do we have any validation errors?
855 855
 		$validators = $this->_get_transient();
856
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
856
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
857 857
 
858 858
 
859 859
 		//we need to assemble the title from Various details
860
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
860
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
861 861
 
862
-		$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 );
862
+		$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);
863 863
 
864 864
 		$this->_template_args['GRP_ID'] = $GRP_ID;
865 865
 		$this->_template_args['message_template'] = $message_template_group;
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		$MSG = new EE_messages();
871 871
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
872 872
 
873
-		if ( !$template_field_structure ) {
873
+		if ( ! $template_field_structure) {
874 874
 			$template_field_structure = FALSE;
875 875
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
876 876
 		}
@@ -880,38 +880,38 @@  discard block
 block discarded – undo
880 880
 
881 881
 
882 882
 		//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.
883
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
884
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
885
-				unset( $template_field_structure[$context][$reference_field] );
883
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
884
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
885
+				unset($template_field_structure[$context][$reference_field]);
886 886
 			}
887 887
 		}
888 888
 
889 889
 		//let's loop through the template_field_structure and actually assemble the input fields!
890
-		if ( !empty($template_field_structure) ) {
891
-			$id_prefix= 'ee-msg-edit-template-fields-';
892
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
890
+		if ( ! empty($template_field_structure)) {
891
+			$id_prefix = 'ee-msg-edit-template-fields-';
892
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
893 893
 				//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.
894
-				if ( $template_field == 'extra' ) {
894
+				if ($template_field == 'extra') {
895 895
 					$this->_template_args['is_extra_fields'] = TRUE;
896
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
897
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
896
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
897
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
898 898
 							//let's verify if we need this extra field via the shortcodes parameter.
899 899
 							$continue = FALSE;
900
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
901
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
902
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
900
+							if (isset($extra_array['shortcodes_required'])) {
901
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
902
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
903 903
 										$continue = TRUE;
904 904
 								}
905
-								if ( $continue ) continue;
905
+								if ($continue) continue;
906 906
 							}
907 907
 
908
-							$field_id = $reference_field . '-' . $extra_field . '-content';
908
+							$field_id = $reference_field.'-'.$extra_field.'-content';
909 909
 							$template_form_fields[$field_id] = $extra_array;
910
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
911
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
912
-							$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;
910
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
911
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
912
+							$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 913
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
914
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
914
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
915 915
 
916 916
 							//do we have a validation error?  if we do then let's use that value instead
917 917
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -919,30 +919,30 @@  discard block
 block discarded – undo
919 919
 
920 920
 							$template_form_fields[$field_id]['db-col'] = 'MTP_content';
921 921
 
922
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
922
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
923 923
 								//we want to decode the entities
924
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
924
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
925 925
 
926 926
 							}/**/
927 927
 						}
928
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
929
-						$templatefield_templatename_id = $reference_field . '-name';
928
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
929
+						$templatefield_templatename_id = $reference_field.'-name';
930 930
 
931 931
 						$template_form_fields[$templatefield_MTP_id] = array(
932
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
932
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
933 933
 							'label' => NULL,
934 934
 							'input' => 'hidden',
935 935
 							'type' => 'int',
936 936
 							'required' => FALSE,
937 937
 							'validation' => FALSE,
938
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
938
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
939 939
 							'css_class' => '',
940 940
 							'format' => '%d',
941 941
 							'db-col' => 'MTP_ID'
942 942
 						);
943 943
 
944 944
 						$template_form_fields[$templatefield_templatename_id] = array(
945
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
945
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
946 946
 							'label' => NULL,
947 947
 							'input' => 'hidden',
948 948
 							'type' => 'string',
@@ -956,10 +956,10 @@  discard block
 block discarded – undo
956 956
 					}
957 957
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
958 958
 				} else {
959
-					$field_id = $template_field . '-content';
959
+					$field_id = $template_field.'-content';
960 960
 					$template_form_fields[$field_id] = $field_setup_array;
961
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
962
-					$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') : '';
961
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
962
+					$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') : '';
963 963
 
964 964
 					//do we have a validator error for this field?  if we do then we'll use that value instead
965 965
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -967,9 +967,9 @@  discard block
 block discarded – undo
967 967
 
968 968
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
969 969
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
970
-					$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;
970
+					$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;
971 971
 
972
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
972
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
973 973
 						//we want to decode the entities
974 974
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
975 975
 					}/**/
@@ -977,25 +977,25 @@  discard block
 block discarded – undo
977 977
 
978 978
 				//k took care of content field(s) now let's take care of others.
979 979
 
980
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
981
-				$templatefield_field_templatename_id = $template_field . '-name';
980
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
981
+				$templatefield_field_templatename_id = $template_field.'-name';
982 982
 
983 983
 				//foreach template field there are actually two form fields created
984 984
 				$template_form_fields[$templatefield_MTP_id] = array(
985
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
985
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
986 986
 					'label' => NULL,
987 987
 					'input' => 'hidden',
988 988
 					'type' => 'int',
989 989
 					'required' => FALSE,
990 990
 					'validation' => TRUE,
991
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
991
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
992 992
 					'css_class' => '',
993 993
 					'format' => '%d',
994 994
 					'db-col' => 'MTP_ID'
995 995
 				);
996 996
 
997 997
 				$template_form_fields[$templatefield_field_templatename_id] = array(
998
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
998
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
999 999
 					'label' => NULL,
1000 1000
 					'input' => 'hidden',
1001 1001
 					'type' => 'string',
@@ -1139,15 +1139,15 @@  discard block
 block discarded – undo
1139 1139
 				'value' => $GRP_ID
1140 1140
 				);
1141 1141
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1142
-				'name' => $action . '_nonce',
1142
+				'name' => $action.'_nonce',
1143 1143
 				'input' => 'hidden',
1144 1144
 				'type' => 'string',
1145
-				'value' => wp_create_nonce( $action . '_nonce')
1145
+				'value' => wp_create_nonce($action.'_nonce')
1146 1146
 				);
1147 1147
 
1148 1148
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1149 1149
 
1150
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1150
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1151 1151
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1152 1152
 					'name' => 'template_switch',
1153 1153
 					'input' => 'hidden',
@@ -1158,19 +1158,19 @@  discard block
 block discarded – undo
1158 1158
 
1159 1159
 			//send to field generator
1160 1160
 
1161
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1162
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1161
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1162
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1163 1163
 
1164 1164
 
1165 1165
 		} //end if ( !empty($template_field_structure) )
1166 1166
 
1167 1167
 		//set extra content for publish box
1168 1168
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1169
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1169
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1170 1170
 
1171 1171
 		//add preview button
1172
-		$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 );
1173
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1172
+		$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);
1173
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1174 1174
 
1175 1175
 
1176 1176
 		//setup context switcher
@@ -1196,16 +1196,16 @@  discard block
 block discarded – undo
1196 1196
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1197 1197
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1198 1198
 
1199
-		$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';
1199
+		$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';
1200 1200
 
1201 1201
 		//send along EE_Message_Template_Group object for further template use.
1202 1202
 		$this->_template_args['MTP'] = $message_template_group;
1203 1203
 
1204
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1204
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1205 1205
 
1206 1206
 
1207 1207
 		//finally, let's set the admin_page title
1208
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1208
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1209 1209
 
1210 1210
 
1211 1211
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 	}
1219 1219
 
1220 1220
 
1221
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1221
+	public function filter_tinymce_init($mceInit, $editor_id) {
1222 1222
 		return $mceInit;
1223 1223
 	}
1224 1224
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	}
1230 1230
 
1231 1231
 	public function _add_form_element_before() {
1232
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1232
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1233 1233
 	}
1234 1234
 
1235 1235
 	public function _add_form_element_after() {
@@ -1247,32 +1247,32 @@  discard block
 block discarded – undo
1247 1247
 	 * @return json json object
1248 1248
 	 */
1249 1249
 	public function switch_template_pack() {
1250
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1251
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1250
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1251
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1252 1252
 
1253 1253
 		//verify we have needed values.
1254
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1254
+		if (empty($GRP_ID) || empty($template_pack)) {
1255 1255
 			$this->_template_args['error'] = TRUE;
1256
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1256
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1257 1257
 		} else {
1258 1258
 			//get template, set the new template_pack and then reset to default
1259
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1259
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1260 1260
 
1261
-			$mtpg->set_template_pack_name( $template_pack );
1261
+			$mtpg->set_template_pack_name($template_pack);
1262 1262
 			$this->_req_data['msgr'] = $mtpg->messenger();
1263 1263
 			$this->_req_data['mt'] = $mtpg->message_type();
1264 1264
 
1265 1265
 			$query_args = $this->_reset_to_default_template();
1266 1266
 
1267
-			if ( empty( $query_args['id'] ) ) {
1268
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1267
+			if (empty($query_args['id'])) {
1268
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1269 1269
 				$this->_template_args['error'] = TRUE;
1270 1270
 			} else {
1271
-				$template_label =$mtpg->get_template_pack()->label;
1271
+				$template_label = $mtpg->get_template_pack()->label;
1272 1272
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1273
-				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 ) );
1273
+				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));
1274 1274
 				//generate the redirect url for js.
1275
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1275
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1276 1276
 				$this->_template_args['data']['redirect_url'] = $url;
1277 1277
 				$this->_template_args['success'] = true;
1278 1278
 			}
@@ -1293,56 +1293,56 @@  discard block
 block discarded – undo
1293 1293
 	protected function _reset_to_default_template() {
1294 1294
 		$success = TRUE;
1295 1295
 		$templates = array();
1296
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1296
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1297 1297
 		//we need to make sure we've got the info we need.
1298
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1299
-			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__ );
1298
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1299
+			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__);
1300 1300
 			$success = FALSE;
1301 1301
 		}
1302 1302
 
1303 1303
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1304
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1304
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1305 1305
 
1306
-		if ( $success ) {
1306
+		if ($success) {
1307 1307
 
1308 1308
 			//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.
1309
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1309
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1310 1310
 
1311 1311
 
1312 1312
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1313
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1313
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1314 1314
 
1315
-			if ( $success ) {
1315
+			if ($success) {
1316 1316
 				//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.
1317
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1317
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1318 1318
 			}
1319 1319
 
1320 1320
 		}
1321 1321
 
1322 1322
 		//any error messages?
1323
-		if ( !$success ) {
1324
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1323
+		if ( ! $success) {
1324
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1325 1325
 		}
1326 1326
 
1327 1327
 		//all good, let's add a success message!
1328
-		if ( $success && ! empty( $templates ) ) {
1328
+		if ($success && ! empty($templates)) {
1329 1329
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1330 1330
 			EE_Error::overwrite_success();
1331
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1331
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1332 1332
 		}
1333 1333
 
1334 1334
 
1335 1335
 		$query_args = array(
1336
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1337
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1338
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1336
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1337
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1338
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1339 1339
 			);
1340 1340
 
1341 1341
 		//if called via ajax then we return query args otherwise redirect
1342
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1342
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1343 1343
 			return $query_args;
1344 1344
 		} else {
1345
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1345
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1346 1346
 		}
1347 1347
 
1348 1348
 	}
@@ -1355,20 +1355,20 @@  discard block
 block discarded – undo
1355 1355
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1356 1356
 	 * @return void
1357 1357
 	 */
1358
-	public function _preview_message( $send = FALSE ) {
1358
+	public function _preview_message($send = FALSE) {
1359 1359
 		//first make sure we've got the necessary parameters
1360
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1361
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1360
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1361
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1362 1362
 		}
1363 1363
 
1364
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1364
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1365 1365
 
1366 1366
 		$MSG = new EE_messages();
1367 1367
 
1368 1368
 		//get the preview!
1369
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1369
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1370 1370
 
1371
-		if ( $send ) {
1371
+		if ($send) {
1372 1372
 			return $preview;
1373 1373
 		}
1374 1374
 
@@ -1378,16 +1378,16 @@  discard block
 block discarded – undo
1378 1378
 			'context' => $this->_req_data['context'],
1379 1379
 			'action' => 'edit_message_template'
1380 1380
 			);
1381
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1382
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1381
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1382
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1383 1383
 
1384 1384
 		//let's provide a helpful title for context
1385
-		$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']) );
1385
+		$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']));
1386 1386
 
1387 1387
 
1388 1388
 		//setup display of preview.
1389 1389
 		$this->_admin_page_title = $preview_title;
1390
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1390
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1391 1391
 		$this->_template_args['data']['force_json'] = TRUE;
1392 1392
 	}
1393 1393
 
@@ -1415,9 +1415,9 @@  discard block
 block discarded – undo
1415 1415
 	 * @return void
1416 1416
 	 */
1417 1417
 	protected function _register_edit_meta_boxes() {
1418
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1419
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1420
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1418
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1419
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1420
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1421 1421
 	}
1422 1422
 
1423 1423
 
@@ -1438,10 +1438,10 @@  discard block
 block discarded – undo
1438 1438
 
1439 1439
 		$tp_select_values = array();
1440 1440
 
1441
-		foreach ( $template_packs as $tp ) {
1441
+		foreach ($template_packs as $tp) {
1442 1442
 			//only include template packs that support this messenger and message type!
1443 1443
 			$supports = $tp->get_supports();
1444
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1444
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1445 1445
 				//not supported
1446 1446
 				continue;
1447 1447
 			}
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 		}
1454 1454
 
1455 1455
 		//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.
1456
-		if ( empty( $tp_select_values ) ) {
1456
+		if (empty($tp_select_values)) {
1457 1457
 			$tp_select_values[] = array(
1458 1458
 				'text' => __('Default', 'event_espresso'),
1459 1459
 				'id' => 'default'
@@ -1461,27 +1461,27 @@  discard block
 block discarded – undo
1461 1461
 		}
1462 1462
 
1463 1463
 		//setup variation select values for the currently selected template.
1464
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1464
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1465 1465
 		$variations_select_values = array();
1466
-		foreach ( $variations as $variation => $label ) {
1466
+		foreach ($variations as $variation => $label) {
1467 1467
 			$variations_select_values[] = array(
1468 1468
 				'text' => $label,
1469 1469
 				'id' => $variation
1470 1470
 				);
1471 1471
 		}
1472 1472
 
1473
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1473
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1474 1474
 
1475
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1476
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1475
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1476
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1477 1477
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1478 1478
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1479 1479
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1480 1480
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1481 1481
 
1482
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1482
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1483 1483
 
1484
-		EEH_Template::display_template( $template, $template_args );
1484
+		EEH_Template::display_template($template, $template_args);
1485 1485
 	}
1486 1486
 
1487 1487
 
@@ -1502,52 +1502,52 @@  discard block
 block discarded – undo
1502 1502
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1503 1503
 			);
1504 1504
 
1505
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1505
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1506 1506
 
1507 1507
 
1508 1508
 		//test button
1509 1509
 		//first we need to see if there are any fields
1510 1510
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1511 1511
 
1512
-		if ( !empty( $fields ) ) {
1512
+		if ( ! empty($fields)) {
1513 1513
 			//yup there be fields
1514
-			foreach ( $fields as $field => $config ) {
1515
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1514
+			foreach ($fields as $field => $config) {
1515
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1516 1516
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1517
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1518
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1517
+				$default = isset($config['default']) ? $config['default'] : '';
1518
+				$default = isset($config['value']) ? $config['value'] : $default;
1519 1519
 
1520 1520
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1521 1521
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1522
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1522
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1523 1523
 
1524 1524
 				$template_form_fields[$field_id] = array(
1525
-					'name' => 'test_settings_fld[' . $field . ']',
1525
+					'name' => 'test_settings_fld['.$field.']',
1526 1526
 					'label' => $config['label'],
1527 1527
 					'input' => $config['input'],
1528 1528
 					'type' => $config['type'],
1529 1529
 					'required' => $config['required'],
1530 1530
 					'validation' => $config['validation'],
1531
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1531
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1532 1532
 					'css_class' => $config['css_class'],
1533
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1533
+					'options' => isset($config['options']) ? $config['options'] : array(),
1534 1534
 					'default' => $default,
1535 1535
 					'format' => $config['format']
1536 1536
 					);
1537 1537
 			}
1538 1538
 		}
1539 1539
 
1540
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1540
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1541 1541
 
1542 1542
 		$test_settings_html = '';
1543 1543
 		//print out $test_settings_fields
1544
-		if ( !empty( $test_settings_fields ) ) {
1544
+		if ( ! empty($test_settings_fields)) {
1545 1545
 			echo $test_settings_fields;
1546
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" />';
1546
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" />';
1547 1547
 		}
1548 1548
 
1549 1549
 		//and button
1550
-		echo $test_settings_html . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1550
+		echo $test_settings_html.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1551 1551
 	}
1552 1552
 
1553 1553
 
@@ -1561,15 +1561,15 @@  discard block
 block discarded – undo
1561 1561
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1562 1562
 		$messenger = $this->_message_template_group->messenger_obj();
1563 1563
 		//now let's set the content depending on the status of the shortcodes array
1564
-		if ( empty( $shortcodes ) ) {
1565
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1564
+		if (empty($shortcodes)) {
1565
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1566 1566
 			echo $content;
1567 1567
 		} else {
1568 1568
 			$alt = 0;
1569 1569
 			?>
1570
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso' ); ?></p>
1570
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso'); ?></p>
1571 1571
 
1572
-			<?php foreach ( $shortcodes as $field => $allshortcodes ) : ?>
1572
+			<?php foreach ($shortcodes as $field => $allshortcodes) : ?>
1573 1573
 				<?php
1574 1574
 				//get the field label
1575 1575
 				$field_label = $messenger->get_field_label($field);
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
 					<div class="ee-shortcode-table-scroll">
1580 1580
 						<table class="widefat ee-shortcode-table">
1581 1581
 							<tbody>
1582
-					<?php foreach ( $allshortcodes as $code => $label ) : ?>
1583
-						<?php $alt_class = !($alt%2) ? 'class="alternate"' : ''; ?>
1582
+					<?php foreach ($allshortcodes as $code => $label) : ?>
1583
+						<?php $alt_class = ! ($alt % 2) ? 'class="alternate"' : ''; ?>
1584 1584
 						<tr <?php echo $alt_class; ?>>
1585 1585
 							<td><?php echo $code; ?></td>
1586 1586
 						</tr>
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 	protected function _set_shortcodes() {
1608 1608
 
1609 1609
 		//no need to run this if the property is already set
1610
-		if ( !empty($this->_shortcodes ) ) return;
1610
+		if ( ! empty($this->_shortcodes)) return;
1611 1611
 
1612 1612
 		$this->_shortcodes = $this->_get_shortcodes();
1613 1613
 	}
@@ -1624,14 +1624,14 @@  discard block
 block discarded – undo
1624 1624
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1625 1625
 	 * @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.
1626 1626
 	 */
1627
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1627
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1628 1628
 		$this->_set_message_template_group();
1629 1629
 
1630 1630
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1631
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1632
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1631
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1632
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1633 1633
 
1634
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1634
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1635 1635
 	}
1636 1636
 
1637 1637
 
@@ -1644,19 +1644,19 @@  discard block
 block discarded – undo
1644 1644
 	 */
1645 1645
 	protected function _set_message_template_group() {
1646 1646
 
1647
-		if ( !empty( $this->_message_template_group ) )
1647
+		if ( ! empty($this->_message_template_group))
1648 1648
 			return; //get out if this is already set.
1649 1649
 
1650
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1651
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1650
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1651
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1652 1652
 
1653 1653
 		//let's get the message templates
1654 1654
 		$MTP = EEM_Message_Template_Group::instance();
1655 1655
 
1656
-		if ( empty($GRP_ID) )
1656
+		if (empty($GRP_ID))
1657 1657
 			$this->_message_template_group = $MTP->create_default_object();
1658 1658
 		else
1659
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1659
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1660 1660
 
1661 1661
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1662 1662
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1682,26 +1682,26 @@  discard block
 block discarded – undo
1682 1682
 		<div class="ee-msg-switcher-container">
1683 1683
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1684 1684
 				<?php
1685
-					foreach ( $args as $name => $value ) {
1686
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1685
+					foreach ($args as $name => $value) {
1686
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1687 1687
 						?>
1688 1688
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1689 1689
 						<?php
1690 1690
 					}
1691 1691
 					//setup nonce_url
1692
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1692
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1693 1693
 				?>
1694 1694
 				<select name="context">
1695 1695
 					<?php
1696 1696
 					$context_templates = $template_group_object->context_templates();
1697
-					if ( is_array($context_templates) ) :
1698
-							foreach ( $context_templates as $context => $template_fields ) :
1697
+					if (is_array($context_templates)) :
1698
+							foreach ($context_templates as $context => $template_fields) :
1699 1699
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1700 1700
 					?>
1701 1701
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1702 1702
 					<?php endforeach; endif; ?>
1703 1703
 				</select>
1704
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1704
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1705 1705
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1706 1706
 			</form>
1707 1707
 			<?php echo $args['extra']; ?>
@@ -1725,8 +1725,8 @@  discard block
 block discarded – undo
1725 1725
 	 * @param int $index This helps us know which template field to select from the request array.
1726 1726
 	 */
1727 1727
 	protected function _set_message_template_column_values($index) {
1728
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1729
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1728
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1729
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1730 1730
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1731 1731
 			}
1732 1732
 		} else {
@@ -1758,27 +1758,27 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
 
1760 1760
 
1761
-	protected function _insert_or_update_message_template($new = FALSE ) {
1761
+	protected function _insert_or_update_message_template($new = FALSE) {
1762 1762
 
1763
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1763
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1764 1764
 		$success = 0;
1765 1765
 		$override = FALSE;
1766 1766
 
1767 1767
 		//setup notices description
1768
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1769
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1770
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1768
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1769
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1770
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1771 1771
 
1772
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1772
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1773 1773
 		$item_desc .= 'Message Template';
1774 1774
 		$query_args = array();
1775 1775
 		$validates = '';
1776 1776
 
1777 1777
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1778
-		if ( $new ) {
1779
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1780
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1781
-				if ( empty($edit_array) ) {
1778
+		if ($new) {
1779
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1780
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1781
+				if (empty($edit_array)) {
1782 1782
 					$success = 0;
1783 1783
 				} else {
1784 1784
 					$success = 1;
@@ -1797,34 +1797,34 @@  discard block
 block discarded – undo
1797 1797
 
1798 1798
 
1799 1799
 			//run update for each template field in displayed context
1800
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1801
-				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__ );
1800
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1801
+				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__);
1802 1802
 				$success = 0;
1803 1803
 				$action_desc = '';
1804 1804
 
1805 1805
 			} else {
1806 1806
 				//first validate all fields!
1807
-				$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']);
1807
+				$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']);
1808 1808
 
1809 1809
 				//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.
1810
-				if ( is_array($validates) && !empty($validates) ) {
1810
+				if (is_array($validates) && ! empty($validates)) {
1811 1811
 					//add the transient so when the form loads we know which fields to highlight
1812
-					$this->_add_transient( 'edit_message_template', $validates );
1812
+					$this->_add_transient('edit_message_template', $validates);
1813 1813
 
1814 1814
 					$success = 0;
1815
-					$action_desc ='';
1815
+					$action_desc = '';
1816 1816
 
1817 1817
 					//setup notices
1818
-					foreach ( $validates as $field => $error ) {
1819
-						if ( isset($error['msg'] ) )
1820
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1818
+					foreach ($validates as $field => $error) {
1819
+						if (isset($error['msg']))
1820
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1821 1821
 					}
1822 1822
 
1823 1823
 				} else {
1824
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1824
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1825 1825
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1826 1826
 
1827
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1827
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1828 1828
 
1829 1829
 						$message_template_fields = array(
1830 1830
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
 							'MTP_context' => $set_column_values['MTP_context'],
1833 1833
 							'MTP_content' => $set_column_values['MTP_content']
1834 1834
 							);
1835
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1836
-							if ( $updated === FALSE ) {
1837
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1838
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1835
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1836
+							if ($updated === FALSE) {
1837
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1838
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 							} else {
1840 1840
 								$success = 1;
1841 1841
 							}
@@ -1852,24 +1852,24 @@  discard block
 block discarded – undo
1852 1852
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1853 1853
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1854 1854
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1855
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1856
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1855
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1856
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1857 1857
 						);
1858 1858
 
1859
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1860
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1859
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1860
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1861 1861
 
1862
-					if ( $updated === FALSE ) {
1863
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1864
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1862
+					if ($updated === FALSE) {
1863
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1864
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1865 1865
 					} else {
1866 1866
 						//k now we need to ensure the template_pack and template_variation fields are set.
1867
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1868
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1869
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1870
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1871
-							$mtpg_obj->set_template_pack_name( $template_pack );
1872
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1867
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1868
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1869
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1870
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1871
+							$mtpg_obj->set_template_pack_name($template_pack);
1872
+							$mtpg_obj->set_template_pack_variation($template_variation);
1873 1873
 						}
1874 1874
 						$success = 1;
1875 1875
 					}
@@ -1879,7 +1879,7 @@  discard block
 block discarded – undo
1879 1879
 		}
1880 1880
 
1881 1881
 		//we return things differently if doing ajax
1882
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1882
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1883 1883
 			$this->_template_args['success'] = $success;
1884 1884
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1885 1885
 			$this->_template_args['content'] = '';
@@ -1887,9 +1887,9 @@  discard block
 block discarded – undo
1887 1887
 				'grpID' => $edit_array['GRP_ID'],
1888 1888
 				'templateName' => $edit_array['template_name']
1889 1889
 				);
1890
-			if ( $success ) {
1890
+			if ($success) {
1891 1891
 				EE_Error::overwrite_success();
1892
-				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') );
1892
+				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'));
1893 1893
 			}
1894 1894
 
1895 1895
 			$this->_return_json();
@@ -1897,13 +1897,13 @@  discard block
 block discarded – undo
1897 1897
 
1898 1898
 
1899 1899
 		//was a test send triggered?
1900
-		if ( isset( $this->_req_data['test_button'] ) ) {
1900
+		if (isset($this->_req_data['test_button'])) {
1901 1901
 			EE_Error::overwrite_success();
1902
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1902
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1903 1903
 			$override = TRUE;
1904 1904
 		}
1905 1905
 
1906
-		if ( empty( $query_args ) ) {
1906
+		if (empty($query_args)) {
1907 1907
 			$query_args = array(
1908 1908
 				'id' => $this->_req_data['GRP_ID'],
1909 1909
 				'context' => $this->_req_data['MTP_context'],
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
 				);
1912 1912
 		}
1913 1913
 
1914
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1914
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1915 1915
 	}
1916 1916
 
1917 1917
 
@@ -1924,24 +1924,24 @@  discard block
 block discarded – undo
1924 1924
 	 * @param  string $message_type message type being tested
1925 1925
 	 * @return void
1926 1926
 	 */
1927
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1927
+	protected function _do_test_send($context, $messenger, $message_type) {
1928 1928
 		//set things up for preview
1929 1929
 		$this->_req_data['messenger'] = $messenger;
1930 1930
 		$this->_req_data['message_type'] = $message_type;
1931 1931
 		$this->_req_data['context'] = $context;
1932
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1932
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1933 1933
 
1934 1934
 		//let's save any existing fields that might be required by the messenger
1935
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1936
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1935
+		if (isset($this->_req_data['test_settings_fld'])) {
1936
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1937 1937
 		}
1938 1938
 
1939 1939
 		$success = $this->_preview_message(TRUE);
1940 1940
 
1941
-		if ( $success ) {
1942
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1941
+		if ($success) {
1942
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1943 1943
 		} else {
1944
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1944
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1945 1945
 		}
1946 1946
 	}
1947 1947
 
@@ -1963,12 +1963,12 @@  discard block
 block discarded – undo
1963 1963
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1964 1964
 
1965 1965
 		//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.
1966
-		if ( empty( $message_types ) )
1966
+		if (empty($message_types))
1967 1967
 			return true;
1968 1968
 
1969
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1969
+		EE_Registry::instance()->load_helper('MSG_Template');
1970 1970
 
1971
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1971
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1972 1972
 
1973 1973
 	}
1974 1974
 
@@ -1984,33 +1984,33 @@  discard block
 block discarded – undo
1984 1984
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1985 1985
 	 * @return void
1986 1986
 	 */
1987
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1988
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1987
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1988
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1989 1989
 		$MTP = EEM_Message_Template_Group::instance();
1990 1990
 
1991 1991
 		$success = 1;
1992 1992
 
1993 1993
 		//incoming GRP_IDs
1994
-		if ( $all ) {
1994
+		if ($all) {
1995 1995
 			//Checkboxes
1996
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
1996
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1997 1997
 				//if array has more than one element then success message should be plural.
1998 1998
 				//todo: what about nonce?
1999
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1999
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2000 2000
 
2001 2001
 				//cycle through checkboxes
2002
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2003
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2004
-					if ( ! $trashed_or_restored ) {
2002
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2003
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2004
+					if ( ! $trashed_or_restored) {
2005 2005
 						$success = 0;
2006 2006
 					}
2007 2007
 				}
2008 2008
 			} else {
2009 2009
 				//grab single GRP_ID and handle
2010
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2011
-				if ( ! empty( $GRP_ID ) ) {
2012
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2013
-					if ( ! $trashed_or_restored ) {
2010
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2011
+				if ( ! empty($GRP_ID)) {
2012
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2013
+					if ( ! $trashed_or_restored) {
2014 2014
 						$success = 0;
2015 2015
 					}
2016 2016
 				} else {
@@ -2022,13 +2022,13 @@  discard block
 block discarded – undo
2022 2022
 
2023 2023
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2024 2024
 
2025
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2025
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2026 2026
 
2027 2027
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2028 2028
 
2029
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2029
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2030 2030
 
2031
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2031
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2032 2032
 
2033 2033
 	}
2034 2034
 
@@ -2044,26 +2044,26 @@  discard block
 block discarded – undo
2044 2044
 	 * @return void
2045 2045
 	 */
2046 2046
 	protected function _delete_message_template() {
2047
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2047
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2048 2048
 
2049 2049
 		$success = 1;
2050 2050
 
2051 2051
 		//checkboxes
2052
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2052
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2053 2053
 			//if array has more than one element then success message should be plural
2054
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2054
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2055 2055
 
2056 2056
 			//cycle through bulk action checkboxes
2057
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2058
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2057
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2058
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2059 2059
 			}
2060 2060
 		} else {
2061 2061
 			//grab single grp_id and delete
2062
-			$GRP_ID = absint($this->_req_data['id'] );
2063
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2062
+			$GRP_ID = absint($this->_req_data['id']);
2063
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2064 2064
 		}
2065 2065
 
2066
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2066
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2067 2067
 
2068 2068
 	}
2069 2069
 
@@ -2076,20 +2076,20 @@  discard block
 block discarded – undo
2076 2076
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2077 2077
 	 * @return success        boolean to indicate the success of the deletes or not.
2078 2078
 	 */
2079
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2079
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2080 2080
 		$success = 1;
2081 2081
 		$MTPG = EEM_Message_Template_Group::instance();
2082 2082
 		//first let's GET this group
2083
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2083
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2084 2084
 		//then delete permanently all the related Message Templates
2085
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2085
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2086 2086
 
2087
-		if ( $deleted === 0 )
2087
+		if ($deleted === 0)
2088 2088
 			$success = 0;
2089 2089
 
2090 2090
 		//now delete permanently this particular group
2091 2091
 
2092
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2092
+		if ($include_group && ! $MTG->delete_permanently()) {
2093 2093
 			$success = 0;
2094 2094
 		}
2095 2095
 		return $success;
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 	*	@return string
2108 2108
 	*/
2109 2109
 	protected function _learn_more_about_message_templates_link() {
2110
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2110
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2111 2111
 	}
2112 2112
 
2113 2113
 
@@ -2121,14 +2121,14 @@  discard block
 block discarded – undo
2121 2121
 	 */
2122 2122
 	protected function _settings() {
2123 2123
 
2124
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2124
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2125 2125
 
2126 2126
 		$this->_set_m_mt_settings();
2127 2127
 
2128
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2128
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2129 2129
 
2130 2130
 		//let's setup the messenger tabs
2131
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2131
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2132 2132
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2133 2133
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2134 2134
 
@@ -2147,10 +2147,10 @@  discard block
 block discarded – undo
2147 2147
 	 */
2148 2148
 	protected function _set_m_mt_settings() {
2149 2149
 		//first if this is already set then lets get out no need to regenerate data.
2150
-		if ( !empty($this->_m_mt_settings) )
2150
+		if ( ! empty($this->_m_mt_settings))
2151 2151
 			return;
2152 2152
 
2153
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2153
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2154 2154
 
2155 2155
 		//get all installed messengers and message_types
2156 2156
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2160,10 +2160,10 @@  discard block
 block discarded – undo
2160 2160
 
2161 2161
 		//assemble the array for the _tab_text_links helper
2162 2162
 
2163
-		foreach ( $messengers as $messenger ) {
2163
+		foreach ($messengers as $messenger) {
2164 2164
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2165 2165
 				'label' => ucwords($messenger->label['singular']),
2166
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2166
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2167 2167
 				'href' => $messenger->name,
2168 2168
 				'title' => __('Modify this Messenger', 'event_espresso'),
2169 2169
 				'slug' => $messenger->name,
@@ -2173,23 +2173,23 @@  discard block
 block discarded – undo
2173 2173
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2174 2174
 
2175 2175
 			//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.
2176
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2177
-			foreach ( $message_types as $message_type ) {
2176
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2177
+			foreach ($message_types as $message_type) {
2178 2178
 				//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.
2179
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2179
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2180 2180
 					continue;
2181 2181
 				}
2182 2182
 
2183
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2183
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2184 2184
 
2185 2185
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2186 2186
 						'label' => ucwords($message_type->label['singular']),
2187
-						'class' => 'message-type-' . $a_or_i,
2188
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2189
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2190
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2187
+						'class' => 'message-type-'.$a_or_i,
2188
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2189
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2190
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2191 2191
 						'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'),
2192
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2192
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2193 2193
 						'slug' => $message_type->name,
2194 2194
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2195 2195
 						'obj' => $message_type
@@ -2206,34 +2206,34 @@  discard block
 block discarded – undo
2206 2206
 	 * @param  boolean $active       Whether the message type is active or not
2207 2207
 	 * @return string                html output for the content
2208 2208
 	 */
2209
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2209
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2210 2210
 		//get message type fields
2211 2211
 		$fields = $message_type->get_admin_settings_fields();
2212
-		$settings_template_args['template_form_fields']= '';
2212
+		$settings_template_args['template_form_fields'] = '';
2213 2213
 
2214
-		if ( !empty( $fields ) && $active ) {
2214
+		if ( ! empty($fields) && $active) {
2215 2215
 
2216
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2216
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2217 2217
 
2218
-			foreach( $fields as $fldname => $fldprops ) {
2219
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2218
+			foreach ($fields as $fldname => $fldprops) {
2219
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2220 2220
 				$template_form_field[$field_id] = array(
2221
-					'name' => 'message_type_settings[' . $fldname . ']',
2221
+					'name' => 'message_type_settings['.$fldname.']',
2222 2222
 					'label' => $fldprops['label'],
2223 2223
 					'input' => $fldprops['field_type'],
2224 2224
 					'type' => $fldprops['value_type'],
2225 2225
 					'required' => $fldprops['required'],
2226 2226
 					'validation' => $fldprops['validation'],
2227
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2228
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2229
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2227
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2228
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2229
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2230 2230
 					'css_class' => 'no-drag',
2231 2231
 					'format' => $fldprops['format']
2232 2232
 					);
2233 2233
 			}
2234 2234
 
2235 2235
 
2236
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2236
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2237 2237
 		}
2238 2238
 
2239 2239
 		$settings_template_args['description'] = $message_type->description;
@@ -2253,13 +2253,13 @@  discard block
 block discarded – undo
2253 2253
 					)
2254 2254
 				);
2255 2255
 
2256
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2257
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2256
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2257
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2258 2258
 
2259 2259
 
2260 2260
 
2261
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2262
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2261
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2262
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2263 2263
 		return $content;
2264 2264
 	}
2265 2265
 
@@ -2276,21 +2276,21 @@  discard block
 block discarded – undo
2276 2276
 		$m_boxes = $mt_boxes = array();
2277 2277
 		$m_template_args = $mt_template_args = array();
2278 2278
 
2279
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2279
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2280 2280
 
2281
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2281
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2282 2282
 
2283
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2284
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2283
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2284
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2285 2285
 
2286 2286
 			//messenger meta boxes
2287 2287
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2288
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2289
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2290
-			$m_template_args[$messenger . '_a_box'] = array(
2291
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2292
-					'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'] ) : '',
2293
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2288
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2289
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2290
+			$m_template_args[$messenger.'_a_box'] = array(
2291
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2292
+					'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']) : '',
2293
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2294 2294
 					'hidden' => $active ? '' : ' hidden',
2295 2295
 					'hide_on_message' => $hide_on_message,
2296 2296
 					'messenger' => $messenger,
@@ -2299,10 +2299,10 @@  discard block
 block discarded – undo
2299 2299
 
2300 2300
 
2301 2301
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2302
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2303
-			$mt_template_args[$messenger . '_i_box'] = array(
2304
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2305
-				'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'] ) : '',
2302
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2303
+			$mt_template_args[$messenger.'_i_box'] = array(
2304
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2305
+				'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']) : '',
2306 2306
 				'hidden' => $active ? '' : ' hidden',
2307 2307
 				'hide_on_message' => $hide_on_message,
2308 2308
 				'hide_off_message' => $hide_off_message,
@@ -2312,19 +2312,19 @@  discard block
 block discarded – undo
2312 2312
 		}
2313 2313
 
2314 2314
 		//register messenger metaboxes
2315
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2316
-		foreach ( $m_boxes as $box => $label ) {
2317
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2318
-			$msgr = str_replace( '_a_box', '', $box );
2319
-			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 );
2315
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2316
+		foreach ($m_boxes as $box => $label) {
2317
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2318
+			$msgr = str_replace('_a_box', '', $box);
2319
+			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);
2320 2320
 		}
2321 2321
 
2322 2322
 		//register message type metaboxes
2323
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2324
-		foreach ( $mt_boxes as $box => $label ) {
2325
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2326
-			$mt = str_replace( '_i_box', '', $box );
2327
-			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 );
2323
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2324
+		foreach ($mt_boxes as $box => $label) {
2325
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2326
+			$mt = str_replace('_i_box', '', $box);
2327
+			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);
2328 2328
 		}
2329 2329
 
2330 2330
 	}
@@ -2335,13 +2335,13 @@  discard block
 block discarded – undo
2335 2335
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2336 2336
 	 * @return string            html formatted tabs
2337 2337
 	 */
2338
-	protected function _get_mt_tabs( $tab_array ) {
2338
+	protected function _get_mt_tabs($tab_array) {
2339 2339
 		$tab_array = (array) $tab_array;
2340
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2340
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2341 2341
 		$tabs = '';
2342 2342
 
2343
-		foreach ( $tab_array as $tab ) {
2344
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2343
+		foreach ($tab_array as $tab) {
2344
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2345 2345
 		}
2346 2346
 
2347 2347
 		return $tabs;
@@ -2355,7 +2355,7 @@  discard block
 block discarded – undo
2355 2355
 	 * @param  object $messenger The messenger we're setting up content for
2356 2356
 	 * @return string            html formatted content
2357 2357
 	 */
2358
-	protected function _get_messenger_box_content( $messenger ) {
2358
+	protected function _get_messenger_box_content($messenger) {
2359 2359
 
2360 2360
 		$fields = $messenger->get_admin_settings_fields();
2361 2361
 		$settings_template_args['template_form_fields'] = '';
@@ -2364,27 +2364,27 @@  discard block
 block discarded – undo
2364 2364
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2365 2365
 
2366 2366
 
2367
-		if ( !empty( $fields ) ) {
2367
+		if ( ! empty($fields)) {
2368 2368
 
2369 2369
 			$existing_settings = $messenger->get_existing_admin_settings();
2370 2370
 
2371
-			foreach( $fields as $fldname => $fldprops ) {
2372
-				$field_id = $messenger->name . '-' . $fldname;
2371
+			foreach ($fields as $fldname => $fldprops) {
2372
+				$field_id = $messenger->name.'-'.$fldname;
2373 2373
 				$template_form_field[$field_id] = array(
2374
-					'name' => 'messenger_settings[' . $field_id . ']',
2374
+					'name' => 'messenger_settings['.$field_id.']',
2375 2375
 					'label' => $fldprops['label'],
2376 2376
 					'input' => $fldprops['field_type'],
2377 2377
 					'type' => $fldprops['value_type'],
2378 2378
 					'required' => $fldprops['required'],
2379 2379
 					'validation' => $fldprops['validation'],
2380
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2380
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2381 2381
 					'css_class' => '',
2382 2382
 					'format' => $fldprops['format']
2383 2383
 					);
2384 2384
 			}
2385 2385
 
2386 2386
 
2387
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2387
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2388 2388
 		}
2389 2389
 
2390 2390
 		//we also need some hidden fields
@@ -2400,8 +2400,8 @@  discard block
 block discarded – undo
2400 2400
 			);
2401 2401
 
2402 2402
 		//make sure any active message types that are existing are included in the hidden fields
2403
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2404
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2403
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2404
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2405 2405
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2406 2406
 						'type' => 'hidden',
2407 2407
 						'value' => $mt
@@ -2409,25 +2409,25 @@  discard block
 block discarded – undo
2409 2409
 			}
2410 2410
 		}
2411 2411
 
2412
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2412
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2413 2413
 
2414
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2414
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2415 2415
 
2416 2416
 		$settings_template_args['messenger'] = $messenger->name;
2417 2417
 		$settings_template_args['description'] = $messenger->description;
2418 2418
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2419 2419
 
2420 2420
 
2421
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2421
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2422 2422
 
2423
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2423
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2424 2424
 
2425 2425
 
2426 2426
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2427
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2427
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2428 2428
 		$settings_template_args['on_off_status'] = $active ? true : false;
2429
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2430
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2429
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2430
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2431 2431
 		return $content;
2432 2432
 	}
2433 2433
 
@@ -2441,39 +2441,39 @@  discard block
 block discarded – undo
2441 2441
 	public function activate_messenger_toggle() {
2442 2442
 		$success = TRUE;
2443 2443
 		//let's check that we have required data
2444
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2445
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2444
+		if ( ! isset($this->_req_data['messenger'])) {
2445
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2446 2446
 			$success = FALSE;
2447 2447
 		}
2448 2448
 
2449 2449
 		//do a nonce check here since we're not arriving via a normal route
2450
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2451
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2450
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2451
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2452 2452
 
2453
-		$this->_verify_nonce( $nonce, $nonce_ref );
2453
+		$this->_verify_nonce($nonce, $nonce_ref);
2454 2454
 
2455 2455
 
2456 2456
 
2457
-		if ( !isset( $this->_req_data[ 'status' ])) {
2458
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2457
+		if ( ! isset($this->_req_data['status'])) {
2458
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2459 2459
 			$success = FALSE;
2460 2460
 		}
2461 2461
 
2462 2462
 		//do check to verify we have a valid status.
2463 2463
 		$status = $this->_req_data['status'];
2464 2464
 
2465
-		if ( $status != 'off' && $status != 'on' ) {
2466
-			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__ );
2465
+		if ($status != 'off' && $status != 'on') {
2466
+			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__);
2467 2467
 			$success = FALSE;
2468 2468
 		}
2469 2469
 
2470
-		if ( $success ) {
2470
+		if ($success) {
2471 2471
 			//made it here?  Stop dawdling then!!
2472
-			if ( $status == 'off' ) {
2472
+			if ($status == 'off') {
2473 2473
 				//off = deactivate.  get it?
2474
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2474
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2475 2475
 			} else {
2476
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2476
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2477 2477
 			}
2478 2478
 		}
2479 2479
 
@@ -2499,26 +2499,26 @@  discard block
 block discarded – undo
2499 2499
 
2500 2500
 
2501 2501
 		//let's make sure we have the necessary data
2502
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2503
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2502
+		if ( ! isset($this->_req_data['message_type'])) {
2503
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2504 2504
 			$success = FALSE;
2505 2505
 		}
2506 2506
 
2507 2507
 
2508 2508
 		//do a nonce check here since we're not arriving via a normal route
2509
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2510
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2509
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2510
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2511 2511
 
2512
-		$this->_verify_nonce( $nonce, $nonce_ref );
2512
+		$this->_verify_nonce($nonce, $nonce_ref);
2513 2513
 
2514 2514
 
2515
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2516
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2515
+		if ( ! isset($this->_req_data['messenger'])) {
2516
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2517 2517
 			$success = FALSE;
2518 2518
 		}
2519 2519
 
2520
-		if ( !isset( $this->_req_data[ 'status' ])) {
2521
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2520
+		if ( ! isset($this->_req_data['status'])) {
2521
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2522 2522
 			$success = FALSE;
2523 2523
 		}
2524 2524
 
@@ -2526,16 +2526,16 @@  discard block
 block discarded – undo
2526 2526
 		//do check to verify we have a valid status.
2527 2527
 		$status = $this->_req_data['status'];
2528 2528
 
2529
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2530
-			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__ );
2529
+		if ($status != 'activate' && $status != 'deactivate') {
2530
+			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__);
2531 2531
 			$success = FALSE;
2532 2532
 		}
2533 2533
 
2534 2534
 
2535
-		if ( $success ) {
2535
+		if ($success) {
2536 2536
 			//made it here? um, what are you waiting for then?
2537 2537
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2538
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2538
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2539 2539
 		}
2540 2540
 
2541 2541
 		$this->_template_args['success'] = $success;
@@ -2562,28 +2562,28 @@  discard block
 block discarded – undo
2562 2562
 		$templates = TRUE;
2563 2563
 		$this->_set_m_mt_settings();
2564 2564
 
2565
-		if ( !$deactivate ) {
2565
+		if ( ! $deactivate) {
2566 2566
 
2567 2567
 
2568 2568
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2569
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2569
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2570 2570
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2571 2571
 
2572 2572
 			//get has_active so we can sure its kept up to date.
2573
-			$has_activated = get_option( 'ee_has_activated_messages' );
2573
+			$has_activated = get_option('ee_has_activated_messages');
2574 2574
 
2575
-			if ( empty( $has_activated[$messenger] ) ) {
2575
+			if (empty($has_activated[$messenger])) {
2576 2576
 				$has_activated[$messenger] = array();
2577 2577
 			}
2578 2578
 
2579 2579
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2580 2580
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2581 2581
 
2582
-			foreach ( $default_types as $type ) {
2582
+			foreach ($default_types as $type) {
2583 2583
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2584
-				if ( !empty( $settings_fields ) ) {
2584
+				if ( ! empty($settings_fields)) {
2585 2585
 					//we have fields for this message type so let's get the defaults for saving.
2586
-					foreach ( $settings_fields as $field => $values ) {
2586
+					foreach ($settings_fields as $field => $values) {
2587 2587
 						$settings[$field] = $values['default'];
2588 2588
 					}
2589 2589
 					//let's set the data for reloading this message type form in ajax
@@ -2591,9 +2591,9 @@  discard block
 block discarded – undo
2591 2591
 				} else {
2592 2592
 					$settings = array();
2593 2593
 				}
2594
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2594
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2595 2595
 
2596
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2596
+				if ( ! in_array($type, $has_activated[$messenger])) {
2597 2597
 					$has_activated[$messenger][] = $type;
2598 2598
 				}
2599 2599
 			}
@@ -2601,41 +2601,41 @@  discard block
 block discarded – undo
2601 2601
 			//any default settings for the messenger?
2602 2602
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2603 2603
 
2604
-			if ( !empty( $msgr_settings ) ) {
2605
-				foreach ( $msgr_settings as $field => $value ) {
2604
+			if ( ! empty($msgr_settings)) {
2605
+				foreach ($msgr_settings as $field => $value) {
2606 2606
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2607 2607
 				}
2608 2608
 			}
2609 2609
 
2610 2610
 			//update settings in database
2611
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2612
-			update_option( 'ee_has_activated_messages', $has_activated );
2611
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2612
+			update_option('ee_has_activated_messages', $has_activated);
2613 2613
 
2614 2614
 
2615 2615
 			//generate new templates (if necessary)
2616
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2616
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2617 2617
 
2618 2618
 			EE_Error::overwrite_success();
2619 2619
 
2620 2620
 			//if generation failed then we need to remove the active messenger.
2621
-			if ( !$templates ) {
2621
+			if ( ! $templates) {
2622 2622
 				unset($this->_active_messengers[$messenger]);
2623
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2623
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2624 2624
 			} else {
2625 2625
 				//all is good let's do a success message
2626
-				if ( $message_type ) {
2627
-					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'] ) ) );
2626
+				if ($message_type) {
2627
+					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'])));
2628 2628
 
2629 2629
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2630
-					if ( $message_type == 'invoice' ) {
2631
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2632
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2633
-						if ( $pm instanceof EE_Payment_Method ) {
2634
-							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' ) );
2630
+					if ($message_type == 'invoice') {
2631
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2632
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2633
+						if ($pm instanceof EE_Payment_Method) {
2634
+							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'));
2635 2635
 						}
2636 2636
 					}
2637 2637
 				} else {
2638
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2638
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2639 2639
 				}
2640 2640
 			}
2641 2641
 
@@ -2651,36 +2651,36 @@  discard block
 block discarded – undo
2651 2651
 			$update_array = array(
2652 2652
 				'MTP_messenger' => $messenger);
2653 2653
 
2654
-			if ( $message_type ) {
2654
+			if ($message_type) {
2655 2655
 				$update_array['MTP_message_type'] = $message_type;
2656 2656
 			}
2657 2657
 
2658
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2658
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2659 2659
 
2660 2660
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2661 2661
 
2662 2662
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2663
-			if ( $message_type ) {
2664
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2663
+			if ($message_type) {
2664
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2665 2665
 			} else {
2666
-				unset( $this->_active_messengers[$messenger] );
2666
+				unset($this->_active_messengers[$messenger]);
2667 2667
 			}
2668 2668
 
2669
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2669
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2670 2670
 			EE_Error::overwrite_success();
2671
-			if ( $message_type ) {
2672
-				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']) ) );
2671
+			if ($message_type) {
2672
+				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'])));
2673 2673
 			} else {
2674
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2674
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2675 2675
 			}
2676 2676
 
2677 2677
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2678
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2679
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2680
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2681
-				if ( $count_updated > 0 ) {
2682
-					$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' );
2683
-					EE_Error::add_attention( $msg );
2678
+			if ($messenger == 'html' || $message_type == 'invoice') {
2679
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2680
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2681
+				if ($count_updated > 0) {
2682
+					$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');
2683
+					EE_Error::add_attention($msg);
2684 2684
 				}
2685 2685
 			}
2686 2686
 
@@ -2697,8 +2697,8 @@  discard block
 block discarded – undo
2697 2697
 	 * @return string html data
2698 2698
 	 */
2699 2699
 	public function update_mt_form() {
2700
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2701
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2700
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2701
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2702 2702
 			$this->_return_json();
2703 2703
 		}
2704 2704
 
@@ -2707,7 +2707,7 @@  discard block
 block discarded – undo
2707 2707
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2708 2708
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2709 2709
 
2710
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2710
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2711 2711
 		$this->_template_args['success'] = true;
2712 2712
 		$this->_template_args['content'] = $content;
2713 2713
 		$this->_return_json();
@@ -2721,36 +2721,36 @@  discard block
 block discarded – undo
2721 2721
 	 * @return json success or fail message
2722 2722
 	 */
2723 2723
 	public function save_settings() {
2724
-		if ( !isset( $this->_req_data['type'] ) ) {
2725
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2724
+		if ( ! isset($this->_req_data['type'])) {
2725
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2726 2726
 			$this->_template_args['error'] = TRUE;
2727 2727
 			$this->_return_json();
2728 2728
 		}
2729 2729
 
2730 2730
 
2731
-		if ( $this->_req_data['type'] == 'messenger' ) {
2731
+		if ($this->_req_data['type'] == 'messenger') {
2732 2732
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2733 2733
 			$messenger = $settings['messenger'];
2734 2734
 			//let's setup the settings data
2735
-			foreach ( $settings as $key => $value ) {
2736
-				switch ( $key ) {
2735
+			foreach ($settings as $key => $value) {
2736
+				switch ($key) {
2737 2737
 					case 'messenger' :
2738
-						unset( $settings['messenger'] );
2738
+						unset($settings['messenger']);
2739 2739
 						break;
2740 2740
 					case 'message_types' :
2741
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2742
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2743
-								if ( isset( $settings['message_types'][$mt] ) )
2744
-									$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();
2741
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2742
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2743
+								if (isset($settings['message_types'][$mt]))
2744
+									$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();
2745 2745
 							}
2746 2746
 						} else {
2747
-							foreach ( $value as $mt => $v ) {
2747
+							foreach ($value as $mt => $v) {
2748 2748
 								//let's see if this message type is already present and has settings.
2749
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2749
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2750 2750
 							}
2751 2751
 						}
2752 2752
 						//k settings are set let's get rid of the message types index
2753
-						unset( $settings['message_types'] );
2753
+						unset($settings['message_types']);
2754 2754
 						break;
2755 2755
 					default :
2756 2756
 						$settings[$key] = $value;
@@ -2760,36 +2760,36 @@  discard block
 block discarded – undo
2760 2760
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2761 2761
 		}
2762 2762
 
2763
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2763
+		else if ($this->_req_data['type'] == 'message_type') {
2764 2764
 			$settings = $this->_req_data['message_type_settings'];
2765 2765
 			$messenger = $settings['messenger'];
2766 2766
 			$message_type = $settings['message_type'];
2767 2767
 
2768
-			foreach ( $settings as $key => $value ) {
2769
-				switch ( $key ) {
2768
+			foreach ($settings as $key => $value) {
2769
+				switch ($key) {
2770 2770
 					case 'messenger' :
2771
-						unset( $settings['messenger'] );
2771
+						unset($settings['messenger']);
2772 2772
 						break;
2773 2773
 					case 'message_type' :
2774
-						unset( $settings['message_type'] );
2774
+						unset($settings['message_type']);
2775 2775
 						break;
2776 2776
 					default :
2777 2777
 						$settings['settings'][$key] = $value;
2778
-						unset( $settings[$key] );
2778
+						unset($settings[$key]);
2779 2779
 						break;
2780 2780
 				}
2781 2781
 			}
2782 2782
 
2783
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2783
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2784 2784
 		}
2785 2785
 
2786 2786
 		//okay we should have the data all setup.  Now we just update!
2787
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2787
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2788 2788
 
2789
-		if ( $success ) {
2790
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2789
+		if ($success) {
2790
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2791 2791
 		} else {
2792
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2792
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2793 2793
 		}
2794 2794
 
2795 2795
 		$this->_template_args['success'] = $success;
Please login to merge, or discard this patch.
admin_pages/payments/Payments_Admin_Page.core.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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() );
Please login to merge, or discard this patch.
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -655,7 +656,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
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',
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 					'order' => 10
135 135
 					),
136 136
 				'metaboxes' => $this->_default_espresso_metaboxes,
137
-                'help_tabs' => array_merge(
137
+				'help_tabs' => array_merge(
138 138
 			array(
139 139
 					'payment_methods_overview_help_tab' => array(
140 140
 						'title' => __('Payment Methods Overview', 'event_espresso'),
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
 
791 791
 	/**
792 792
 	 * 		_update_payment_settings
793
-	*		@access protected
794
-	*		@return array
795
-	*/
793
+	 *		@access protected
794
+	 *		@return array
795
+	 */
796 796
 	protected function _update_payment_settings() {
797 797
 		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;
798 798
 		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
Please login to merge, or discard this patch.
Spacing   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
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
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 						'filename' => 'payment_methods_overview_stripe'
186 186
 						)*/
187 187
 				$this->_add_payment_method_help_tabs()),
188
-				'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ),
188
+				'help_tour' => array('Payment_Methods_Selection_Help_Tour'),
189 189
 				'require_nonce' => FALSE
190 190
 				);
191 191
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 						'filename' => 'payment_methods_settings'
203 203
 						)
204 204
 					),
205
-				'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),
206
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
205
+				'help_tour' => array('Payment_Methods_Settings_Help_Tour'),
206
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
207 207
 				'require_nonce' => FALSE
208 208
 				),
209 209
 			'payment_log'=>array(
@@ -222,18 +222,18 @@  discard block
 block discarded – undo
222 222
 	/**
223 223
 	 * @return array
224 224
 	 */
225
-	protected function _add_payment_method_help_tabs(){
225
+	protected function _add_payment_method_help_tabs() {
226 226
 		EE_Registry::instance()->load_lib('Payment_Method_Manager');
227 227
 		$payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();
228 228
 		$all_pmt_help_tabs_config = array();
229
-		foreach( $payment_method_types as $payment_method_type ){
230
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) {
229
+		foreach ($payment_method_types as $payment_method_type) {
230
+			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) {
231 231
 				continue;
232 232
 			}
233
-			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){
233
+			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) {
234 234
 				$all_pmt_help_tabs_config[$help_tab_name] = array(
235 235
 					'title'=>$config['title'],
236
-					'content'=>EEH_Template::display_template( $payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true)
236
+					'content'=>EEH_Template::display_template($payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true)
237 237
 				);
238 238
 			}
239 239
 		}
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 
255 255
 
256 256
 	public function load_scripts_styles() {
257
-		wp_enqueue_script( 'ee_admin_js' );
258
-		wp_enqueue_script( 'ee-text-links' );
259
-		wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
257
+		wp_enqueue_script('ee_admin_js');
258
+		wp_enqueue_script('ee-text-links');
259
+		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
260 260
 	}
261 261
 
262 262
 
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 
266 266
 	public function load_scripts_styles_default() {
267 267
 		//styles
268
-		wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );
269
-		wp_enqueue_style( 'espresso_payments' );
270
-		wp_enqueue_style( 'ee-text-links' );
268
+		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION);
269
+		wp_enqueue_style('espresso_payments');
270
+		wp_enqueue_style('ee-text-links');
271 271
 		//scripts
272 272
 	}
273 273
 
@@ -281,27 +281,27 @@  discard block
 block discarded – undo
281 281
 		 * to the loading process.  However, people MUST setup the details for the payment method so its safe to do a
282 282
 		 * recheck here.
283 283
 		 */
284
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
284
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
285 285
 		EEM_Payment_Method::instance()->verify_button_urls();
286
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
287
-		EE_Registry::instance()->load_helper( 'HTML' );
286
+		EE_Registry::instance()->load_helper('Tabbed_Content');
287
+		EE_Registry::instance()->load_helper('HTML');
288 288
 		//setup tabs, one for each payment method type
289 289
 		$tabs = array();
290
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
290
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
291 291
 			// we don't want to show admin-only PMTs for now
292
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
292
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
293 293
 				continue;
294 294
 			}
295 295
 			//check access
296
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
296
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
297 297
 				continue;
298 298
 			}
299 299
 			//check for any active pms of that type
300
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
301
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
300
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
301
+			if ( ! $payment_method instanceof EE_Payment_Method) {
302 302
 				$payment_method = EE_Payment_Method::new_instance(
303 303
 					array(
304
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
304
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
305 305
 						'PMD_type'					=>$pmt_obj->system_name(),
306 306
 						'PMD_name'				=>$pmt_obj->pretty_name(),
307 307
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 
312 312
 			add_meta_box(
313 313
 				//html id
314
-				'espresso_' . $payment_method->slug() . '_payment_settings',
314
+				'espresso_'.$payment_method->slug().'_payment_settings',
315 315
 				//title
316
-				sprintf( __('%s Settings', 'event_espresso'), $payment_method->admin_name() ),
316
+				sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
317 317
 				//callback
318
-				array( $this, 'payment_method_settings_meta_box' ),
318
+				array($this, 'payment_method_settings_meta_box'),
319 319
 				//post type
320 320
 				NULL,
321 321
 				//context
@@ -323,20 +323,20 @@  discard block
 block discarded – undo
323 323
 				//priority
324 324
 				'default',
325 325
 				//callback args
326
-				array( 'payment_method' => $payment_method )
326
+				array('payment_method' => $payment_method)
327 327
 			);
328 328
 
329 329
 			//setup for tabbed content
330 330
 			$tabs[$payment_method->slug()] = array(
331 331
 				'label' => $payment_method->admin_name(),
332 332
 				'class' =>  $payment_method->active() ? 'gateway-active' : '',
333
-				'href' => 'espresso_' . $payment_method->slug() . '_payment_settings',
333
+				'href' => 'espresso_'.$payment_method->slug().'_payment_settings',
334 334
 				'title' => __('Modify this Payment Method', 'event_espresso'),
335 335
 				'slug' => $payment_method->slug()
336 336
 			);
337 337
 		}
338 338
 
339
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
339
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
340 340
 		$this->display_admin_page_with_sidebar();
341 341
 
342 342
 	}
@@ -347,20 +347,20 @@  discard block
 block discarded – undo
347 347
 	 *   _get_active_payment_method_slug
348 348
 	 * 	@return string
349 349
 	 */
350
-	protected function _get_active_payment_method_slug(){
350
+	protected function _get_active_payment_method_slug() {
351 351
 		$payment_method_slug = FALSE;
352 352
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
353
-		if ( isset( $this->_req_data['payment_method'] )) {
353
+		if (isset($this->_req_data['payment_method'])) {
354 354
 			// if they provided the current payment method, use it
355
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
355
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
356 356
 		}
357
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
357
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
358 358
 		// if that didn't work or wasn't provided, find another way to select the current pm
359
-		if ( ! $this->_verify_payment_method( $payment_method )) {
359
+		if ( ! $this->_verify_payment_method($payment_method)) {
360 360
 			// like, looking for an active one
361
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
361
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
362 362
 			// test that one as well
363
-			if ( $this->_verify_payment_method( $payment_method )) {
363
+			if ($this->_verify_payment_method($payment_method)) {
364 364
 				$payment_method_slug = $payment_method->slug();
365 365
 			} else {
366 366
 				$payment_method_slug = 'paypal_standard';
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
 	 * @param \EE_Payment_Method $payment_method
379 379
 	 * @return boolean
380 380
 	 */
381
-	protected function _verify_payment_method( $payment_method ){
381
+	protected function _verify_payment_method($payment_method) {
382 382
 		if (
383 383
 			$payment_method instanceof EE_Payment_Method &&
384 384
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
385
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
385
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
386 386
 		) {
387 387
 			return TRUE;
388 388
 		}
@@ -399,21 +399,21 @@  discard block
 block discarded – undo
399 399
 	 * @return string
400 400
 	 * @throws EE_Error
401 401
 	 */
402
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
403
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
404
-		if ( ! $payment_method instanceof EE_Payment_Method ){
405
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
402
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
403
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
404
+		if ( ! $payment_method instanceof EE_Payment_Method) {
405
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
406 406
 		}
407 407
 		$payment_method_scopes = $payment_method->active();
408 408
 		// if the payment method really exists show its form, otherwise the activation template
409
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
410
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
411
-				if ( $form->form_data_present_in( $this->_req_data )) {
412
-					$form->receive_form_submission( $this->_req_data );
409
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
410
+				$form = $this->_generate_payment_method_settings_form($payment_method);
411
+				if ($form->form_data_present_in($this->_req_data)) {
412
+					$form->receive_form_submission($this->_req_data);
413 413
 				}
414
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
414
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
415 415
 		} else {
416
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
416
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
417 417
 		}
418 418
 	}
419 419
 
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
 	 * @param \EE_Payment_Method $payment_method
427 427
 	 * @return \EE_Form_Section_Proper
428 428
 	 */
429
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
430
-		if ( ! $payment_method instanceof EE_Payment_Method ){
429
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
430
+		if ( ! $payment_method instanceof EE_Payment_Method) {
431 431
 			return new EE_Form_Section_Proper();
432 432
 		}
433 433
 		return new EE_Form_Section_Proper(
434 434
 			array(
435
-				'name' 	=> $payment_method->slug() . '_settings_form',
436
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
435
+				'name' 	=> $payment_method->slug().'_settings_form',
436
+				'html_id' 	=> $payment_method->slug().'_settings_form',
437 437
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
438 438
 					array(
439 439
 						'action' 						=> 'update_payment_method',
@@ -445,12 +445,12 @@  discard block
 block discarded – undo
445 445
 				'subsections' 			=> apply_filters(
446 446
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
447 447
 					array(
448
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
449
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
450
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
451
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
452
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
453
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
448
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
449
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
450
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
451
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
452
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
453
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
454 454
 					)
455 455
 				)
456 456
 			)
@@ -466,19 +466,19 @@  discard block
 block discarded – undo
466 466
 	 * @param \EE_Payment_Method $payment_method
467 467
 	 * @return \EE_Form_Section_Proper
468 468
 	 */
469
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
470
-		if ( $payment_method->type_obj()->requires_https() ) {
469
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
470
+		if ($payment_method->type_obj()->requires_https()) {
471 471
 			return new EE_Form_Section_HTML(
472 472
 				EEH_HTML::tr(
473 473
 					EEH_HTML::th(
474 474
 						EEH_HTML::label(
475
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
475
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
476 476
 						)
477
-					) .
477
+					).
478 478
 					EEH_HTML::td(
479
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
480
-						EEH_HTML::br() .
481
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
479
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
480
+						EEH_HTML::br().
481
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
482 482
 					)
483 483
 				)
484 484
 			);
@@ -496,19 +496,19 @@  discard block
 block discarded – undo
496 496
 	 * @param \EE_Payment_Method $payment_method
497 497
 	 * @return \EE_Form_Section_Proper
498 498
 	 */
499
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
500
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
499
+	protected function _currency_support(EE_Payment_Method $payment_method) {
500
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
501 501
 			return new EE_Form_Section_HTML(
502 502
 				EEH_HTML::tr(
503 503
 					EEH_HTML::th(
504 504
 						EEH_HTML::label(
505
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
505
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
506 506
 						)
507
-					) .
507
+					).
508 508
 					EEH_HTML::td(
509 509
 						EEH_HTML::strong(
510 510
 							sprintf(
511
-								__( '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'),
511
+								__('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'),
512 512
 								EE_Config::instance()->currency->code
513 513
 							)
514 514
 						)
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 	 * @param \EE_Payment_Method $payment_method
529 529
 	 * @return \EE_Form_Section_HTML
530 530
 	 */
531
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
531
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
532 532
 		//modify the form so we only have/show fields that will be implemented for this version
533
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
533
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
534 534
 	}
535 535
 
536 536
 
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
 	 * @return \EE_Payment_Method_Form
544 544
 	 * @throws \EE_Error
545 545
 	 */
546
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
547
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
546
+	protected function _simplify_form($form_section, $payment_method_name = '') {
547
+		if ($form_section instanceof EE_Payment_Method_Form) {
548 548
 			$form_section->exclude(
549 549
 				array(
550 550
 					'PMD_type', //dont want them changing the type
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			);
556 556
 			return $form_section;
557 557
 		} else {
558
-			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 ));
558
+			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));
559 559
 		}
560 560
 	}
561 561
 
@@ -568,18 +568,18 @@  discard block
 block discarded – undo
568 568
 	 * @param \EE_Payment_Method $payment_method
569 569
 	 * @return \EE_Form_Section_HTML
570 570
 	 */
571
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
571
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
572 572
 		$update_button = new EE_Submit_Input(
573 573
 			array(
574
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
575
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
574
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
575
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
576 576
 				'html_label' => EEH_HTML::nbsp()
577 577
 			)
578 578
 		);
579 579
 		return new EE_Form_Section_HTML(
580
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
580
+			EEH_HTML::no_row(EEH_HTML::br(2)).
581 581
 			EEH_HTML::tr(
582
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
582
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
583 583
 				EEH_HTML::td(
584 584
 					$update_button->get_html_for_input()
585 585
 				)
@@ -596,11 +596,11 @@  discard block
 block discarded – undo
596 596
 	 * @param \EE_Payment_Method $payment_method
597 597
 	 * @return \EE_Form_Section_Proper
598 598
 	 */
599
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
600
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
599
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
600
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
601 601
 		return new EE_Form_Section_HTML(
602 602
 			EEH_HTML::tr(
603
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
603
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
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
 block discarded – undo
612 612
 						),
613 613
 						$link_text_and_title,
614 614
 						$link_text_and_title,
615
-						'deactivate_' . $payment_method->slug(),
615
+						'deactivate_'.$payment_method->slug(),
616 616
 						'espresso-button button-secondary'
617 617
 					)
618 618
 				)
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 	 * @param \EE_Payment_Method $payment_method
629 629
 	 * @return \EE_Form_Section_Proper
630 630
 	 */
631
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
632
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
631
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
632
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
633 633
 		return new EE_Form_Section_Proper(
634 634
 			array(
635
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
636
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
635
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
636
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
637 637
 				'action' 	=> '#',
638 638
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
639 639
 				'subsections' 			=> apply_filters(
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
 						new EE_Form_Section_HTML(
643 643
 							EEH_HTML::tr(
644 644
 								EEH_HTML::th(
645
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
646
-								) .
645
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
646
+								).
647 647
 								EEH_HTML::td(
648 648
 									EEH_HTML::link(
649 649
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 										),
656 656
 										$link_text_and_title,
657 657
 										$link_text_and_title,
658
-										'activate_' . $payment_method->slug(),
658
+										'activate_'.$payment_method->slug(),
659 659
 										'espresso-button-green button-primary'
660 660
 									)
661 661
 								)
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 	protected function _fine_print() {
677 677
 		return new EE_Form_Section_HTML(
678 678
 			EEH_HTML::tr(
679
-				EEH_HTML::th() .
679
+				EEH_HTML::th().
680 680
 				EEH_HTML::td(
681
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
681
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
682 682
 				)
683 683
 			)
684 684
 		);
@@ -690,15 +690,15 @@  discard block
 block discarded – undo
690 690
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
691 691
 	 * @global WP_User $current_user
692 692
 	 */
693
-	protected function _activate_payment_method(){
694
-		if(isset($this->_req_data['payment_method_type'])){
693
+	protected function _activate_payment_method() {
694
+		if (isset($this->_req_data['payment_method_type'])) {
695 695
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
696 696
 			//see if one exists
697
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
698
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
697
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
698
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
699 699
 
700
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
701
-		}else{
700
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
701
+		} else {
702 702
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
703 703
 		}
704 704
 	}
@@ -706,14 +706,14 @@  discard block
 block discarded – undo
706 706
 	/**
707 707
 	 * Deactivates the payment method with the specified slug, and redirects.
708 708
 	 */
709
-	protected function _deactivate_payment_method(){
710
-		if(isset($this->_req_data['payment_method'])){
709
+	protected function _deactivate_payment_method() {
710
+		if (isset($this->_req_data['payment_method'])) {
711 711
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
712 712
 			//deactivate it
713 713
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
714
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
715
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
716
-		}else{
714
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
715
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
716
+		} else {
717 717
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
718 718
 		}
719 719
 	}
@@ -727,39 +727,39 @@  discard block
 block discarded – undo
727 727
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
728 728
 	 * @return void
729 729
 	 */
730
-	protected function _update_payment_method(){
731
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
730
+	protected function _update_payment_method() {
731
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
732 732
 			//ok let's find which gateway form to use based on the form input
733 733
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
734 734
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
735 735
 			$correct_pmt_form_to_use = NULL;
736 736
 			$pmt_obj = NULL;
737
-			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){
737
+			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
738 738
 				/** @var $pmt_obj EE_PMT_Base */
739 739
 				//get the form and simplify it, like what we do when we display it
740 740
 				$pmt_form = $pmt_obj->settings_form();
741 741
 				$this->_simplify_form($pmt_form);
742
-				if($pmt_form->form_data_present_in($this->_req_data)){
742
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
743 743
 					$correct_pmt_form_to_use = $pmt_form;
744 744
 					break;
745 745
 				}
746 746
 			}
747 747
 			//if we couldn't find the correct payment method type...
748
-			if( ! $correct_pmt_form_to_use ){
748
+			if ( ! $correct_pmt_form_to_use) {
749 749
 				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__);
750 750
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
751 751
 			}
752 752
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
753
-			if($correct_pmt_form_to_use->is_valid()){
753
+			if ($correct_pmt_form_to_use->is_valid()) {
754 754
 				$correct_pmt_form_to_use->save();
755 755
 				$pm = $correct_pmt_form_to_use->get_model_object();
756 756
 				/** @var $pm EE_Payment_Method */
757
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
758
-			}else{
757
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug()));
758
+			} else {
759 759
 				EE_Error::add_error(
760 760
 					sprintf(
761 761
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
762
-						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )
762
+						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso')
763 763
 					),
764 764
 					__FILE__,
765 765
 					__FUNCTION__,
@@ -776,11 +776,11 @@  discard block
 block discarded – undo
776 776
 	protected function _payment_settings() {
777 777
 
778 778
 		$this->_template_args['values'] = $this->_yes_no_values;
779
-		$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;
779
+		$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;
780 780
 
781
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
782
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
783
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
781
+		$this->_set_add_edit_form_tags('update_payment_settings');
782
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
783
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
784 784
 		$this->display_admin_page_with_sidebar();
785 785
 
786 786
 	}
@@ -794,13 +794,13 @@  discard block
 block discarded – undo
794 794
 	*		@return array
795 795
 	*/
796 796
 	protected function _update_payment_settings() {
797
-		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;
798
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
797
+		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;
798
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
799 799
 
800 800
 
801
-		$what = __('Payment Settings','event_espresso');
802
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
803
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
801
+		$what = __('Payment Settings', 'event_espresso');
802
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
803
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
804 804
 
805 805
 	}
806 806
 	protected function _payment_log_overview_list_table() {
@@ -826,18 +826,18 @@  discard block
 block discarded – undo
826 826
 	 * @param bool $count
827 827
 	 * @return array
828 828
 	 */
829
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
830
-		EE_Registry::instance()->load_model( 'Change_Log' );
829
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
830
+		EE_Registry::instance()->load_model('Change_Log');
831 831
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
832
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
832
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
833 833
 		//check if they've selected a specific payment method
834
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
834
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
835 835
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
836 836
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
837 837
 		}
838 838
 		//take into account search
839
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
840
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
839
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
840
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
841 841
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
842 842
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
843 843
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -852,44 +852,44 @@  discard block
 block discarded – undo
852 852
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
853 853
 
854 854
 		}
855
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
855
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
856 856
 			//add date
857
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
858
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
857
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
858
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
859 859
 			//make sure our timestamps start and end right at the boundaries for each day
860
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
861
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
860
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
861
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
862 862
 
863 863
 			//convert to timestamps
864
-			$start_date = strtotime( $start_date );
865
-			$end_date = strtotime( $end_date );
864
+			$start_date = strtotime($start_date);
865
+			$end_date = strtotime($end_date);
866 866
 
867 867
 			//makes sure start date is the lowest value and vice versa
868
-			$start_date = min( $start_date, $end_date );
869
-			$end_date = max( $start_date, $end_date );
868
+			$start_date = min($start_date, $end_date);
869
+			$end_date = max($start_date, $end_date);
870 870
 
871
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
871
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
872 872
 
873 873
 		}
874
-		if($count){
874
+		if ($count) {
875 875
 			return EEM_Change_Log::instance()->count($query_params);
876 876
 		}
877
-		if(isset($this->_req_data['order'])){
878
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
877
+		if (isset($this->_req_data['order'])) {
878
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
879 879
 			$query_params['order_by'] = array('LOG_time' => $sort);
880
-		}else{
880
+		} else {
881 881
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
882 882
 		}
883
-		$offset = ($current_page-1)*$per_page;
883
+		$offset = ($current_page - 1) * $per_page;
884 884
 
885
-		if( ! isset($this->_req_data['download_results'])){
886
-			$query_params['limit'] = array( $offset, $per_page );
885
+		if ( ! isset($this->_req_data['download_results'])) {
886
+			$query_params['limit'] = array($offset, $per_page);
887 887
 		}
888 888
 
889 889
 
890 890
 
891 891
 		//now they've requested to instead just download the file instead of viewing it.
892
-		if(isset($this->_req_data['download_results'])){
892
+		if (isset($this->_req_data['download_results'])) {
893 893
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
894 894
 			header('Content-Disposition: attachment');
895 895
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -911,36 +911,36 @@  discard block
 block discarded – undo
911 911
 	 * @param EE_Change_Log $logB
912 912
 	 * @return int
913 913
 	 */
914
-	protected function _sort_logs_again($logA,$logB){
914
+	protected function _sort_logs_again($logA, $logB) {
915 915
 		$timeA = $logA->get_raw('LOG_time');
916 916
 		$timeB = $logB->get_raw('LOG_time');
917
-		if($timeA == $timeB){
917
+		if ($timeA == $timeB) {
918 918
 			return 0;
919 919
 		}
920 920
 		$comparison = $timeA < $timeB ? -1 : 1;
921
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
921
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
922 922
 			return $comparison * -1;
923
-		}else{
923
+		} else {
924 924
 			return $comparison;
925 925
 		}
926 926
 	}
927 927
 
928 928
 	protected function _payment_log_details() {
929
-		EE_Registry::instance()->load_model( 'Change_Log' );
929
+		EE_Registry::instance()->load_model('Change_Log');
930 930
 		/** @var $payment_log EE_Change_Log */
931 931
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
932 932
 		$payment_method = NULL;
933 933
 		$transaction = NULL;
934
-		if( $payment_log instanceof EE_Change_Log ){
935
-			if( $payment_log->object() instanceof EE_Payment ){
934
+		if ($payment_log instanceof EE_Change_Log) {
935
+			if ($payment_log->object() instanceof EE_Payment) {
936 936
 				$payment_method = $payment_log->object()->payment_method();
937 937
 				$transaction = $payment_log->object()->transaction();
938
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
938
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
939 939
 				$payment_method = $payment_log->object();
940 940
 			}
941 941
 		}
942 942
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
943
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
943
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
944 944
 			array(
945 945
 				'payment_log'=>$payment_log,
946 946
 				'payment_method'=>$payment_method,
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	/**
195 195
 	 * 	_get_table_filters
196 196
 	 * @access protected
197
-	 * @return array
197
+	 * @return string[]
198 198
 	 */
199 199
 	protected function _get_table_filters() {
200 200
 		$filters = array();
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @access public
501 501
 	 * @param  EE_Registration $item registration object
502
-	 * @return string
502
+	 * @return boolean
503 503
 	 */
504 504
 	function column__REG_code( EE_Registration $item) {
505 505
 		return $item->get('REG_code');
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 	 * @param \EE_Registration $item
329 329
 	 * @return string
330 330
 	 */
331
-    function column__Reg_Status( EE_Registration $item ) {
332
-    	return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
333
-    }
331
+	function column__Reg_Status( EE_Registration $item ) {
332
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
333
+	}
334 334
 
335 335
 
336 336
 
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 	 * @param \EE_Registration $item
342 342
 	 * @return string
343 343
 	 */
344
-    function column_cb($item){
344
+	function column_cb($item){
345 345
 	/** checkbox/lock **/
346 346
 	$transaction = $item->get_first_related( 'Transaction' );
347 347
 	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
348 348
 	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
349
-    }
349
+	}
350 350
 
351 351
 
352 352
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	function column__REG_date(EE_Registration $item){
374 374
 		$this->_set_related_details($item);
375
-       		 //Build row actions
375
+	   		 //Build row actions
376 376
 		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
377 377
 		return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
378 378
 	}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		} else {
423 423
 			return __( 'There is no ticket on this registration', 'event_espresso' );
424 424
 		}
425
-    }
425
+	}
426 426
 
427 427
 
428 428
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
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
  * EEH_URL helper
4 6
  * Helper class for URL-related PHP functions
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
 				isset($results['response']['code']) &&
63 65
 				$results['response']['code'] == '200'){
64 66
 			return true;
65
-		}else{
67
+		} else{
66 68
 			return false;
67 69
 		}
68 70
 	}
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Admin_Page $admin_page
58 58
 	 * @return EE_Registrations_List_Table
59 59
 	 */
60
-	function __construct( $admin_page ){
60
+	function __construct($admin_page) {
61 61
 
62
-		if ( ! empty( $_GET['event_id'] ) ) {
62
+		if ( ! empty($_GET['event_id'])) {
63 63
 			$extra_query_args = array();
64
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
65
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
64
+			foreach ($admin_page->get_views() as $key => $view_details) {
65
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
66 66
 			}
67
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
67
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
68 68
 		}
69 69
 
70 70
 		parent::__construct($admin_page);
71 71
 		$this->_status = $this->_admin_page->get_registration_status_array();
72 72
 
73
-		EE_Registry::instance()->load_helper( 'Template' );
73
+		EE_Registry::instance()->load_helper('Template');
74 74
 	}
75 75
 
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @return void
82 82
 	 */
83 83
 	protected function _setup_data() {
84
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
85
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
84
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
85
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
86 86
 	}
87 87
 
88 88
 
@@ -101,44 +101,44 @@  discard block
 block discarded – undo
101 101
 			);
102 102
 
103 103
 
104
-		if ( isset( $_GET['event_id'] )) {
104
+		if (isset($_GET['event_id'])) {
105 105
 			$this->_columns = array(
106 106
 				'_Reg_Status' => '',
107 107
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
108
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
108
+				'_REG_ID' => __('ID', 'event_espresso'),
109 109
 				'_REG_count' => '#',
110
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
110
+				'ATT_fname' => __('Name', 'event_espresso'),
111 111
 				'ATT_email' =>  __('Email', 'event_espresso'),
112
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
113
-				'_REG_code' => __( 'Reg Code', 'event_espresso' ),
112
+				'_REG_date' => __('Reg Date', 'event_espresso'),
113
+				'_REG_code' => __('Reg Code', 'event_espresso'),
114 114
 				//'Reg_status' => __( 'Status', 'event_espresso' ),
115
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
116
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
117
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
115
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
116
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
117
+				'TXN_total' => __('Total Txn', 'event_espresso'),
118 118
 				'TXN_paid' => __('Paid', 'event_espresso'),
119
-				'actions' => __( 'Actions', 'event_espresso' )
119
+				'actions' => __('Actions', 'event_espresso')
120 120
 				);
121 121
 			$this->_bottom_buttons = array(
122 122
 					'report'=> array(
123 123
 					'route' => 'registrations_report',
124
-					'extra_request' => isset( $this->_req_data['event_id'] ) ? array('EVT_ID'=>$this->_req_data['event_id']) : NULL
124
+					'extra_request' => isset($this->_req_data['event_id']) ? array('EVT_ID'=>$this->_req_data['event_id']) : NULL
125 125
 				),
126 126
 			);
127 127
 		} else {
128 128
 			$this->_columns = array(
129 129
 				'_Reg_Status' => '',
130 130
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
131
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
131
+				'_REG_ID' => __('ID', 'event_espresso'),
132 132
 				'_REG_count' => '#',
133
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
134
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
135
-				'event_name' => __( 'Event', 'event_espresso' ),
136
-					'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
137
-				'_REG_code' => __( 'Reg Code', 'event_espresso' ),
133
+				'ATT_fname' => __('Name', 'event_espresso'),
134
+				'_REG_date' => __('TXN Date', 'event_espresso'),
135
+				'event_name' => __('Event', 'event_espresso'),
136
+					'DTT_EVT_start' => __('Event Date', 'event_espresso'),
137
+				'_REG_code' => __('Reg Code', 'event_espresso'),
138 138
 				//'Reg_status' => __( 'Status', 'event_espresso' ),
139
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
140
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
141
-				'actions' => __( 'Actions', 'event_espresso' )
139
+				'_REG_final_price' => __('Price', 'event_espresso'),
140
+				'_REG_paid' => __('Paid', 'event_espresso'),
141
+				'actions' => __('Actions', 'event_espresso')
142 142
 			);
143 143
 			$this->_bottom_buttons = array(
144 144
 				'report_all'=> array(
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 
150 150
 
151 151
 		$this->_sortable_columns = array(
152
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
153
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
154
-			'event_name' => array( 'event_name' => FALSE ),
155
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
152
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
153
+			'ATT_fname' => array('ATT_fname' => FALSE),
154
+			'event_name' => array('event_name' => FALSE),
155
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
156 156
 			//'Reg_status' => array( 'Reg_status' => FALSE ),
157
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
157
+			'_REG_ID' => array('_REG_ID' => FALSE),
158 158
 		);
159 159
 
160 160
 		$this->_hidden_columns = array();
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @param EE_Registration $registration
170 170
 	 */
171
-	protected function _set_related_details( EE_Registration $registration ) {
171
+	protected function _set_related_details(EE_Registration $registration) {
172 172
 
173
-		$transaction = $registration->get_first_related( 'Transaction' );
173
+		$transaction = $registration->get_first_related('Transaction');
174 174
 		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code;
175 175
 		$this->_transaction_details = array(
176 176
 			'transaction' => $transaction,
177 177
 			'status' => $status,
178 178
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
179
-			'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
179
+			'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
180 180
 			);
181 181
 
182 182
 		$event = $registration->event();
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			'event' => $event,
186 186
 			'status' => $status,
187 187
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
188
-			'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
188
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
189 189
 			);
190 190
 	}
191 191
 
@@ -200,26 +200,26 @@  discard block
 block discarded – undo
200 200
 		$filters = array();
201 201
 
202 202
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
203
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
203
+		EE_Registry::instance()->load_helper('Form_Fields');
204 204
 
205
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
206
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
207
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
205
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
206
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
207
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
208 208
 
209
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
210
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
209
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
210
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
211 211
 
212 212
 		$status = array();
213
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
214
-		foreach ( $this->_status as $key => $value ) {
215
-			$status[] = array( 'id' => $key, 'text' => $value );
213
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
214
+		foreach ($this->_status as $key => $value) {
215
+			$status[] = array('id' => $key, 'text' => $value);
216 216
 		}
217
-		if ( $this->_view != 'incomplete' ) {
218
-			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' );
217
+		if ($this->_view != 'incomplete') {
218
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : '');
219 219
 		}
220 220
 
221
-		if ( isset( $this->_req_data['event_id'] ) ) {
222
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
221
+		if (isset($this->_req_data['event_id'])) {
222
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
223 223
 		}
224 224
 
225 225
 		return $filters;
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 		$this->_views['all']['count'] = $this->_total_registrations();
237 237
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
238 238
 		$this->_views['today']['count'] = $this->_total_registrations_today();
239
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
240
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
241
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
239
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
240
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
241
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
242 242
 		}
243 243
 	}
244 244
 
@@ -250,23 +250,23 @@  discard block
 block discarded – undo
250 250
 	 * @param string $view
251 251
 	 * @return int
252 252
 	 */
253
-	protected function _total_registrations( $view = '' ){
253
+	protected function _total_registrations($view = '') {
254 254
 		$_where = array();
255
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
256
-		if( $EVT_ID ) {
255
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
256
+		if ($EVT_ID) {
257 257
 			$_where['EVT_ID'] = $EVT_ID;
258 258
 		}
259
-		switch ( $view ) {
259
+		switch ($view) {
260 260
 			case 'trash' :
261
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
261
+				return EEM_Registration::instance()->count_deleted(array($_where));
262 262
 				break;
263 263
 			case 'incomplete' :
264 264
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
265 265
 				break;
266 266
 			default :
267
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
267
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
268 268
 		}
269
-		return EEM_Registration::instance()->count( array( $_where ));
269
+		return EEM_Registration::instance()->count(array($_where));
270 270
 	}
271 271
 
272 272
 
@@ -276,21 +276,21 @@  discard block
 block discarded – undo
276 276
 	 * @access protected
277 277
 	 * @return int
278 278
 	 */
279
-	protected function _total_registrations_this_month(){
280
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
281
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
279
+	protected function _total_registrations_this_month() {
280
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
281
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
282 282
 		$this_year_r = date('Y', current_time('timestamp'));
283 283
 		$time_start = ' 00:00:00';
284 284
 		$time_end = ' 23:59:59';
285 285
 		$this_month_r = date('m', current_time('timestamp'));
286
-		$days_this_month = date( 't', current_time('timestamp') );
287
-		$_where['REG_date']= array('BETWEEN',
286
+		$days_this_month = date('t', current_time('timestamp'));
287
+		$_where['REG_date'] = array('BETWEEN',
288 288
 			array(
289
-				strtotime( $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start ),
290
-				strtotime( $this_year_r . '-' . $this_month_r . $days_this_month . ' ' . $time_end )
289
+				strtotime($this_year_r.'-'.$this_month_r.'-01'.' '.$time_start),
290
+				strtotime($this_year_r.'-'.$this_month_r.$days_this_month.' '.$time_end)
291 291
 		));
292
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
293
-		return EEM_Registration::instance()->count(array( $_where ) );
292
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
293
+		return EEM_Registration::instance()->count(array($_where));
294 294
 	}
295 295
 
296 296
 
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
 	 * @access protected
301 301
 	 * @return int
302 302
 	 */
303
-	protected function _total_registrations_today(){
303
+	protected function _total_registrations_today() {
304 304
 
305
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
306
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
305
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
306
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
307 307
 		$current_date = date('Y-m-d', current_time('timestamp'));
308 308
 		$time_start = ' 00:00:00';
309 309
 		$time_end = ' 23:59:59';
310
-		$_where['REG_date']= array('BETWEEN',
310
+		$_where['REG_date'] = array('BETWEEN',
311 311
 			array(
312
-				strtotime($current_date . $time_start),
313
-				strtotime($current_date . $time_end)
312
+				strtotime($current_date.$time_start),
313
+				strtotime($current_date.$time_end)
314 314
 		));
315
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
316
-		return EEM_Registration::instance()->count(array( $_where ) );
315
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
316
+		return EEM_Registration::instance()->count(array($_where));
317 317
 	}
318 318
 
319 319
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 	 * @param \EE_Registration $item
326 326
 	 * @return string
327 327
 	 */
328
-    function column__Reg_Status( EE_Registration $item ) {
329
-    	return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
328
+    function column__Reg_Status(EE_Registration $item) {
329
+    	return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
330 330
     }
331 331
 
332 332
 
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 	 * @param \EE_Registration $item
339 339
 	 * @return string
340 340
 	 */
341
-    function column_cb($item){
341
+    function column_cb($item) {
342 342
 	/** checkbox/lock **/
343
-	$transaction = $item->get_first_related( 'Transaction' );
344
-	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
345
-	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
343
+	$transaction = $item->get_first_related('Transaction');
344
+	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
345
+	return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
346 346
     }
347 347
 
348 348
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 * @param \EE_Registration $item
355 355
 	 * @return string
356 356
 	 */
357
-	function column__REG_ID(EE_Registration $item){
357
+	function column__REG_ID(EE_Registration $item) {
358 358
 		return $item->ID();
359 359
 	}
360 360
 
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
 	 * @param \EE_Registration $item
368 368
 	 * @return string
369 369
 	 */
370
-	function column__REG_date(EE_Registration $item){
370
+	function column__REG_date(EE_Registration $item) {
371 371
 		$this->_set_related_details($item);
372 372
        		 //Build row actions
373
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
374
-		return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
373
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
374
+		return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
375 375
 	}
376 376
 
377 377
 
@@ -383,18 +383,18 @@  discard block
 block discarded – undo
383 383
 	 * @param \EE_Registration $item
384 384
 	 * @return string
385 385
 	 */
386
-	function column_event_name(EE_Registration $item){
387
-		$this->_set_related_details( $item );
386
+	function column_event_name(EE_Registration $item) {
387
+		$this->_set_related_details($item);
388 388
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
389
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL );
389
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL);
390 390
 		$event_name = $item->event_name();
391 391
 		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
392
-		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ;
392
+		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...');
393 393
 
394
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
395
-		$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' .  __( 'View Registrations', 'event_espresso' ) . '</a>';
394
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL);
395
+		$actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>';
396 396
 
397
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
397
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
398 398
 	}
399 399
 
400 400
 
@@ -406,18 +406,18 @@  discard block
 block discarded – undo
406 406
 	 * @param \EE_Registration $item
407 407
 	 * @return string
408 408
 	 */
409
-   	function column_DTT_EVT_start(EE_Registration $item){
409
+   	function column_DTT_EVT_start(EE_Registration $item) {
410 410
 		$datetime_strings = array();
411
-		$ticket = $item->ticket( TRUE );
412
-		if ( $ticket instanceof EE_Ticket ) {
411
+		$ticket = $item->ticket(TRUE);
412
+		if ($ticket instanceof EE_Ticket) {
413 413
 			$remove_defaults = array('default_where_conditions' => 'none');
414 414
 			$datetimes = $ticket->datetimes($remove_defaults);
415
-			foreach($datetimes as $datetime){
416
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
415
+			foreach ($datetimes as $datetime) {
416
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
417 417
 			}
418
-			return implode("<br />",$datetime_strings);
418
+			return implode("<br />", $datetime_strings);
419 419
 		} else {
420
-			return __( 'There is no ticket on this registration', 'event_espresso' );
420
+			return __('There is no ticket on this registration', 'event_espresso');
421 421
 		}
422 422
     }
423 423
 
@@ -430,12 +430,12 @@  discard block
 block discarded – undo
430 430
 	 * @param \EE_Registration $item
431 431
 	 * @return string
432 432
 	 */
433
-   	function column_ATT_fname(EE_Registration $item){
433
+   	function column_ATT_fname(EE_Registration $item) {
434 434
    		$attendee = $item->attendee();
435 435
 
436
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
436
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
437 437
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
438
-		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name;
438
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name;
439 439
 		$link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
440 440
 
441 441
 		$t = $item->get_first_related('Transaction');
@@ -443,23 +443,23 @@  discard block
 block discarded – undo
443 443
 
444 444
 		//trash/restore/delete actions
445 445
 		$actions = array();
446
-		if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
447
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
448
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
449
-		} elseif ( $this->_view == 'trash' ) {
446
+		if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
447
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
448
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
449
+		} elseif ($this->_view == 'trash') {
450 450
 			// restore registration link
451
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
452
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
453
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
451
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
452
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
453
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
454 454
 			}
455
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
456
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
455
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
456
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
457 457
 
458
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
458
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
459 459
 			}
460 460
 		}
461 461
 
462
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
462
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
463 463
 	}
464 464
 
465 465
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @param \EE_Registration $item
472 472
 	 * @return string
473 473
 	 */
474
-	function column_ATT_email( EE_Registration $item ) {
474
+	function column_ATT_email(EE_Registration $item) {
475 475
 		$attendee = $item->get_first_related('Attendee');
476 476
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
477 477
 	}
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 	 * @param \EE_Registration $item
486 486
 	 * @return string
487 487
 	 */
488
-	function column__REG_count(EE_Registration $item){
489
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
488
+	function column__REG_count(EE_Registration $item) {
489
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
490 490
 	}
491 491
 
492 492
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	 * @param  EE_Registration $item registration object
499 499
 	 * @return string
500 500
 	 */
501
-	function column__REG_code( EE_Registration $item) {
501
+	function column__REG_code(EE_Registration $item) {
502 502
 		return $item->get('REG_code');
503 503
 	}
504 504
 
@@ -511,16 +511,16 @@  discard block
 block discarded – undo
511 511
 	 * @param \EE_Registration $item
512 512
 	 * @return string
513 513
 	 */
514
-	function column_PRC_amount(EE_Registration $item){
514
+	function column_PRC_amount(EE_Registration $item) {
515 515
 		$ticket = $item->ticket();
516 516
 
517
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
517
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
518 518
 
519
-		if ( $item->final_price() > 0 ) {
520
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
519
+		if ($item->final_price() > 0) {
520
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
521 521
 		} else {
522 522
 			// free event
523
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
523
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
524 524
 		}
525 525
 
526 526
 		return $content;
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
 	 * @param \EE_Registration $item
537 537
 	 * @return string
538 538
 	 */
539
-	function column__REG_final_price(EE_Registration $item){
539
+	function column__REG_final_price(EE_Registration $item) {
540 540
 		$ticket = $item->ticket();
541
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
541
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
542 542
 
543
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
543
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
544 544
 		return $content;
545 545
 
546 546
 	}
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 	 * @param \EE_Registration $item
555 555
 	 * @return string
556 556
 	 */
557
-	function column__REG_paid(EE_Registration $item){
558
-		return '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
557
+	function column__REG_paid(EE_Registration $item) {
558
+		return '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
559 559
 	}
560 560
 
561 561
 
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 	 * @param \EE_Registration $item
568 568
 	 * @return string
569 569
 	 */
570
-	function column_TXN_total(EE_Registration $item){
571
-		if($item->transaction()){
572
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
573
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
574
-		}else{
570
+	function column_TXN_total(EE_Registration $item) {
571
+		if ($item->transaction()) {
572
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
573
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
574
+		} else {
575 575
 			return __("None", "event_espresso");
576 576
 		}
577 577
 	}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 * @param \EE_Registration $item
586 586
 	 * @return string
587 587
 	 */
588
-	function column_TXN_paid(EE_Registration $item){
588
+	function column_TXN_paid(EE_Registration $item) {
589 589
 
590
-		if ( $item->count() == 1 ) {
590
+		if ($item->count() == 1) {
591 591
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
592
-			if ( $transaction->paid() >= $transaction->total() ) {
592
+			if ($transaction->paid() >= $transaction->total()) {
593 593
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
594 594
 			} else {
595
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
596
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
595
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
596
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
597 597
 			}
598 598
 		}
599 599
 
@@ -614,49 +614,49 @@  discard block
 block discarded – undo
614 614
 
615 615
 		$attendee = $item->attendee();
616 616
 		$ticket = $item->ticket();
617
-		$this->_set_related_details( $item );
617
+		$this->_set_related_details($item);
618 618
 
619 619
 		//Build row actions
620
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
621
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
620
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
621
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
622 622
 
623 623
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
624 624
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
625
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
625
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
626 626
 
627 627
 
628 628
 		//Build row actions
629
-		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
629
+		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
630 630
 			<li>
631
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
631
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
632 632
 				<div class="dashicons dashicons-clipboard"></div>
633 633
 			</a>
634 634
 			</li>' : '';
635 635
 
636
-		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
636
+		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
637 637
 			<li>
638
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
638
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
639 639
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
640 640
 			</a>
641 641
 			</li>' : '';
642 642
 
643
-		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
643
+		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
644 644
 			<li>
645
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
645
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
646 646
 				<div class="dashicons dashicons-email-alt"></div>
647 647
 			</a>
648 648
 			</li>' : '';
649 649
 
650 650
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
651
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
652
-		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
651
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
652
+		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
653 653
 			<li>
654
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text">
654
+			<a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'" class="tiny-text">
655 655
 				<div class="dashicons dashicons-cart"></div>
656 656
 			</a>
657 657
 			</li>' : '';
658 658
 
659
-			return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk, $item, 'ul', 'reg-overview-actions-ul' );
659
+			return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk, $item, 'ul', 'reg-overview-actions-ul');
660 660
 	}
661 661
 
662 662
 }
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1565,8 +1565,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 
125 125
 	/**
126 126
 	 * 		grab url requests and route them
127
-	*		@access private
128
-	*		@return void
129
-	*/
127
+	 *		@access private
128
+	 *		@return void
129
+	 */
130 130
 	public function _set_page_routes() {
131 131
 
132 132
 		$this->_get_registration_status_array();
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'title' => __('Registrations Other', 'event_espresso'),
399 399
 						'filename' => 'registrations_overview_other'
400 400
 					)
401
-                ),
401
+				),
402 402
 				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
403 403
 				'qtips' => array('Registration_List_Table_Tips'),
404 404
 				'list_table' => 'EE_Registrations_List_Table',
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 					'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,
413 413
 					'persistent' => FALSE
414 414
 					),
415
-                'help_tabs' => array(
415
+				'help_tabs' => array(
416 416
 					'registrations_details_help_tab' => array(
417 417
 						'title' => __('Registration Details', 'event_espresso'),
418 418
 						'filename' => 'registrations_details'
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 					'order' => 20
477 477
 					),
478 478
 				'list_table' => 'EE_Attendee_Contact_List_Table',
479
-                'help_tabs' => array(
479
+				'help_tabs' => array(
480 480
 					'registrations_contact_list_help_tab' => array(
481 481
 						'title' => __('Registrations Contact List', 'event_espresso'),
482 482
 						'filename' => 'registrations_contact_list'
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 						'title' => __('Contact List Other', 'event_espresso'),
494 494
 						'filename' => 'registrations_contact_list_other'
495 495
 					)
496
-                ),
496
+				),
497 497
 				'help_tour' => array( 'Contact_List_Help_Tour' ),
498 498
 				'metaboxes' => array(),
499 499
 				'require_nonce' => FALSE
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 
528 528
 	/**
529 529
 	 * 		get list of registration statuses
530
-	*		@access private
531
-	*		@return void
532
-	*/
530
+	 *		@access private
531
+	 *		@return void
532
+	 */
533 533
 	private function _get_registration_status_array() {
534 534
 		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
535 535
 	}
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 			return TRUE;
831 831
 		}
832 832
 
833
-	    $REG = EEM_Registration::instance();
833
+		$REG = EEM_Registration::instance();
834 834
 
835 835
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
836 836
 
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 	/**
1053 1053
 	 * 		generates HTML for the View Registration Details Admin page
1054
-	*		@access protected
1055
-	*		@return void
1056
-	*/
1054
+	 *		@access protected
1055
+	 *		@return void
1056
+	 */
1057 1057
 	protected function _registration_details() {
1058 1058
 
1059 1059
 		$this->_template_args = array();
@@ -1130,9 +1130,9 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 	/**
1132 1132
 	 * 		_set_approve_or_decline_reg_status_buttons
1133
-	*		@access protected
1134
-	*		@return string
1135
-	*/
1133
+	 *		@access protected
1134
+	 *		@return string
1135
+	 */
1136 1136
 	public function set_reg_status_buttons_metabox() {
1137 1137
 
1138 1138
 		//is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown.
@@ -1321,10 +1321,10 @@  discard block
 block discarded – undo
1321 1321
 
1322 1322
 	/**
1323 1323
 	 * 		approve_registration
1324
-	*		@access protected
1325
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1326
-	*		@return void
1327
-	*/
1324
+	 *		@access protected
1325
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1326
+	 *		@return void
1327
+	 */
1328 1328
 	protected function approve_registration( $notify = false ) {
1329 1329
 		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1330 1330
 	}
@@ -1334,10 +1334,10 @@  discard block
 block discarded – undo
1334 1334
 
1335 1335
 	/**
1336 1336
 	 * 		decline_registration
1337
-	*		@access protected
1338
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1339
-	*		@return void
1340
-	*/
1337
+	 *		@access protected
1338
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1339
+	 *		@return void
1340
+	 */
1341 1341
 	protected function decline_registration( $notify = false ) {
1342 1342
 		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1343 1343
 	}
@@ -1347,10 +1347,10 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
 	/**
1349 1349
 	 * 		cancel_registration
1350
-	*		@access protected
1351
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1352
-	*		@return void
1353
-	*/
1350
+	 *		@access protected
1351
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1352
+	 *		@return void
1353
+	 */
1354 1354
 	protected function cancel_registration( $notify = false ) {
1355 1355
 		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1356 1356
 	}
@@ -1361,10 +1361,10 @@  discard block
 block discarded – undo
1361 1361
 
1362 1362
 	/**
1363 1363
 	 * 		not_approve_registration
1364
-	*		@access protected
1365
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1366
-	*		@return void
1367
-	*/
1364
+	 *		@access protected
1365
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1366
+	 *		@return void
1367
+	 */
1368 1368
 	protected function not_approve_registration( $notify = false ) {
1369 1369
 		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1370 1370
 	}
@@ -1373,10 +1373,10 @@  discard block
 block discarded – undo
1373 1373
 
1374 1374
 	/**
1375 1375
 	 * 		decline_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 pending_registration( $notify = false ) {
1381 1381
 		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1382 1382
 	}
@@ -1386,9 +1386,9 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
 	/**
1388 1388
 	 * 		generates HTML for the Registration main meta box
1389
-	*		@access public
1390
-	*		@return void
1391
-	*/
1389
+	 *		@access public
1390
+	 *		@return void
1391
+	 */
1392 1392
 	public function _reg_details_meta_box() {
1393 1393
 		EEH_Autoloader::register_line_item_display_autoloaders();
1394 1394
 		EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -1471,9 +1471,9 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
 	/**
1473 1473
 	 * 		generates HTML for the Registration Questions meta box
1474
-	*		@access public
1475
-	*		@return void
1476
-	*/
1474
+	 *		@access public
1475
+	 *		@return void
1476
+	 */
1477 1477
 	public function _reg_questions_meta_box() {
1478 1478
 
1479 1479
 		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
@@ -1581,9 +1581,9 @@  discard block
 block discarded – undo
1581 1581
 
1582 1582
 	/**
1583 1583
 	 * 		generates HTML for the Registration main meta box
1584
-	*		@access protected
1585
-	*		@return void
1586
-	*/
1584
+	 *		@access protected
1585
+	 *		@return void
1586
+	 */
1587 1587
 	protected function _update_attendee_registration_form() {
1588 1588
 		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1589 1589
 		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
@@ -1665,12 +1665,12 @@  discard block
 block discarded – undo
1665 1665
 
1666 1666
 	/**
1667 1667
 	 * 		generates HTML for the Registration main meta box
1668
-	*		@access public
1669
-	*		@return void
1670
-	*/
1668
+	 *		@access public
1669
+	 *		@return void
1670
+	 */
1671 1671
 	public function _reg_attendees_meta_box() {
1672 1672
 
1673
-	    $REG = EEM_Registration::instance();
1673
+		$REG = EEM_Registration::instance();
1674 1674
 		//get all other registrations on this transaction, and cache
1675 1675
 		//the attendees for them so we don't have to run another query using force_join
1676 1676
 		$registrations = $REG->get_all(array(
@@ -1723,9 +1723,9 @@  discard block
 block discarded – undo
1723 1723
 
1724 1724
 	/**
1725 1725
 	 * 		generates HTML for the Edit Registration side meta box
1726
-	*		@access public
1727
-	*		@return void
1728
-	*/
1726
+	 *		@access public
1727
+	 *		@return void
1728
+	 */
1729 1729
 	public function _reg_registrant_side_meta_box() {
1730 1730
 
1731 1731
 		/*@var $attendee EE_Attendee */
@@ -2071,9 +2071,9 @@  discard block
 block discarded – undo
2071 2071
 
2072 2072
 	/**
2073 2073
 	 * 		set_reg_event
2074
-	*		@access private
2075
-	*		@return boolean
2076
-	*/
2074
+	 *		@access private
2075
+	 *		@return boolean
2076
+	 */
2077 2077
 	private function _set_reg_event() {
2078 2078
 		if ( is_object( $this->_reg_event )) {
2079 2079
 			return TRUE;
@@ -2177,9 +2177,9 @@  discard block
 block discarded – undo
2177 2177
 
2178 2178
 	/**
2179 2179
 	 * 		generates HTML for the Attendee Contact List
2180
-	*		@access protected
2181
-	*		@return void
2182
-	*/
2180
+	 *		@access protected
2181
+	 *		@return void
2182
+	 */
2183 2183
 	protected function _attendee_contact_list_table() {
2184 2184
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2185 2185
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
@@ -2193,9 +2193,9 @@  discard block
 block discarded – undo
2193 2193
 	/**
2194 2194
 	 * 		get_attendees
2195 2195
 	 * 		@param bool $count whether to return count or data.
2196
-	*		@access public
2197
-	*		@return array
2198
-	*/
2196
+	 *		@access public
2197
+	 *		@return array
2198
+	 */
2199 2199
 	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2200 2200
 
2201 2201
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2513,9 +2513,9 @@  discard block
 block discarded – undo
2513 2513
 
2514 2514
 	/**
2515 2515
 	 * 		_attendee_details
2516
-	*		@access protected
2517
-	*		@return void
2518
-	*/
2516
+	 *		@access protected
2517
+	 *		@return void
2518
+	 */
2519 2519
 	public function attendee_registrations_meta_box( $post ) {
2520 2520
 
2521 2521
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
@@ -2548,10 +2548,10 @@  discard block
 block discarded – undo
2548 2548
 
2549 2549
 	/**
2550 2550
 	 * 		_trash_or_restore_attendee
2551
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2552
-	*		@access protected
2553
-	*		@return void
2554
-	*/
2551
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2552
+	 *		@access protected
2553
+	 *		@return void
2554
+	 */
2555 2555
 	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2556 2556
 
2557 2557
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Braces   +30 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +492 added lines, -492 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
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
 
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 			'espresso_attendees' => 'edit_attendee'
71 71
 			);
72 72
 
73
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
73
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
74 74
 		//add filters so that the comment urls don't take users to a confusing 404 page
75
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
75
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
76 76
 	}
77 77
 
78 78
 
79
-	public function clear_comment_link( $link, $comment, $args ) {
79
+	public function clear_comment_link($link, $comment, $args) {
80 80
 		//gotta make sure this only happens on this route
81
-		$post_type = get_post_type( $comment->comment_post_ID);
82
-		if ( $post_type == 'espresso_attendees' )
81
+		$post_type = get_post_type($comment->comment_post_ID);
82
+		if ($post_type == 'espresso_attendees')
83 83
 			return '#commentsdiv';
84 84
 		return $link;
85 85
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 	protected function _ajax_hooks() {
89 89
 		//todo: all hooks for registrations ajax goes in here
90
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
90
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
91 91
 	}
92 92
 
93 93
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 					'add-attendee' => __('Add Contact', 'event_espresso'),
103 103
 					'edit' => __('Edit Contact', 'event_espresso'),
104 104
 					'report'=>  __("Event Registrations CSV Report", "event_espresso"),
105
-					'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
106
-					'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
105
+					'report_all' => __('All Registrations CSV Report', 'event_espresso'),
106
+					'contact_list_report' => __('Contact List Report', 'event_espresso'),
107 107
 					'contact_list_export'=>  __("Export Data", "event_espresso"),
108 108
 				),
109 109
 			'publishbox' => array(
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 
131 131
 		$this->_get_registration_status_array();
132 132
 
133
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
134
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
135
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
133
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
134
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
135
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
136 136
 
137 137
 		$this->_page_routes = array(
138 138
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 				'edit_registration'	=> array(
151 151
 						'func' => '_registration_details',
152
-						'args' => array( 'edit' ),
152
+						'args' => array('edit'),
153 153
 						'noheader' => TRUE,
154 154
 						'capability' => 'ee_edit_registration',
155 155
 						'obj_id' => $reg_id
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 				'restore_registrations' => array(
166 166
 					'func' => '_trash_or_restore_registrations',
167
-					'args' => array( 'trash' => FALSE ),
167
+					'args' => array('trash' => FALSE),
168 168
 					'noheader' => TRUE,
169 169
 					'capability' => 'ee_delete_registrations'
170 170
 					),
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'filename' => 'registrations_overview_other'
399 399
 					)
400 400
                 ),
401
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
401
+				'help_tour' => array('Registration_Overview_Help_Tour'),
402 402
 				'qtips' => array('Registration_List_Table_Tips'),
403 403
 				'list_table' => 'EE_Registrations_List_Table',
404 404
 				'require_nonce' => FALSE
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 				'nav' => array(
409 409
 					'label' => __('REG Details', 'event_espresso'),
410 410
 					'order' => 15,
411
-					'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,
411
+					'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,
412 412
 					'persistent' => FALSE
413 413
 					),
414 414
                 'help_tabs' => array(
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 						'filename' => 'registrations_details_registrant_details'
430 430
 						)
431 431
 					),
432
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
433
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
432
+				'help_tour' => array('Registration_Details_Help_Tour'),
433
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
434 434
 				'require_nonce' => FALSE
435 435
 				),
436 436
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 					'order' => 15,
455 455
 					'persistent' => FALSE
456 456
 					),
457
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
457
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
458 458
 				'require_nonce' => FALSE
459 459
 				),
460 460
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 					'label' => __('Edit Contact', 'event_espresso'),
464 464
 					'order' => 15,
465 465
 					'persistent' => FALSE,
466
-					'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
466
+					'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
467 467
 					),
468 468
 				'metaboxes' => array('attendee_editor_metaboxes'),
469 469
 				'require_nonce' => FALSE
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 						'filename' => 'registrations_contact_list_other'
494 494
 					)
495 495
                 ),
496
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
496
+				'help_tour' => array('Contact_List_Help_Tour'),
497 497
 				'metaboxes' => array(),
498 498
 				'require_nonce' => FALSE
499 499
 				),
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	*		@return void
529 529
 	*/
530 530
 	private function _get_registration_status_array() {
531
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
531
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
532 532
 	}
533 533
 
534 534
 
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
 	public function load_scripts_styles() {
552 552
 		//style
553 553
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
554
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
554
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
555 555
 		wp_enqueue_style('espresso_reg');
556 556
 
557 557
 		//script
558
-		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);
558
+		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);
559 559
 		wp_enqueue_script('espresso_reg');
560 560
 	}
561 561
 
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 	public function load_scripts_styles_edit_attendee() {
565 565
 		//stuff to only show up on our attendee edit details page.
566 566
 		$attendee_details_translations = array(
567
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
567
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
568 568
 			);
569
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
569
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
570 570
 		wp_enqueue_script('jquery-validate');
571 571
 	}
572 572
 
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 		//styles
576 576
 		wp_enqueue_style('espresso-ui-theme');
577 577
 		//scripts
578
-		EE_Registry::$i18n_js_strings['update_att_qstns'] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
579
-		wp_localize_script( 'espresso_reg', 'eei18n', EE_Registry::$i18n_js_strings );
578
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
579
+		wp_localize_script('espresso_reg', 'eei18n', EE_Registry::$i18n_js_strings);
580 580
 	}
581 581
 
582 582
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 
587 587
 	public function load_scripts_styles_contact_list() {
588 588
 		wp_deregister_style('espresso_reg');
589
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
589
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
590 590
 		wp_enqueue_style('espresso_att');
591 591
 	}
592 592
 
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
 
596 596
 
597 597
 	public function load_scripts_styles_new_registration() {
598
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
598
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
599 599
 		wp_enqueue_script('ee-spco-for-admin');
600
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
600
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
601 601
 		EE_Form_Section_Proper::wp_enqueue_scripts();
602 602
 		EED_Ticket_Selector::load_tckt_slctr_assets();
603 603
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
 
637 637
 		/** setup reg status bulk actions **/
638 638
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
639
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
639
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
640 640
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
641 641
 		}
642 642
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
643
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
643
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
644 644
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
645 645
 		}
646 646
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
647
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
647
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
648 648
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
649 649
 		}
650 650
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
651
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
651
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
652 652
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
653 653
 		}
654 654
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
655
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
655
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
656 656
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
657 657
 		}
658 658
 
@@ -661,29 +661,29 @@  discard block
 block discarded – undo
661 661
 				'slug' => 'all',
662 662
 				'label' => __('View All Registrations', 'event_espresso'),
663 663
 				'count' => 0,
664
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
664
+				'bulk_action' => array_merge($def_reg_status_actions, array(
665 665
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
666
-					) )
666
+					))
667 667
 				),
668 668
 			'month' => array(
669 669
 				'slug' => 'month',
670 670
 				'label' => __('This Month', 'event_espresso'),
671 671
 				'count' => 0,
672
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
672
+				'bulk_action' => array_merge($def_reg_status_actions, array(
673 673
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
674 674
 					))
675 675
 				),
676 676
 			'today' => array(
677 677
 				'slug' => 'today',
678
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp', 0) ) ),
678
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp', 0))),
679 679
 				'count' => 0,
680
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
680
+				'bulk_action' => array_merge($def_reg_status_actions, array(
681 681
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
682 682
 					))
683 683
 				)
684 684
 			);
685 685
 
686
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
686
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
687 687
 			$this->_views['incomplete'] = array(
688 688
 				'slug' => 'incomplete',
689 689
 				'label' => __('Incomplete', 'event_espresso'),
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 				)
720 720
 			);
721 721
 
722
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
722
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
723 723
 			$this->_views['trash'] = array(
724 724
 				'slug' => 'trash',
725 725
 				'label' => __('Trash', 'event_espresso'),
@@ -754,42 +754,42 @@  discard block
 block discarded – undo
754 754
 				'desc' => __('View Transaction Details', 'event_espresso')
755 755
 				)
756 756
  			);
757
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
757
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
758 758
 			$fc_items['resend_registration'] = array(
759 759
 				'class' => 'dashicons dashicons-email-alt',
760 760
 				'desc' => __('Resend Registration Details', 'event_espresso')
761 761
 				);
762 762
 		} else {
763
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
763
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
764 764
 		}
765 765
 
766 766
 		$sc_items = array(
767 767
 			'approved_status' => array(
768
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
769
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
768
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
769
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
770 770
 				),
771 771
 			'pending_status' => array(
772
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
773
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
772
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
773
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
774 774
 				),
775 775
 			'incomplete_status' => array(
776
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
777
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
776
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
777
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
778 778
 			),
779 779
 			'not_approved' => array(
780
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
781
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
780
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
781
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
782 782
 				),
783 783
 			'declined_status' => array(
784
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
785
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
784
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
785
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
786 786
 				),
787 787
 			'cancelled_status' => array(
788
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
789
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
788
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
789
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
790 790
 				)
791 791
 			);
792
-		return array_merge( $fc_items, $sc_items );
792
+		return array_merge($fc_items, $sc_items);
793 793
 	}
794 794
 
795 795
 
@@ -802,15 +802,15 @@  discard block
 block discarded – undo
802 802
 
803 803
 
804 804
 	protected function _registrations_overview_list_table() {
805
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
806
-		if ( $EVT_ID ) {
807
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
808
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
805
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
806
+		if ($EVT_ID) {
807
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
808
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
809 809
 			}
810
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
811
-			$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>' ) : '';
810
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
811
+			$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>') : '';
812 812
 		}
813
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
813
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
814 814
 		$this->display_admin_list_table_page_with_no_sidebar();
815 815
 	}
816 816
 
@@ -825,19 +825,19 @@  discard block
 block discarded – undo
825 825
 	 */
826 826
 	private function _set_registration_object() {
827 827
 		//get out if we've already set the object
828
-		if ( is_object( $this->_registration )) {
828
+		if (is_object($this->_registration)) {
829 829
 			return TRUE;
830 830
 		}
831 831
 
832 832
 	    $REG = EEM_Registration::instance();
833 833
 
834
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
834
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
835 835
 
836
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
836
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
837 837
 			return TRUE;
838 838
 		else {
839
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
840
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
839
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
840
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
841 841
 			$this->_registration = NULL;
842 842
 			return FALSE;
843 843
 		}
@@ -856,24 +856,24 @@  discard block
 block discarded – undo
856 856
 	 * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set)
857 857
 	 * @return mixed (int|array)  int = count || array of registration objects
858 858
 	 */
859
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
860
-
861
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
862
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
863
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
864
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
865
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
866
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE  : FALSE;
859
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
860
+
861
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
862
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
863
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
864
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
865
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
866
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE;
867 867
 		$start_date = FALSE;
868 868
 		$end_date = FALSE;
869 869
 		$_where = array();
870
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
871
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
870
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
871
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
872 872
 
873 873
 		//set orderby
874 874
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
875 875
 
876
-		switch ( $this->_req_data['orderby'] ) {
876
+		switch ($this->_req_data['orderby']) {
877 877
 			case '_REG_ID':
878 878
 				$orderby = 'REG_ID';
879 879
 				break;
@@ -893,26 +893,26 @@  discard block
 block discarded – undo
893 893
 				$orderby = 'REG_date';
894 894
 		}
895 895
 
896
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
897
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
898
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
896
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
897
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
898
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
899 899
 
900 900
 
901
-		$offset = ($current_page-1)*$per_page;
902
-		$limit = $count  ? NULL : array( $offset, $per_page );
901
+		$offset = ($current_page - 1) * $per_page;
902
+		$limit = $count ? NULL : array($offset, $per_page);
903 903
 
904
-		if($EVT_ID){
905
-			$_where['EVT_ID']=$EVT_ID;
904
+		if ($EVT_ID) {
905
+			$_where['EVT_ID'] = $EVT_ID;
906 906
 		}
907
-		if($CAT_ID){
907
+		if ($CAT_ID) {
908 908
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
909 909
 		}
910
-		if ( $incomplete ) {
910
+		if ($incomplete) {
911 911
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
912 912
 		} else if ( ! $trash) {
913
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
913
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
914 914
 		}
915
-		if($reg_status){
915
+		if ($reg_status) {
916 916
 			$_where['STS_ID'] = $reg_status;
917 917
 		}
918 918
 
@@ -924,102 +924,102 @@  discard block
 block discarded – undo
924 924
 		$time_start = ' 00:00:00';
925 925
 		$time_end = ' 23:59:59';
926 926
 
927
-		if($today_a || $today ){
927
+		if ($today_a || $today) {
928 928
 			$curdate = date('Y-m-d', current_time('timestamp'));
929
-			$_where['REG_date']= array('BETWEEN',
929
+			$_where['REG_date'] = array('BETWEEN',
930 930
 				array(
931
-					strtotime($curdate . $time_start),
932
-					strtotime($curdate . $time_end)
931
+					strtotime($curdate.$time_start),
932
+					strtotime($curdate.$time_end)
933 933
 			));
934
-		}elseif($this_month_a || $this_month){
934
+		}elseif ($this_month_a || $this_month) {
935 935
 			$this_month_r = date('m', current_time('timestamp'));
936
-			$days_this_month = date( 't', current_time('timestamp') );
937
-			$_where['REG_date']= array('BETWEEN',
936
+			$days_this_month = date('t', current_time('timestamp'));
937
+			$_where['REG_date'] = array('BETWEEN',
938 938
 				array(
939
-					strtotime( $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start ),
940
-					strtotime( $this_year_r . '-' . $this_month_r . $days_this_month . ' ' . $time_end )
939
+					strtotime($this_year_r.'-'.$this_month_r.'-01'.' '.$time_start),
940
+					strtotime($this_year_r.'-'.$this_month_r.$days_this_month.' '.$time_end)
941 941
 			));
942
-		}elseif($month_range){
942
+		}elseif ($month_range) {
943 943
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
944
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
945
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
946
-			$_where['REG_date']= array('BETWEEN',
947
-				array( strtotime($year_r . '-' . $month_r . '-01 00:00:00'), strtotime($year_r . '-' . $month_r . '-31 23:59:59' ) ) );
948
-		}elseif($start_date && $end_date){
944
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
945
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
946
+			$_where['REG_date'] = array('BETWEEN',
947
+				array(strtotime($year_r.'-'.$month_r.'-01 00:00:00'), strtotime($year_r.'-'.$month_r.'-31 23:59:59')));
948
+		}elseif ($start_date && $end_date) {
949 949
 			throw new EE_Error("not yet supported");
950
-		}elseif($start_date){
950
+		}elseif ($start_date) {
951 951
 			throw new EE_Error("not yet supported");
952
-		}elseif($end_date){
952
+		}elseif ($end_date) {
953 953
 			throw new EE_Error("not yet supported");
954 954
 		}
955 955
 
956
-		if ( isset( $this->_req_data['s'] ) ) {
957
-			$sstr = '%' . $this->_req_data['s'] . '%';
956
+		if (isset($this->_req_data['s'])) {
957
+			$sstr = '%'.$this->_req_data['s'].'%';
958 958
 			$_where['OR'] = array(
959
-				'Event.EVT_name' => array( 'LIKE', $sstr),
960
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
961
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
962
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
963
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
964
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
965
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
966
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
967
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
968
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
969
-				'REG_final_price' => array( 'LIKE', $sstr ),
970
-				'REG_code' => array( 'LIKE', $sstr ),
971
-				'REG_count' => array( 'LIKE' , $sstr ),
972
-				'REG_group_size' => array( 'LIKE' , $sstr ),
973
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
974
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
959
+				'Event.EVT_name' => array('LIKE', $sstr),
960
+				'Event.EVT_desc' => array('LIKE', $sstr),
961
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
962
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
963
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
964
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
965
+				'Attendee.ATT_email' => array('LIKE', $sstr),
966
+				'Attendee.ATT_address' => array('LIKE', $sstr),
967
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
968
+				'Attendee.ATT_city' => array('LIKE', $sstr),
969
+				'REG_final_price' => array('LIKE', $sstr),
970
+				'REG_code' => array('LIKE', $sstr),
971
+				'REG_count' => array('LIKE', $sstr),
972
+				'REG_group_size' => array('LIKE', $sstr),
973
+				'Ticket.TKT_name' => array('LIKE', $sstr),
974
+				'Ticket.TKT_description' => array('LIKE', $sstr)
975 975
 				);
976 976
 		}
977 977
 
978 978
 		//capability checks
979
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
979
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
980 980
 			$_where['AND'] = array(
981 981
 				'Event.EVT_wp_user' => get_current_user_id()
982 982
 				);
983 983
 		}
984 984
 
985 985
 
986
-		if( $count ){
987
-			if ( $trash ) {
988
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
989
-			} else if ( $incomplete ) {
990
-				return EEM_Registration::instance()->count( array( $_where ));
986
+		if ($count) {
987
+			if ($trash) {
988
+				return EEM_Registration::instance()->count_deleted(array($_where));
989
+			} else if ($incomplete) {
990
+				return EEM_Registration::instance()->count(array($_where));
991 991
 			} else {
992
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
992
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
993 993
 			}
994 994
 		} else {
995 995
 			//make sure we remove default where conditions cause all registrations matching query are returned
996
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
997
-			if ( $per_page !== -1 ) {
996
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
997
+			if ($per_page !== -1) {
998 998
 				$query_params['limit'] = $limit;
999 999
 			}
1000
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1000
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1001 1001
 
1002 1002
 
1003
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1003
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1004 1004
 				$first_registration = $registrations[0];
1005 1005
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1006 1006
 				$event_name = $first_registration->event_obj()->name();
1007
-				$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 ) : '';
1007
+				$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 ) : '';
1008 1008
 				// edit event link
1009
-				if ( $event_name != '' ) {
1010
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1011
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1012
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1009
+				if ($event_name != '') {
1010
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1011
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1012
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1013 1013
 				}
1014 1014
 
1015
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1016
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1015
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1016
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1017 1017
 
1018 1018
 				$this->_template_args['before_admin_page_content'] = '
1019 1019
 			<div id="admin-page-header">
1020
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1021
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1022
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1020
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1021
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1022
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1023 1023
 			</div>
1024 1024
 			';
1025 1025
 
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 		$this->_set_registration_object();
1059 1059
 
1060
-		if ( is_object( $this->_registration )) {
1060
+		if (is_object($this->_registration)) {
1061 1061
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1062 1062
 			$this->_session = $transaction->session_data();
1063 1063
 
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
 
1067 1067
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1068
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1068
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1069 1069
 
1070
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->pretty_date('l F j, Y','g:i:s a') ;
1071
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1070
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a');
1071
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1072 1072
 
1073 1073
 			$this->_template_args['grand_total'] = $transaction->total();
1074 1074
 
@@ -1076,19 +1076,19 @@  discard block
 block discarded – undo
1076 1076
 			// link back to overview
1077 1077
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1078 1078
 			$this->_template_args['registration'] = $this->_registration;
1079
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1080
-			$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' ) );
1081
-			$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' ) );
1079
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1080
+			$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'));
1081
+			$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'));
1082 1082
 
1083 1083
 			//next and previous links
1084
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1085
-			$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' ) : '';
1086
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1087
-			$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' ) : '';
1084
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1085
+			$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') : '';
1086
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1087
+			$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') : '';
1088 1088
 
1089 1089
 			// grab header
1090
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1091
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1090
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1091
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1092 1092
 
1093 1093
 		} else {
1094 1094
 
@@ -1109,14 +1109,14 @@  discard block
 block discarded – undo
1109 1109
 	protected function _registration_details_metaboxes() {
1110 1110
 		$this->_set_registration_object();
1111 1111
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1112
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1113
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1114
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1115
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1112
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1113
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1114
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1115
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1116 1116
 		}
1117
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1118
-		if ( $this->_registration->group_size() > 1 ) {
1119
-			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' );
1117
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1118
+		if ($this->_registration->group_size() > 1) {
1119
+			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');
1120 1120
 		}
1121 1121
 	}
1122 1122
 
@@ -1137,23 +1137,23 @@  discard block
 block discarded – undo
1137 1137
 
1138 1138
 		//let's get an array of all possible buttons that we can just reference
1139 1139
 		$status_buttons = $this->_get_reg_status_buttons();
1140
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1141
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1140
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1141
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1142 1142
 		$template_args['attendee'] = $this->_registration->attendee();
1143
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1144
-		if ( $this->_set_registration_object() ) {
1143
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1144
+		if ($this->_set_registration_object()) {
1145 1145
 			$current_status = $this->_registration->status_ID();
1146
-			unset( $status_buttons[$current_status] );
1147
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1148
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1146
+			unset($status_buttons[$current_status]);
1147
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1148
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1149 1149
 			}
1150
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1150
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1151 1151
 		}
1152 1152
 		$template_args['form_url'] = REG_ADMIN_URL;
1153 1153
 		$template_args['REG_ID'] = $this->_registration->ID();
1154
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1154
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1155 1155
 
1156
-		EEH_Template::display_template( $template, $template_args );
1156
+		EEH_Template::display_template($template, $template_args);
1157 1157
 
1158 1158
 	}
1159 1159
 
@@ -1167,11 +1167,11 @@  discard block
 block discarded – undo
1167 1167
 	private function _get_reg_status_buttons() {
1168 1168
 
1169 1169
 		$buttons = array(
1170
-			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' ) . '">',
1171
-			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' ) . '">',
1172
-			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' ) . '">',
1173
-			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' ) . '">',
1174
-			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' ) . '">',
1170
+			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').'">',
1171
+			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').'">',
1172
+			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').'">',
1173
+			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').'">',
1174
+			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').'">',
1175 1175
 			);
1176 1176
 		return $buttons;
1177 1177
 	}
@@ -1185,13 +1185,13 @@  discard block
 block discarded – undo
1185 1185
 	 *
1186 1186
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1187 1187
 	 */
1188
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1189
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1188
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1189
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1190 1190
 
1191
-		$success = $this->_set_registration_status( $REG_ID, $status );
1191
+		$success = $this->_set_registration_status($REG_ID, $status);
1192 1192
 
1193 1193
 		//notify?
1194
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1194
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1195 1195
 			$this->_process_resend_registration();
1196 1196
 		}
1197 1197
 
@@ -1209,19 +1209,19 @@  discard block
 block discarded – undo
1209 1209
 	 * @param bool $status
1210 1210
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1211 1211
 	 */
1212
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1212
+	protected function _set_registration_status($REG_ID, $status = false) {
1213 1213
 		$success = true;
1214 1214
 		// set default status if none is passed
1215 1215
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1216 1216
 
1217 1217
 		//typecast and sanitize reg_id
1218
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1218
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1219 1219
 
1220 1220
 		//loop through REG_ID's and change status
1221
-		foreach ( $reg_ids as $r_id ) {
1222
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1223
-			if ( $registration instanceof EE_Registration ) {
1224
-				$registration->set_status( $status );
1221
+		foreach ($reg_ids as $r_id) {
1222
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1223
+			if ($registration instanceof EE_Registration) {
1224
+				$registration->set_status($status);
1225 1225
 				$result = $registration->save();
1226 1226
 
1227 1227
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 		$this->_req_data['_REG_ID'] = $reg_ids;
1234 1234
 
1235 1235
 		//return $success and processed registrations
1236
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1236
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1237 1237
 	}
1238 1238
 
1239 1239
 
@@ -1245,37 +1245,37 @@  discard block
 block discarded – undo
1245 1245
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1246 1246
 	 * @return void
1247 1247
 	 */
1248
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1248
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1249 1249
 
1250
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1250
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1251 1251
 
1252 1252
 
1253
-		$success = isset( $result['success'] ) && $result['success'];
1253
+		$success = isset($result['success']) && $result['success'];
1254 1254
 
1255 1255
 		//setup success message
1256
-		if ( $success ) {
1257
-			$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' ) ) ;
1258
-			EE_Error::add_success( $msg );
1256
+		if ($success) {
1257
+			$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'));
1258
+			EE_Error::add_success($msg);
1259 1259
 		} else {
1260
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1260
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1261 1261
 		}
1262 1262
 
1263
-		$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' );
1263
+		$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');
1264 1264
 		//unset nonces
1265
-		foreach ( $this->_req_data as $ref => $value ) {
1266
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1267
-				unset( $this->_req_data[$ref] );
1265
+		foreach ($this->_req_data as $ref => $value) {
1266
+			if (strpos($ref, 'nonce') !== false) {
1267
+				unset($this->_req_data[$ref]);
1268 1268
 				continue;
1269 1269
 			}
1270 1270
 
1271
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1271
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1272 1272
 			$this->_req_data[$ref] = $value;
1273 1273
 		}
1274 1274
 
1275 1275
 		//merge request vars so that the reloaded list table contains any existing filter query params
1276
-		$route = array_merge( $this->_req_data, $route );
1276
+		$route = array_merge($this->_req_data, $route);
1277 1277
 
1278
-		$this->_redirect_after_action( false, '', '', $route, true );
1278
+		$this->_redirect_after_action(false, '', '', $route, true);
1279 1279
 	}
1280 1280
 
1281 1281
 
@@ -1288,28 +1288,28 @@  discard block
 block discarded – undo
1288 1288
 		$this->_req_data['return'] = 'view_registration';
1289 1289
 
1290 1290
 		//set notify based on whether the send notifications toggle is set or not
1291
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1291
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1292 1292
 
1293
-		switch ( $this->_req_data['_reg_status_id'] ) {
1294
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1295
-				$this->approve_registration( $notify );
1293
+		switch ($this->_req_data['_reg_status_id']) {
1294
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1295
+				$this->approve_registration($notify);
1296 1296
 				break;
1297
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1298
-				$this->pending_registration( $notify );
1297
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1298
+				$this->pending_registration($notify);
1299 1299
 				break;
1300
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1301
-				$this->not_approve_registration( $notify );
1300
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1301
+				$this->not_approve_registration($notify);
1302 1302
 				break;
1303
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1304
-				$this->decline_registration( $notify );
1303
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1304
+				$this->decline_registration($notify);
1305 1305
 				break;
1306
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1307
-				$this->cancel_registration( $notify );
1306
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1307
+				$this->cancel_registration($notify);
1308 1308
 				break;
1309 1309
 			default :
1310 1310
 				$result['success'] = false;
1311
-				unset( $this->_req_data['return'] );
1312
-				$this->_reg_status_change_return( '', false );
1311
+				unset($this->_req_data['return']);
1312
+				$this->_reg_status_change_return('', false);
1313 1313
 				break;
1314 1314
 		}
1315 1315
 	}
@@ -1322,8 +1322,8 @@  discard block
 block discarded – undo
1322 1322
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1323 1323
 	*		@return void
1324 1324
 	*/
1325
-	protected function approve_registration( $notify = false ) {
1326
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1325
+	protected function approve_registration($notify = false) {
1326
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1327 1327
 	}
1328 1328
 
1329 1329
 
@@ -1335,8 +1335,8 @@  discard block
 block discarded – undo
1335 1335
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1336 1336
 	*		@return void
1337 1337
 	*/
1338
-	protected function decline_registration( $notify = false ) {
1339
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1338
+	protected function decline_registration($notify = false) {
1339
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1340 1340
 	}
1341 1341
 
1342 1342
 
@@ -1348,8 +1348,8 @@  discard block
 block discarded – undo
1348 1348
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1349 1349
 	*		@return void
1350 1350
 	*/
1351
-	protected function cancel_registration( $notify = false ) {
1352
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1351
+	protected function cancel_registration($notify = false) {
1352
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1353 1353
 	}
1354 1354
 
1355 1355
 
@@ -1362,8 +1362,8 @@  discard block
 block discarded – undo
1362 1362
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1363 1363
 	*		@return void
1364 1364
 	*/
1365
-	protected function not_approve_registration( $notify = false ) {
1366
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1365
+	protected function not_approve_registration($notify = false) {
1366
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1367 1367
 	}
1368 1368
 
1369 1369
 
@@ -1374,8 +1374,8 @@  discard block
 block discarded – undo
1374 1374
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1375 1375
 	*		@return void
1376 1376
 	*/
1377
-	protected function pending_registration( $notify = false ) {
1378
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1377
+	protected function pending_registration($notify = false) {
1378
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1379 1379
 	}
1380 1380
 
1381 1381
 
@@ -1391,72 +1391,72 @@  discard block
 block discarded – undo
1391 1391
 		$this->_session = $transaction->session_data();
1392 1392
 
1393 1393
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1394
-		$this->_template_args['line_items'] = $transaction->get_many_related('Line_Item', array( array('LIN_type' => 'line-item' ) ) );
1394
+		$this->_template_args['line_items'] = $transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
1395 1395
 
1396 1396
 
1397 1397
 		$attendee = $this->_registration->attendee();
1398 1398
 
1399 1399
 		// process taxes
1400
-		if ( $transaction ) {
1400
+		if ($transaction) {
1401 1401
 			//get all "tax" line items for this transaction and we'll use them for the tax display.
1402
-			$taxes = $transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax ) ) );
1403
-			$this->_template_args['taxes'] = !empty($taxes) ? $taxes : array();
1402
+			$taxes = $transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
1403
+			$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : array();
1404 1404
 		} else {
1405 1405
 			$this->_template_args['taxes'] = array();
1406 1406
 		}
1407 1407
 
1408
-		$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' ) : '';
1409
-		$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' ) : '';
1408
+		$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') : '';
1409
+		$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') : '';
1410 1410
 
1411
-		$this->_template_args['grand_total'] = EEH_Template::format_currency( $transaction->total() );
1411
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($transaction->total());
1412 1412
 
1413 1413
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1414
-		$payment = $transaction->get_first_related( 'Payment' );
1414
+		$payment = $transaction->get_first_related('Payment');
1415 1415
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1416
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1416
+		$payment_method = $payment->get_first_related('Payment_Method');
1417 1417
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1418
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1418
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1419 1419
 		$reg_details = array(
1420 1420
 			'payment_method' => $payment_method->name(),
1421 1421
 			'response_msg' => $payment->gateway_response(),
1422
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1422
+			'registration_id' => $this->_registration->get('REG_code'),
1423 1423
 			'registration_session' => $this->_registration->session_ID(),
1424
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1425
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1424
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1425
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1426 1426
 			);
1427 1427
 
1428 1428
 
1429
-		if ( isset( $reg_details['registration_id'] )) {
1429
+		if (isset($reg_details['registration_id'])) {
1430 1430
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1431
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1431
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1432 1432
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1433 1433
 		}
1434 1434
 
1435
-		if ( isset( $reg_details['payment_method'] ) ) {
1435
+		if (isset($reg_details['payment_method'])) {
1436 1436
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1437
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1437
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1438 1438
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1439 1439
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1440
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1440
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1441 1441
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1442 1442
 		}
1443 1443
 
1444 1444
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1445
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1445
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1446 1446
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1447 1447
 
1448 1448
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1449
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1449
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1450 1450
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1451 1451
 
1452 1452
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1453
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1453
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1454 1454
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1455 1455
 
1456
-		$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 );
1456
+		$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);
1457 1457
 
1458
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1459
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1458
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1459
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1460 1460
 
1461 1461
 	}
1462 1462
 
@@ -1472,23 +1472,23 @@  discard block
 block discarded – undo
1472 1472
 	*/
1473 1473
 	public function _reg_questions_meta_box() {
1474 1474
 
1475
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
1476
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 );
1477
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 );
1478
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 );
1475
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1);
1476
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1);
1477
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1);
1478
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1);
1479 1479
 
1480
-		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') );
1480
+		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID'));
1481 1481
 
1482 1482
 		//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1483 1483
 
1484
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1485
-		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups );
1484
+		EE_Registry::instance()->load_helper('Form_Fields');
1485
+		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups);
1486 1486
 
1487 1487
 		$this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form';
1488 1488
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1489 1489
 
1490
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1491
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1490
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1491
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1492 1492
 
1493 1493
 	}
1494 1494
 
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 	 * 		@param 		string 		$output
1504 1504
 	 * 		@return 		string
1505 1505
 	 */
1506
-	public function form_before_question_group( $output ) {
1506
+	public function form_before_question_group($output) {
1507 1507
 		return '
1508 1508
 	<table class="form-table ee-width-100">
1509 1509
 		<tbody>
@@ -1520,13 +1520,13 @@  discard block
 block discarded – undo
1520 1520
 	 * 		@param 		string 		$output
1521 1521
 	 * 		@return 		string
1522 1522
 	 */
1523
-	public function form_after_question_group( $output ) {
1523
+	public function form_after_question_group($output) {
1524 1524
 		return  '
1525 1525
 			<tr class="hide-if-no-js">
1526 1526
 				<th> </th>
1527 1527
 				<td class="reg-admin-edit-attendee-question-td">
1528
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1529
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1528
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1529
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1530 1530
 						<div class="dashicons dashicons-edit"></div>
1531 1531
 					</a>
1532 1532
 				</td>
@@ -1546,11 +1546,11 @@  discard block
 block discarded – undo
1546 1546
 	 * 		@param 		string 		$label
1547 1547
 	 * 		@return 		string
1548 1548
 	 */
1549
-	public function form_form_field_label_wrap( $label ) {
1549
+	public function form_form_field_label_wrap($label) {
1550 1550
 		return '
1551 1551
 			<tr>
1552 1552
 				<th>
1553
-					' . $label  . '
1553
+					' . $label.'
1554 1554
 				</th>';
1555 1555
 	}
1556 1556
 
@@ -1564,10 +1564,10 @@  discard block
 block discarded – undo
1564 1564
 	 * 		@param 		string 		$label
1565 1565
 	 * 		@return 		string
1566 1566
 	 */
1567
-	public function form_form_field_input__wrap( $input ) {
1567
+	public function form_form_field_input__wrap($input) {
1568 1568
 		return '
1569 1569
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1570
-					' . $input . '
1570
+					' . $input.'
1571 1571
 				</td>
1572 1572
 			</tr>';
1573 1573
 	}
@@ -1581,13 +1581,13 @@  discard block
 block discarded – undo
1581 1581
 	*		@return void
1582 1582
 	*/
1583 1583
 	protected function _update_attendee_registration_form() {
1584
-		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1585
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1586
-		$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
1587
-		$success = $this->_save_attendee_registration_form( $REG_ID, $qstns );
1584
+		$qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE;
1585
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1586
+		$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
1587
+		$success = $this->_save_attendee_registration_form($REG_ID, $qstns);
1588 1588
 		$what = __('Registration Form', 'event_espresso');
1589
-		$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1590
-		$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1589
+		$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1590
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1591 1591
 
1592 1592
 	}
1593 1593
 
@@ -1600,26 +1600,26 @@  discard block
 block discarded – undo
1600 1600
 	 * @param bool $qstns
1601 1601
 	 * @return bool
1602 1602
 	 */
1603
-	private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) {
1603
+	private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) {
1604 1604
 
1605
-		if ( ! $REG_ID || ! $qstns ) {
1606
-			EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1605
+		if ( ! $REG_ID || ! $qstns) {
1606
+			EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1607 1607
 		}
1608 1608
 		$success = TRUE;
1609 1609
 
1610 1610
 		// allow others to get in on this awesome fun   :D
1611
-		do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
1611
+		do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
1612 1612
 		// loop thru questions... FINALLY!!!
1613 1613
 
1614
-		foreach ( $qstns as $QST_ID => $qstn ) {
1614
+		foreach ($qstns as $QST_ID => $qstn) {
1615 1615
 			//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
1616
-			if ( !is_array($qstn) ) {
1617
-				$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1616
+			if ( ! is_array($qstn)) {
1617
+				$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1618 1618
 				continue;
1619 1619
 			}
1620 1620
 
1621 1621
 
1622
-			foreach ( $qstn as $ANS_ID => $ANS_value ) {
1622
+			foreach ($qstn as $ANS_ID => $ANS_value) {
1623 1623
 				//get answer
1624 1624
 				$query_params = array(
1625 1625
 					0 => array(
@@ -1630,8 +1630,8 @@  discard block
 block discarded – undo
1630 1630
 					);
1631 1631
 				$answer = EEM_Answer::instance()->get_one($query_params);
1632 1632
 				//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
1633
-				if ( ! $answer instanceof EE_Answer ) {
1634
-					$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1633
+				if ( ! $answer instanceof EE_Answer) {
1634
+					$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1635 1635
 					continue 2;
1636 1636
 				}
1637 1637
 
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
 
1646 1646
 
1647 1647
 	//TODO: try changing this to use the model directly... not indirectly through creating a default object...
1648
-	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) {
1648
+	private function _save_new_answer($REG_ID, $QST_ID, $ans) {
1649 1649
 		$set_values = array(
1650 1650
 			'QST_ID' => $QST_ID,
1651 1651
 			'REG_ID' => $REG_ID,
@@ -1672,30 +1672,30 @@  discard block
 block discarded – undo
1672 1672
 		$registrations = $REG->get_all(array(
1673 1673
 			array(
1674 1674
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1675
-				'REG_ID'=>array('!=',$this->_registration->ID())
1675
+				'REG_ID'=>array('!=', $this->_registration->ID())
1676 1676
 			),
1677 1677
 			'force_join'=>array('Attendee')));
1678 1678
 
1679 1679
 		$this->_template_args['attendees'] = array();
1680 1680
 		$this->_template_args['attendee_notice'] = '';
1681 1681
 		EE_Registry::instance()->load_helper('Array');
1682
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1683
-			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__ );
1682
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1683
+			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__);
1684 1684
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1685 1685
 		} else {
1686 1686
 
1687 1687
 			$att_nmbr = 1;
1688
-			foreach ( $registrations as $registration ) {
1688
+			foreach ($registrations as $registration) {
1689 1689
 				/* @var $registration EE_Registration */
1690 1690
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1691
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1692
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1693
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1694
-				$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 : '';
1691
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1692
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1693
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1694
+				$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 : '';
1695 1695
 
1696
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1696
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1697 1697
 
1698
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1698
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1699 1699
 
1700 1700
 				$att_nmbr++;
1701 1701
 			}
@@ -1707,8 +1707,8 @@  discard block
 block discarded – undo
1707 1707
 
1708 1708
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1709 1709
 		}
1710
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1711
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1710
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1711
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1712 1712
 
1713 1713
 	}
1714 1714
 
@@ -1729,11 +1729,11 @@  discard block
 block discarded – undo
1729 1729
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1730 1730
 
1731 1731
 		//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)
1732
-		if ( ! $this->_registration->is_primary_registrant() ) {
1732
+		if ( ! $this->_registration->is_primary_registrant()) {
1733 1733
 			$primary_registration = $this->_registration->get_primary_registration();
1734 1734
 			$primary_attendee = $primary_registration->attendee();
1735 1735
 
1736
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1736
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1737 1737
 				//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.
1738 1738
 				$primary_registration = NULL;
1739 1739
 			}
@@ -1742,28 +1742,28 @@  discard block
 block discarded – undo
1742 1742
 		}
1743 1743
 
1744 1744
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1745
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1746
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1747
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1745
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1746
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1747
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1748 1748
 		$this->_template_args['phone'] = $attendee->phone();
1749 1749
 
1750
-		EE_Registry::instance()->load_helper( 'Formatter' );
1751
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1750
+		EE_Registry::instance()->load_helper('Formatter');
1751
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1752 1752
 
1753 1753
 
1754 1754
 		//edit link
1755
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1756
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1755
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1756
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1757 1757
 
1758 1758
 		//create link
1759
-		$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 ): '';
1759
+		$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) : '';
1760 1760
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1761 1761
 
1762 1762
 		$this->_template_args['att_check'] = $att_check;
1763 1763
 
1764 1764
 
1765
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1766
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1765
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1766
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1767 1767
 	}
1768 1768
 
1769 1769
 
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 	 * @access protected
1777 1777
 	 * @return void
1778 1778
 	 */
1779
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1779
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1780 1780
 		$REGM = EEM_Registration::instance();
1781 1781
 
1782 1782
 		$success = 1;
@@ -1786,26 +1786,26 @@  discard block
 block discarded – undo
1786 1786
 		$dtts = array();
1787 1787
 
1788 1788
 		//if empty _REG_ID then get out because there's nothing to do
1789
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1789
+		if (empty($this->_req_data['_REG_ID'])) {
1790 1790
 			$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');
1791
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1792
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1791
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1792
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1793 1793
 		}
1794 1794
 
1795 1795
 		//Checkboxes
1796
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1796
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1797 1797
 			// if array has more than one element than success message should be plural
1798
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1798
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1799 1799
 			// cycle thru checkboxes
1800
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1800
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1801 1801
 
1802 1802
 				$REG = $REGM->get_one_by_ID($REG_ID);
1803 1803
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1804
-				if ( $payment_count > 0 ) {
1804
+				if ($payment_count > 0) {
1805 1805
 					$name = $REG->attendee()->full_name();
1806 1806
 					$error = 1;
1807 1807
 					$success = 0;
1808
-					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__ );
1808
+					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__);
1809 1809
 					continue; //can't trash this registration because it has payments.
1810 1810
 				}
1811 1811
 				$ticket = $REG->get_first_related('Ticket');
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 				$dtts = array_merge($dtts, $dtt);
1815 1815
 
1816 1816
 				$updated = $trash ? $REG->delete() : $REG->restore();
1817
-				if ( !$updated ) {
1817
+				if ( ! $updated) {
1818 1818
 					$success = 0;
1819 1819
 				} else {
1820 1820
 					$success = 2;
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
 			$tickets[$ticket->ID()] = $ticket;
1830 1830
 			$dtts = $ticket->get_many_related('Datetime');
1831 1831
 			$updated = $trash ? $REG->delete() : $REG->restore();
1832
-			if ( ! $updated ) {
1832
+			if ( ! $updated) {
1833 1833
 				$success = 0;
1834 1834
 			}
1835 1835
 
@@ -1839,10 +1839,10 @@  discard block
 block discarded – undo
1839 1839
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1840 1840
 		EEM_Datetime::instance()->update_sold($dtts);
1841 1841
 
1842
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1843
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1842
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1843
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1844 1844
 		$overwrite_msgs = $error ? TRUE : FALSE;
1845
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1845
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1846 1846
 	}
1847 1847
 
1848 1848
 
@@ -1866,16 +1866,16 @@  discard block
 block discarded – undo
1866 1866
 		$success = 1;
1867 1867
 
1868 1868
 		//Checkboxes
1869
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1869
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1870 1870
 			// if array has more than one element than success message should be plural
1871
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1871
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1872 1872
 			// cycle thru checkboxes
1873
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1873
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1874 1874
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1875
-				if ( ! $REG instanceof EE_Registration )
1875
+				if ( ! $REG instanceof EE_Registration)
1876 1876
 					continue;
1877 1877
 				$deleted = $this->_delete_registration($REG);
1878
-				if ( !$deleted ) {
1878
+				if ( ! $deleted) {
1879 1879
 					$success = 0;
1880 1880
 				}
1881 1881
 			}
@@ -1885,15 +1885,15 @@  discard block
 block discarded – undo
1885 1885
 			$REG_ID = $this->_req_data['_REG_ID'];
1886 1886
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1887 1887
 			$deleted = $this->_delete_registration($REG);
1888
-			if ( ! $deleted ) {
1888
+			if ( ! $deleted) {
1889 1889
 				$success = 0;
1890 1890
 			}
1891 1891
 
1892 1892
 		}
1893 1893
 
1894
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1895
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1896
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1894
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1895
+		$action_desc = __('permanently deleted.', 'event_espresso');
1896
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1897 1897
 	}
1898 1898
 
1899 1899
 
@@ -1905,31 +1905,31 @@  discard block
 block discarded – undo
1905 1905
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1906 1906
 	 * @return boolean              true = successful deletion, false = fail.
1907 1907
 	 */
1908
-	protected function _delete_registration( EE_Registration $REG ) {
1908
+	protected function _delete_registration(EE_Registration $REG) {
1909 1909
 		//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.
1910 1910
 		$TXN = $REG->get_first_related('Transaction');
1911 1911
 		$REGS = $TXN->get_many_related('Registration');
1912 1912
 
1913 1913
 		$all_trashed = TRUE;
1914
-		foreach ( $REGS as $registration ) {
1915
-			if ( ! $registration->get('REG_deleted') )
1914
+		foreach ($REGS as $registration) {
1915
+			if ( ! $registration->get('REG_deleted'))
1916 1916
 				$all_trashed = FALSE;
1917 1917
 		}
1918 1918
 
1919
-		if ( ! $all_trashed ) {
1920
-			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__ );
1919
+		if ( ! $all_trashed) {
1920
+			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__);
1921 1921
 			return false;
1922 1922
 		}
1923 1923
 
1924 1924
 		//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).
1925
-		foreach ( $REGS as $registration ) {
1925
+		foreach ($REGS as $registration) {
1926 1926
 
1927 1927
 			//delete related answers
1928 1928
 			$registration->delete_related_permanently('Answer');
1929 1929
 
1930 1930
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1931 1931
 			$attendee = $registration->get_first_related('Attendee');
1932
-			if ( $attendee instanceof EE_Attendee ) {
1932
+			if ($attendee instanceof EE_Attendee) {
1933 1933
 				$registration->_remove_relation_to($attendee, 'Attendee');
1934 1934
 			}
1935 1935
 
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
 			//now delete permanently the checkins related to this registration.
1940 1940
 			$registration->delete_related_permanently('Checkin');
1941 1941
 
1942
-			if ( $registration->ID() === $REG->ID() )
1942
+			if ($registration->ID() === $REG->ID())
1943 1943
 				continue; //we don't want to delete permanently the existing registration just yet.
1944 1944
 
1945 1945
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -1972,34 +1972,34 @@  discard block
 block discarded – undo
1972 1972
 	 * @return void
1973 1973
 	 */
1974 1974
 	public function new_registration() {
1975
-		if ( ! $this->_set_reg_event() ) {
1976
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
1975
+		if ( ! $this->_set_reg_event()) {
1976
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
1977 1977
 		}
1978
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
1978
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
1979 1979
 
1980 1980
 		// gotta start with a clean slate if we're not coming here via ajax
1981
-		if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) {
1982
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
1981
+		if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) {
1982
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1983 1983
 		}
1984 1984
 
1985
-		$this->_template_args['event_name'] = '' ;
1985
+		$this->_template_args['event_name'] = '';
1986 1986
 		// event name
1987
-		if ( $this->_reg_event ) {
1987
+		if ($this->_reg_event) {
1988 1988
 			$this->_template_args['event_name'] = $this->_reg_event->name();
1989
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
1990
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1991
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1989
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
1990
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
1991
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1992 1992
 		}
1993 1993
 
1994 1994
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
1995 1995
 
1996
-		if ( defined('DOING_AJAX' ) )
1996
+		if (defined('DOING_AJAX'))
1997 1997
 			$this->_return_json();
1998 1998
 
1999 1999
 
2000 2000
 		// grab header
2001
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2002
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2001
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2002
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2003 2003
 
2004 2004
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2005 2005
 		// the details template wrapper
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 	 */
2018 2018
 	protected function _get_registration_step_content() {
2019 2019
 
2020
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php';
2020
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php';
2021 2021
 		$template_args = array(
2022 2022
 			'title' => '',
2023 2023
 			'content' => '',
@@ -2038,11 +2038,11 @@  discard block
 block discarded – undo
2038 2038
 
2039 2039
 		//if the cart is empty then we know we're at step one so we'll display ticket selector
2040 2040
 		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2041
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2042
-		switch ( $step ) {
2041
+		$step = empty($cart) ? 'ticket' : 'questions';
2042
+		switch ($step) {
2043 2043
 			case 'ticket' :
2044 2044
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2045
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2045
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2046 2046
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2047 2047
 				$template_args['show_notification_toggle'] = FALSE;
2048 2048
 				break;
@@ -2055,9 +2055,9 @@  discard block
 block discarded – undo
2055 2055
 				break;
2056 2056
 		}
2057 2057
 
2058
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2058
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2059 2059
 
2060
-		return EEH_Template::display_template( $template_path, $template_args, TRUE );
2060
+		return EEH_Template::display_template($template_path, $template_args, TRUE);
2061 2061
 	}
2062 2062
 
2063 2063
 
@@ -2071,11 +2071,11 @@  discard block
 block discarded – undo
2071 2071
 	*		@return boolean
2072 2072
 	*/
2073 2073
 	private function _set_reg_event() {
2074
-		if ( is_object( $this->_reg_event )) {
2074
+		if (is_object($this->_reg_event)) {
2075 2075
 			return TRUE;
2076 2076
 		}
2077
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2078
-		if ( ! $EVT_ID ) {
2077
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2078
+		if ( ! $EVT_ID) {
2079 2079
 			return FALSE;
2080 2080
 		}
2081 2081
 
@@ -2096,59 +2096,59 @@  discard block
 block discarded – undo
2096 2096
 	public function process_reg_step() {
2097 2097
 
2098 2098
 		$this->_set_reg_event();
2099
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2099
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2100 2100
 
2101 2101
 		//what step are we on?
2102
-		$cart = EE_Registry::instance()->SSN->get_session_data( 'cart' );
2103
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2102
+		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2103
+		$step = empty($cart) ? 'ticket' : 'questions';
2104 2104
 
2105 2105
 		//if doing ajax then we need to verify the nonce
2106
-		if ( 'DOING_AJAX' ) {
2107
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2108
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2106
+		if ('DOING_AJAX') {
2107
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2108
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2109 2109
 		}
2110 2110
 
2111
-		switch ( $step ) {
2111
+		switch ($step) {
2112 2112
 			case 'ticket' :
2113 2113
 				//process ticket selection
2114 2114
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2115
-				if ( $success ) {
2116
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2115
+				if ($success) {
2116
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2117 2117
 				} else {
2118 2118
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2119 2119
 				}
2120
-				if ( defined('DOING_AJAX') ) {
2120
+				if (defined('DOING_AJAX')) {
2121 2121
 					$this->new_registration(); //display next step
2122 2122
 				} else {
2123 2123
 					$query_args['action'] = 'new_registration';
2124 2124
 					$query_args['processing_registration'] = true;
2125 2125
 					$query_args['event_id'] = $this->_reg_event->ID();
2126
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2126
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2127 2127
 				}
2128 2128
 				break;
2129 2129
 			case 'questions' :
2130 2130
 				//process registration
2131 2131
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2132
-				if ( ! $transaction instanceof EE_Transaction ) {
2132
+				if ( ! $transaction instanceof EE_Transaction) {
2133 2133
 					$query_args = array(
2134 2134
 						'action' => 'new_registration',
2135 2135
 						'processing_registration' => true,
2136 2136
 						'event_id' => $this->_reg_event->ID()
2137 2137
 					);
2138 2138
 
2139
-					if ( defined('DOING_AJAX' )) {
2139
+					if (defined('DOING_AJAX')) {
2140 2140
 						//display registration form again because there are errors (maybe validation?)
2141 2141
 						$this->new_registration();
2142 2142
 						return;
2143 2143
 					} else {
2144
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2144
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2145 2145
 						return;
2146 2146
 					}
2147 2147
 				}
2148 2148
 				/** @type EE_Transaction_Payments $transaction_payments */
2149
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2149
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2150 2150
 				// maybe update status, and make sure to save transaction if not done already
2151
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2151
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2152 2152
 					$transaction->save();
2153 2153
 				}
2154 2154
 				$query_args = array(
@@ -2156,8 +2156,8 @@  discard block
 block discarded – undo
2156 2156
 					'TXN_ID' => $transaction->ID(),
2157 2157
 					'page' => 'espresso_transactions'
2158 2158
 				);
2159
-				EE_Error::add_success( __('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso') );
2160
-				$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2159
+				EE_Error::add_success(__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso'));
2160
+				$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2161 2161
 				break;
2162 2162
 			}
2163 2163
 
@@ -2177,7 +2177,7 @@  discard block
 block discarded – undo
2177 2177
 	*		@return void
2178 2178
 	*/
2179 2179
 	protected function _attendee_contact_list_table() {
2180
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2180
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2181 2181
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2182 2182
 		$this->display_admin_list_table_page_with_no_sidebar();
2183 2183
 	}
@@ -2192,13 +2192,13 @@  discard block
 block discarded – undo
2192 2192
 	*		@access public
2193 2193
 	*		@return array
2194 2194
 	*/
2195
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2195
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2196 2196
 
2197
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2197
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2198 2198
 		// start with an empty array
2199 2199
 		$attendees = array();
2200 2200
 
2201
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2201
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2202 2202
 		$ATT_MDL = EEM_Attendee::instance();
2203 2203
 
2204 2204
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2226,47 +2226,47 @@  discard block
 block discarded – undo
2226 2226
 				$orderby = 'ATT_lname';
2227 2227
 		}
2228 2228
 
2229
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2229
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2230 2230
 
2231
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2232
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2233
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2231
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2232
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2233
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2234 2234
 
2235 2235
 		$_where = array();
2236 2236
 
2237
-		if ( isset( $this->_req_data['s'] ) ) {
2238
-			$sstr = '%' . $this->_req_data['s'] . '%';
2237
+		if (isset($this->_req_data['s'])) {
2238
+			$sstr = '%'.$this->_req_data['s'].'%';
2239 2239
 			$_where['OR'] = array(
2240
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2241
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2242
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2243
-				'ATT_fname' => array( 'LIKE', $sstr ),
2244
-				'ATT_lname' => array( 'LIKE', $sstr ),
2245
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2246
-				'ATT_email' => array('LIKE', $sstr ),
2247
-				'ATT_address' => array( 'LIKE', $sstr ),
2248
-				'ATT_address2' => array( 'LIKE', $sstr ),
2249
-				'ATT_city' => array( 'LIKE', $sstr ),
2250
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2251
-				'State.STA_name' => array('LIKE', $sstr ),
2252
-				'ATT_phone' => array( 'LIKE', $sstr ),
2253
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2254
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2255
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2256
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2240
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2241
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2242
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2243
+				'ATT_fname' => array('LIKE', $sstr),
2244
+				'ATT_lname' => array('LIKE', $sstr),
2245
+				'ATT_short_bio' => array('LIKE', $sstr),
2246
+				'ATT_email' => array('LIKE', $sstr),
2247
+				'ATT_address' => array('LIKE', $sstr),
2248
+				'ATT_address2' => array('LIKE', $sstr),
2249
+				'ATT_city' => array('LIKE', $sstr),
2250
+				'Country.CNT_name' => array('LIKE', $sstr),
2251
+				'State.STA_name' => array('LIKE', $sstr),
2252
+				'ATT_phone' => array('LIKE', $sstr),
2253
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2254
+				'Registration.REG_code' => array('LIKE', $sstr),
2255
+				'Registration.REG_count' => array('LIKE', $sstr),
2256
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2257 2257
 				);
2258 2258
 		}
2259 2259
 
2260 2260
 
2261
-		$offset = ($current_page-1)*$per_page;
2262
-		$limit = $count ? NULL : array( $offset, $per_page );
2261
+		$offset = ($current_page - 1) * $per_page;
2262
+		$limit = $count ? NULL : array($offset, $per_page);
2263 2263
 
2264
-		if ( $trash ) {
2265
-			$_where['status'] = array( '!=', 'publish' );
2266
-			$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));
2264
+		if ($trash) {
2265
+			$_where['status'] = array('!=', 'publish');
2266
+			$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));
2267 2267
 		} else {
2268
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2269
-			$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) );
2268
+			$_where['status'] = array('IN', array('publish'));
2269
+			$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));
2270 2270
 		}
2271 2271
 
2272 2272
 		return $all_attendees;
@@ -2283,10 +2283,10 @@  discard block
 block discarded – undo
2283 2283
 	 */
2284 2284
 	protected function _resend_registration() {
2285 2285
 		$this->_process_resend_registration();
2286
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2286
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2287 2287
 			'action' => 'default'
2288 2288
 		);
2289
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2289
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2290 2290
 	}
2291 2291
 
2292 2292
 
@@ -2294,17 +2294,17 @@  discard block
 block discarded – undo
2294 2294
 
2295 2295
 
2296 2296
 
2297
-	public function _registrations_report(){
2298
-		EE_Registry::instance()->load_helper( 'File' );
2297
+	public function _registrations_report() {
2298
+		EE_Registry::instance()->load_helper('File');
2299 2299
 		$new_request_args = array(
2300 2300
 			'export' => 'report',
2301 2301
 			'action' => 'registrations_report_for_event',
2302
-			'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2302
+			'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2303 2303
 		);
2304 2304
 		$this->_req_data = array_merge($this->_req_data, $new_request_args);
2305 2305
 
2306
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2307
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2306
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2307
+			require_once(EE_CLASSES.'EE_Export.class.php');
2308 2308
 			$EE_Export = EE_Export::instance($this->_req_data);
2309 2309
 			$EE_Export->export();
2310 2310
 		}
@@ -2312,19 +2312,19 @@  discard block
 block discarded – undo
2312 2312
 
2313 2313
 
2314 2314
 
2315
-	public function _contact_list_export(){
2316
-		EE_Registry::instance()->load_helper( 'File' );
2317
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2318
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2315
+	public function _contact_list_export() {
2316
+		EE_Registry::instance()->load_helper('File');
2317
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2318
+			require_once(EE_CLASSES.'EE_Export.class.php');
2319 2319
 			$EE_Export = EE_Export::instance($this->_req_data);
2320 2320
 			$EE_Export->export_attendees();
2321 2321
 		}
2322 2322
 	}
2323 2323
 
2324
-	public function _contact_list_report(){
2325
-		EE_Registry::instance()->load_helper( 'File' );
2326
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2327
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2324
+	public function _contact_list_report() {
2325
+		EE_Registry::instance()->load_helper('File');
2326
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2327
+			require_once(EE_CLASSES.'EE_Export.class.php');
2328 2328
 			$EE_Export = EE_Export::instance($this->_req_data);
2329 2329
 			$EE_Export->report_attendees();
2330 2330
 		}
@@ -2343,73 +2343,73 @@  discard block
 block discarded – undo
2343 2343
 	 * @return void
2344 2344
 	 */
2345 2345
 	protected function _duplicate_attendee() {
2346
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2346
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2347 2347
 		//verify we have necessary info
2348
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2349
-			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__ );
2350
-			$query_args = array( 'action' => $action );
2348
+		if (empty($this->_req_data['_REG_ID'])) {
2349
+			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__);
2350
+			$query_args = array('action' => $action);
2351 2351
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2352 2352
 		}
2353 2353
 
2354 2354
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2355
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2355
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2356 2356
 		$attendee = $registration->attendee();
2357 2357
 
2358 2358
 		//remove relation of existing attendee on registration
2359
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2359
+		$registration->_remove_relation_to($attendee, 'Attendee');
2360 2360
 		//new attendee
2361 2361
 		$new_attendee = clone $attendee;
2362
-		$new_attendee->set( 'ATT_ID', 0 );
2362
+		$new_attendee->set('ATT_ID', 0);
2363 2363
 		$new_attendee->save();
2364 2364
 
2365 2365
 		//add new attendee to reg
2366
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2366
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2367 2367
 
2368
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2368
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2369 2369
 
2370 2370
 		//redirect to edit page for attendee
2371
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2371
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2372 2372
 
2373
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2373
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2374 2374
 	}
2375 2375
 
2376 2376
 
2377 2377
 	//related to cpt routes
2378 2378
 	protected function _insert_update_cpt_item($post_id, $post) {
2379 2379
 		$success = true;
2380
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2380
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2381 2381
 		//for attendee updates
2382
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2382
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2383 2383
 			//note we should only be UPDATING attendees at this point.
2384 2384
 			$updated_fields = array(
2385 2385
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2386 2386
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2387
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2387
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2388 2388
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2389 2389
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2390
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2391
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2392
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2393
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2394
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2395
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2390
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2391
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2392
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2393
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2394
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2395
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2396 2396
 				);
2397
-			foreach ( $updated_fields as $field => $value ) {
2397
+			foreach ($updated_fields as $field => $value) {
2398 2398
 				$attendee->set($field, $value);
2399 2399
 			}
2400 2400
 
2401 2401
 			$success = $attendee->save();
2402 2402
 
2403
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2404
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2405
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2406
-					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 ) );
2403
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2404
+			foreach ($attendee_update_callbacks as $a_callback) {
2405
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2406
+					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));
2407 2407
 				}
2408 2408
 			}
2409 2409
 		}
2410 2410
 
2411
-		if ( $success === FALSE )
2412
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2411
+		if ($success === FALSE)
2412
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2413 2413
 
2414 2414
 	}
2415 2415
 
@@ -2429,17 +2429,17 @@  discard block
 block discarded – undo
2429 2429
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2430 2430
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2431 2431
 
2432
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2433
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2432
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2433
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2434 2434
 		}
2435 2435
 
2436
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2436
+		if (post_type_supports('espresso_attendees', 'comments')) {
2437 2437
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2438 2438
 		}
2439 2439
 
2440
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2441
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2442
-		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');
2440
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2441
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2442
+		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');
2443 2443
 	}
2444 2444
 
2445 2445
 
@@ -2448,10 +2448,10 @@  discard block
 block discarded – undo
2448 2448
 	 * @param  WP_Post $post wp post object
2449 2449
 	 * @return string        attendee contact info ( and form )
2450 2450
 	 */
2451
-	public function attendee_contact_info( $post ) {
2451
+	public function attendee_contact_info($post) {
2452 2452
 		//get attendee object ( should already have it )
2453 2453
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2454
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2454
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2455 2455
 		EEH_Template::display_template($template, $this->_template_args);
2456 2456
 	}
2457 2457
 
@@ -2467,12 +2467,12 @@  discard block
 block discarded – undo
2467 2467
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2468 2468
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2469 2469
 				new EE_Question_Form_Input(
2470
-				EE_Question::new_instance( array(
2470
+				EE_Question::new_instance(array(
2471 2471
 					'QST_ID' => 0,
2472 2472
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2473 2473
 					'QST_system' => 'admin-state'
2474 2474
 					)),
2475
-				EE_Answer::new_instance( array(
2475
+				EE_Answer::new_instance(array(
2476 2476
 					'ANS_ID' => 0,
2477 2477
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2478 2478
 					)),
@@ -2485,12 +2485,12 @@  discard block
 block discarded – undo
2485 2485
 			));
2486 2486
 		$this->_template_args['country_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' => __('Country', 'event_espresso'),
2491 2491
 					'QST_system' => 'admin-country'
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->country_ID()
2496 2496
 					)),
@@ -2501,8 +2501,8 @@  discard block
 block discarded – undo
2501 2501
 					'append_qstn_id' => FALSE
2502 2502
 					)
2503 2503
 				));
2504
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2505
-		EEH_Template::display_template($template, $this->_template_args );
2504
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2505
+		EEH_Template::display_template($template, $this->_template_args);
2506 2506
 
2507 2507
 	}
2508 2508
 
@@ -2512,11 +2512,11 @@  discard block
 block discarded – undo
2512 2512
 	*		@access protected
2513 2513
 	*		@return void
2514 2514
 	*/
2515
-	public function attendee_registrations_meta_box( $post ) {
2515
+	public function attendee_registrations_meta_box($post) {
2516 2516
 
2517 2517
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2518 2518
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2519
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2519
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2520 2520
 		EEH_Template::display_template($template, $this->_template_args);
2521 2521
 
2522 2522
 	}
@@ -2530,8 +2530,8 @@  discard block
 block discarded – undo
2530 2530
 	 * @return string        html for new form.
2531 2531
 	 */
2532 2532
 	public function after_title_form_fields($post) {
2533
-		if ( $post->post_type == 'espresso_attendees' ) {
2534
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2533
+		if ($post->post_type == 'espresso_attendees') {
2534
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2535 2535
 			$template_args['attendee'] = $this->_cpt_model_obj;
2536 2536
 			EEH_Template::display_template($template, $template_args);
2537 2537
 		}
@@ -2548,21 +2548,21 @@  discard block
 block discarded – undo
2548 2548
 	*		@access protected
2549 2549
 	*		@return void
2550 2550
 	*/
2551
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2551
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2552 2552
 
2553
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2553
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2554 2554
 
2555 2555
 		$ATT_MDL = EEM_Attendee::instance();
2556 2556
 
2557 2557
 		$success = 1;
2558 2558
 		//Checkboxes
2559
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2559
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2560 2560
 			// if array has more than one element than success message should be plural
2561
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2561
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2562 2562
 			// cycle thru checkboxes
2563
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2564
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2565
-				if ( !$updated ) {
2563
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2564
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2565
+				if ( ! $updated) {
2566 2566
 					$success = 0;
2567 2567
 				}
2568 2568
 			}
@@ -2571,18 +2571,18 @@  discard block
 block discarded – undo
2571 2571
 			// grab single id and delete
2572 2572
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2573 2573
 			//get attendee
2574
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2574
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2575 2575
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2576 2576
 			$updated = $att->save();
2577
-			if ( ! $updated ) {
2577
+			if ( ! $updated) {
2578 2578
 				$success = 0;
2579 2579
 			}
2580 2580
 
2581 2581
 		}
2582 2582
 
2583
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2584
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2585
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2583
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2584
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2585
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2586 2586
 
2587 2587
 	}
2588 2588
 
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param \EE_Admin_Page $admin_page
34 34
 	 * @return EE_Admin_Transactions_List_Table
35 35
 	 */
36
-	function __construct( EE_Admin_Page $admin_page ){
37
-   		parent::__construct( $admin_page );
36
+	function __construct(EE_Admin_Page $admin_page) {
37
+   		parent::__construct($admin_page);
38 38
    		$this->_status = $this->_admin_page->get_transaction_status_array();
39 39
 
40 40
 	}
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 	protected function _setup_data() {
47
-		$this->_data = $this->_admin_page->get_transactions( $this->_per_page );
48
-		$status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';
49
-		$this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );
47
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
48
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
49
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);
50 50
 	}
51 51
 
52 52
 
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 
67 67
 		$this->_columns = array(
68 68
 			'STS_ID' => '',
69
-			'TXN_ID' => __( 'ID', 'event_espresso' ),
70
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
71
-			'TXN_total' => __( 'Total', 'event_espresso' ),
72
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
73
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
74
-			'ATT_email' => __( 'Email Address', 'event_espresso' ),
75
-			'event_name' => __( 'Event', 'event_espresso' ),
76
-			'actions' => __( 'Actions', 'event_espresso' )
69
+			'TXN_ID' => __('ID', 'event_espresso'),
70
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
71
+			'TXN_total' => __('Total', 'event_espresso'),
72
+			'TXN_paid' => __('Paid', 'event_espresso'),
73
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
74
+			'ATT_email' => __('Email Address', 'event_espresso'),
75
+			'event_name' => __('Event', 'event_espresso'),
76
+			'actions' => __('Actions', 'event_espresso')
77 77
 		);
78 78
 
79 79
 		$this->_sortable_columns = array(
80
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
81
-			'event_name' => array( 'event_name'=> FALSE ),
82
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
83
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
80
+			'TXN_ID' => array('TXN_ID' => FALSE),
81
+			'event_name' => array('event_name'=> FALSE),
82
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
83
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
84 84
 		);
85 85
 
86 86
 		$this->_hidden_columns = array();
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	protected function _get_table_filters() {
99 99
 		$filters = array();
100
-		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'D M j, Y', strtotime( '-10 year' ));
101
-		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'D M j, Y' );
100
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('D M j, Y', strtotime('-10 year'));
101
+		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('D M j, Y');
102 102
 		ob_start();
103 103
 		?>
104 104
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 
117 117
 
118 118
 	protected function _add_view_counts() {
119
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
120
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
121
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
119
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
120
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
121
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
122 122
 	}
123 123
 
124 124
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 * @param \EE_Transaction $item
128 128
 	 * @return string
129 129
 	 */
130
-   function column_TXN_ID( EE_Transaction $item ){
131
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
132
-				return '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
130
+   function column_TXN_ID(EE_Transaction $item) {
131
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
132
+				return '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
133 133
 	}
134 134
 
135 135
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @param \EE_Transaction $item
139 139
 	 * @return string
140 140
 	 */
141
-	function column_STS_ID( EE_Transaction $item ){
142
-		return '<span class="ee-status-strip ee-status-strip-td txn-status-' . $item->status_ID() . '"></span>';
141
+	function column_STS_ID(EE_Transaction $item) {
142
+		return '<span class="ee-status-strip ee-status-strip-td txn-status-'.$item->status_ID().'"></span>';
143 143
 	}
144 144
 
145 145
 
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	 * @param \EE_Transaction $item
149 149
 	 * @return string
150 150
 	 */
151
-	function column_cb($item ){
152
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
151
+	function column_cb($item) {
152
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
153 153
 	}
154 154
 
155 155
 
@@ -158,19 +158,19 @@  discard block
 block discarded – undo
158 158
 	 * @param \EE_Transaction $item
159 159
 	 * @return string
160 160
 	 */
161
-	function column_TXN_timestamp( EE_Transaction $item ){
162
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
161
+	function column_TXN_timestamp(EE_Transaction $item) {
162
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
163 163
 		// is TXN less than 2 hours old ?
164 164
 		if (
165 165
 			(
166
-				( current_time( 'timestamp' ) - EE_Registry::instance()->SSN->lifespan() )
167
-				< strtotime( $item->datetime() )
166
+				(current_time('timestamp') - EE_Registry::instance()->SSN->lifespan())
167
+				< strtotime($item->datetime())
168 168
 			) &&
169
-			( $item->failed() || $item->is_abandoned() )
169
+			($item->failed() || $item->is_abandoned())
170 170
 		) {
171
-			$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . __( 'TXN in progress...', 'event_espresso' ) . '</a>';
171
+			$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.__('TXN in progress...', 'event_espresso').'</a>';
172 172
 		} else {
173
-			$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $item->get_i18n_datetime( 'TXN_timestamp' ) .  '</a>';
173
+			$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$item->get_i18n_datetime('TXN_timestamp').'</a>';
174 174
 		}
175 175
 		return $txn_date;
176 176
 	}
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 	 * @param \EE_Transaction $item
182 182
 	 * @return string
183 183
 	 */
184
-	function column_TXN_total( EE_Transaction $item ){
185
-		if ( $item->get('TXN_total') > 0 ) {
186
-			return '<span class="txn-pad-rght">' . $item->get_pretty('TXN_total') . '</span>';
184
+	function column_TXN_total(EE_Transaction $item) {
185
+		if ($item->get('TXN_total') > 0) {
186
+			return '<span class="txn-pad-rght">'.$item->get_pretty('TXN_total').'</span>';
187 187
 		} else {
188
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
188
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
189 189
 		}
190 190
 
191 191
 	}
@@ -196,19 +196,19 @@  discard block
 block discarded – undo
196 196
 	 * @param \EE_Transaction $item
197 197
 	 * @return mixed|string
198 198
 	 */
199
-	function column_TXN_paid( EE_Transaction $item ){
199
+	function column_TXN_paid(EE_Transaction $item) {
200 200
 		$transaction_total = $item->get('TXN_total');
201 201
 		$transaction_paid = $item->get('TXN_paid');
202 202
 
203
-		if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) {
203
+		if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) {
204 204
 			// paid in full
205 205
 			$span_class = 'txn-overview-full-payment-spn';
206 206
 
207
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) {
207
+		} elseif (($transaction_total > 0) && ($transaction_paid > 0)) {
208 208
 			// monies owing
209 209
 			$span_class = 'txn-overview-part-payment-spn';
210 210
 
211
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) {
211
+		} elseif (($transaction_total > 0) && ($transaction_paid == 0)) {
212 212
 			// no payments made
213 213
 			$span_class = 'txn-overview-no-payment-spn';
214 214
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$transaction_paid = 0;
218 218
 		}
219 219
 
220
-		return '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
220
+		return '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
221 221
 
222 222
 	}
223 223
 
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 	 * @param \EE_Transaction $item
228 228
 	 * @return string|void
229 229
 	 */
230
-	function column_ATT_fname( EE_Transaction $item ){
230
+	function column_ATT_fname(EE_Transaction $item) {
231 231
 		$primary_reg = $item->primary_registration();
232 232
 		$attendee = $primary_reg->get_first_related('Attendee');
233
-		if ( $attendee instanceof EE_Attendee ) {
234
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
235
-			return 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();
233
+		if ($attendee instanceof EE_Attendee) {
234
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
235
+			return 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();
236 236
 		}
237 237
 		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');
238 238
 	}
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 	 * @param \EE_Transaction $item
244 244
 	 * @return string|void
245 245
 	 */
246
-	function column_ATT_email( EE_Transaction $item ){
246
+	function column_ATT_email(EE_Transaction $item) {
247 247
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
248
-		if ( !empty( $attendee ) )
249
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
248
+		if ( ! empty($attendee))
249
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
250 250
 		else
251 251
 			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');
252 252
 		;
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 	 * @param \EE_Transaction $item
259 259
 	 * @return string|void
260 260
 	 */
261
-    function column_event_name( EE_Transaction $item ){
261
+    function column_event_name(EE_Transaction $item) {
262 262
     	$actions = array();
263 263
 		$event = $item->primary_registration()->get_first_related('Event');
264
-		if ( !empty( $event ) ) {
265
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
264
+		if ( ! empty($event)) {
265
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
266 266
 			$event_name = $event->get('EVT_name');
267 267
 
268 268
 			//filter this view by transactions for this event
269
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
270
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
271
-				$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>';
269
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
270
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
271
+				$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>';
272 272
 			}
273 273
 
274
-			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) );
274
+			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));
275 275
 		} else {
276 276
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
277 277
 		}
@@ -283,33 +283,33 @@  discard block
 block discarded – undo
283 283
 	 * @param \EE_Transaction $item
284 284
 	 * @return string
285 285
 	 */
286
-    function column_actions( EE_Transaction $item ){
286
+    function column_actions(EE_Transaction $item) {
287 287
 
288 288
     	$registration = $item->primary_registration();
289 289
     	$attendee = $registration->attendee();
290
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
290
+		EE_Registry::instance()->load_helper('MSG_Template');
291 291
 
292 292
         //Build row actions
293
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
293
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
294 294
 		$dl_invoice_lnk_url = $registration->invoice_url();
295 295
 		$dl_receipt_lnk_url = $registration->receipt_url();
296
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
297
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
296
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
297
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
298 298
 
299 299
 		//Build row actions
300 300
 		$view_lnk = '
301 301
 			<li>
302
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
302
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
303 303
 					<span class="dashicons dashicons-cart"></span>
304 304
 				</a>
305 305
 			</li>';
306 306
 
307 307
 
308 308
 	//only show invoice link if message type is active.
309
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
309
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
310 310
 		$dl_invoice_lnk = '
311 311
 		<li>
312
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
312
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
313 313
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
314 314
 			</a>
315 315
 		</li>';
@@ -318,10 +318,10 @@  discard block
 block discarded – undo
318 318
 	}
319 319
 
320 320
 	//only show receipt link if message type is active.
321
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
321
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
322 322
 		$dl_receipt_lnk = '
323 323
 		<li>
324
-			<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
324
+			<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
325 325
 				<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
326 326
 			</a>
327 327
 		</li>';
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 	}
331 331
 
332 332
       		//only show payment reminder link if the message type is active.
333
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
334
-		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
333
+      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
334
+		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? '
335 335
 			<li>
336
-				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
336
+				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
337 337
 					<span class="dashicons dashicons-email-alt"></span>
338 338
 				</a>
339 339
 			</li>' : '';
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 			$send_pay_lnk = '';
343 343
 		}
344 344
 
345
-		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
345
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
346 346
 			<li>
347
-				<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
347
+				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
348 348
 					<span class="dashicons dashicons-clipboard"></span>
349 349
 				</a>
350 350
 			</li>' : '';
351 351
 
352
-	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
352
+	return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul');
353 353
     }
354 354
 
355 355
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
308 308
 	 * @param \EE_Transaction $item
309 309
 	 * @return string
310 310
 	 */
311
-    function column_actions( EE_Transaction $item ){
311
+	function column_actions( EE_Transaction $item ){
312 312
 
313
-    	$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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks {
31 31
 
32 32
 
33
-	public function __construct( EE_Admin_Page $adminpage ) {
33
+	public function __construct(EE_Admin_Page $adminpage) {
34 34
 		/**
35 35
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
36 36
 		 */
37
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) {
37
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) {
38 38
 			return;
39 39
 		}
40
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
41
-		parent::__construct( $adminpage );
40
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
41
+		parent::__construct($adminpage);
42 42
 	}
43 43
 
44 44
 	/**
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 					),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 					)
76 76
 				),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	 * @param  array       $data   The request data from the form
97 97
 	 * @return bool         success or fail
98 98
 	 */
99
-	public function attach_evt_message_templates( $evtobj, $data ) {
99
+	public function attach_evt_message_templates($evtobj, $data) {
100 100
 		//first we remove all existing relations on the Event for message types.
101 101
 		$evtobj->_remove_relations('Message_Template_Group');
102 102
 
103 103
 		//now let's just loop throught the selected templates and add relations!
104
-		foreach( $data['event_message_templates_relation'] as $grp_ID ) {
105
-			$evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		foreach ($data['event_message_templates_relation'] as $grp_ID) {
105
+			$evtobj->_add_relation_to($grp_ID, 'Message_Template_Group');
106 106
 		}
107 107
 
108 108
 		//now save
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 
116 116
 		//let's get the active messengers (b/c messenger objects have the active message templates)
117 117
 		//convert 'evt_id' to 'EVT_ID'
118
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
119
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
118
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
119
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
120 120
 
121
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
121
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
122 122
 
123 123
 
124 124
 		$EEM_controller = new EE_messages;
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 
128 128
 		//empty messengers?
129 129
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
130
-		if ( empty( $active_messengers ) ) {
131
-			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL );
132
-			$error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>');
133
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
134
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
130
+		if (empty($active_messengers)) {
131
+			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL);
132
+			$error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>');
133
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
134
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
135 135
 
136 136
 			echo $error_content;
137 137
 			echo $internal_content;
@@ -140,36 +140,36 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
142 142
 		//get content for active messengers
143
-		foreach ( $active_messengers as $name => $messenger ) {
143
+		foreach ($active_messengers as $name => $messenger) {
144 144
 			//first check if there are any active message types for this messenger.
145
-			$active_mts = $EEM_controller->get_active_message_types_per_messenger( $name );
146
-			if ( empty( $active_mts ) ) {
145
+			$active_mts = $EEM_controller->get_active_message_types_per_messenger($name);
146
+			if (empty($active_mts)) {
147 147
 				continue;
148 148
 			}
149 149
 
150
-			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) );
150
+			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id));
151 151
 
152
-			if ( ! empty( $tcont ) ) {
152
+			if ( ! empty($tcont)) {
153 153
 				$tabs[$name] = $tcont;
154 154
 			}
155 155
 		}
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
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
172
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
173 173
 
174 174
 	}
175 175
 
@@ -183,22 +183,22 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function create_new_custom() {
185 185
 
186
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
187
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
186
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
187
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
188 188
 		}
189 189
 
190 190
 		//let's clean up the _POST global a bit for downstream usage of name and description.
191
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
192
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
191
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
192
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
193 193
 
194 194
 
195 195
 		//set EE_Admin_Page object (see method details in EE_Admin_Hooks parent
196 196
 		$this->_set_page_object();
197 197
 
198 198
 		//is this a template switch if so EE_Admin_Page child needs this object
199
-		$this->_page_object->set_hook_object( $this );
199
+		$this->_page_object->set_hook_object($this);
200 200
 
201
-		$this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] );
201
+		$this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']);
202 202
 	}
203 203
 
204 204
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return string (admin_footer contents)
214 214
 	 */
215 215
 	public function edit_admin_footer() {
216
-		$template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php';
216
+		$template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php';
217 217
 		EEH_Template::display_template($template_path, array());
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
167 168
 			</div><div class="ee-notices"></div>';
168 169
 
169
-		if ( defined('DOING_AJAX' ) )
170
-			return $tabbed_content;
170
+		if ( defined('DOING_AJAX' ) ) {
171
+					return $tabbed_content;
172
+		}
171 173
 
172 174
 		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
173 175
 
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 4 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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__, '' );
Please login to merge, or discard this patch.
Spacing   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class Extend_Registrations_Admin_Page extends Registrations_Admin_Page {
31 31
 
32
-	public function __construct( $routing = TRUE ) {
33
-		parent::__construct( $routing );
34
-		define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
35
-		define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
36
-		define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
32
+	public function __construct($routing = TRUE) {
33
+		parent::__construct($routing);
34
+		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
35
+		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
36
+		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
37 37
 	}
38 38
 
39 39
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 	protected function _extend_page_config() {
45
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
45
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
46 46
 
47
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
48
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
49
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
47
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
48
+		$att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;
49
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
50 50
 
51 51
 		$new_page_routes = array(
52 52
 			'reports' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				)
86 86
 			);
87 87
 
88
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
88
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
89 89
 
90 90
 		$new_page_config = array(
91 91
 			'reports' => array(
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 						'filename' => 'registrations_reports'
100 100
 						)
101 101
 					),
102
-				'help_tour' => array( 'Registration_Reports_Help_Tour' ),
102
+				'help_tour' => array('Registration_Reports_Help_Tour'),
103 103
 				'require_nonce' => FALSE
104 104
 				),
105 105
 			'event_registrations' => array(
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 						'filename' => 'registrations_event_checkin_other'
131 131
 					)
132 132
 				),
133
-				'help_tour' => array( 'Event_Checkin_Help_Tour' ),
134
-				'qtips' => array('Registration_List_Table_Tips' ),
133
+				'help_tour' => array('Event_Checkin_Help_Tour'),
134
+				'qtips' => array('Registration_List_Table_Tips'),
135 135
 				'list_table' => 'EE_Event_Registrations_List_Table',
136 136
 				'metaboxes' => array(),
137 137
 				'require_nonce' => FALSE
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		// var_dump($this->_req_data);
153 153
 		// exit();
154 154
 
155
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
155
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
156 156
 		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
157 157
 		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
158 158
 	}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 	protected function _ajax_hooks() {
163 163
 		parent::_ajax_hooks();
164
-		add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') );
164
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
165 165
 	}
166 166
 
167 167
 
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 
172 172
 		//if newsletter message type is active then let's add filter and load js for it.
173 173
 		EE_Registry::instance()->load_helper('MSG_Template');
174
-		if ( EEH_MSG_Template::is_mt_active('newsletter') ) {
174
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
175 175
 			//enqueue newsletter js
176
-			wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE );
177
-			wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION );
176
+			wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE);
177
+			wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION);
178 178
 			//hook in buttons for newsletter message type trigger.
179
-			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 );
179
+			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10);
180 180
 		}
181 181
 	}
182 182
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 
189 189
 		//scripts
190 190
 		global $is_IE;
191
-		if ( $is_IE ) {
192
-			wp_enqueue_script( 'excanvas' );
191
+		if ($is_IE) {
192
+			wp_enqueue_script('excanvas');
193 193
 		}
194 194
 
195
-		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL  . 'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
196
-		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
195
+		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
196
+		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
197 197
 	}
198 198
 
199 199
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				'slug' => 'all',
225 225
 				'label' => __('All', 'event_espresso'),
226 226
 				'count' => 0,
227
-				'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(
227
+				'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(
228 228
 					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
229 229
 					//'trash_registrations' => __('Trash Registrations', 'event_espresso')
230 230
 					)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 				'slug' => 'all',
243 243
 				'label' => __('All', 'event_espresso'),
244 244
 				'count' => 0,
245
-				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') )
245
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso'))
246 246
 				),
247 247
 			);
248 248
 	}
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function get_newsletter_form_content() {
260 260
 		//do a nonce check cause we're not coming in from an normal route here.
261
-		$nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';
261
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';
262 262
 		$nonce_ref = 'get_newsletter_form_content_nonce';
263 263
 
264
-		$this->_verify_nonce( $nonce, $nonce_ref );
264
+		$this->_verify_nonce($nonce, $nonce_ref);
265 265
 		//let's get the mtp for the incoming MTP_ ID
266
-		if ( !isset( $this->_req_data['GRP_ID'] ) ) {
267
-			EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
266
+		if ( ! isset($this->_req_data['GRP_ID'])) {
267
+			EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
268 268
 			$this->_template_args['success'] = FALSE;
269 269
 			$this->_template_args['error'] = TRUE;
270 270
 			$this->_return_json();
271 271
 		}
272
-		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );
273
-		if ( ! $MTPG instanceof EE_Message_Template_Group ) {
274
-			EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__  );
272
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
273
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
274
+			EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__);
275 275
 			$this->_template_args['success'] = FALSE;
276 276
 			$this->_template_args['error'] = TRUE;
277 277
 			$this->_return_json();
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 		$MTPs = $MTPG->context_templates();
281 281
 		$MTPs = $MTPs['attendee'];
282 282
 		$template_fields = array();
283
-		foreach ( $MTPs as $MTP ) {
283
+		foreach ($MTPs as $MTP) {
284 284
 			$field = $MTP->get('MTP_template_field');
285
-			if ( $field == 'content'  ) {
285
+			if ($field == 'content') {
286 286
 				$content = $MTP->get('MTP_content');
287
-				if ( !empty( $content['newsletter_content'] ) ) {
287
+				if ( ! empty($content['newsletter_content'])) {
288 288
 					$template_fields['newsletter_content'] = $content['newsletter_content'];
289 289
 					}
290 290
 				continue;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$this->_template_args['data'] = array(
298 298
 			'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',
299 299
 			'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',
300
-			'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''
300
+			'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''
301 301
 			);
302 302
 		$this->_return_json();
303 303
 	}
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	 * @param EE_Admin_List_Table $list_table
314 314
 	 * @return string html string for extra buttons
315 315
 	 */
316
-	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) {
317
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) {
316
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) {
317
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) {
318 318
 			return '';
319 319
 		}
320 320
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 			'event_registrations',
324 324
 			'default'
325 325
 			);
326
-		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) {
327
-			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) {
326
+		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
327
+			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) {
328 328
 				echo '';
329 329
 			} else {
330
-				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' );
331
-				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';
332
-				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') );
330
+				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>');
331
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';
332
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
333 333
 			}
334 334
 		}
335 335
 	}
@@ -341,38 +341,38 @@  discard block
 block discarded – undo
341 341
 		$list_table = $this->_list_table_object;
342 342
 		$codes = array();
343 343
 		//need to templates for the newsletter message type for the template selector.
344
-		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 );
345
-		$mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );
346
-		foreach ( $mtps as $mtp ) {
344
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
345
+		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')));
346
+		foreach ($mtps as $mtp) {
347 347
 			$name = $mtp->name();
348 348
 			$values[] = array(
349
-				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name,
349
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
350 350
 				'id' => $mtp->ID()
351 351
 				);
352 352
 		}
353 353
 
354 354
 		//need to get a list of shortcodes that are available for the newsletter message type.
355 355
 		EE_Registry::instance()->load_helper('MSG_Template');
356
-		$shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );
357
-		foreach ( $shortcodes as $field => $shortcode_array ) {
358
-			$codes[$field] = implode(', ', array_keys($shortcode_array ) );
356
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE);
357
+		foreach ($shortcodes as $field => $shortcode_array) {
358
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
359 359
 		}
360 360
 
361 361
 		$shortcodes = $codes;
362 362
 
363
-		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
363
+		$form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
364 364
 		$form_template_args = array(
365 365
 			'form_action' => admin_url('admin.php?page=espresso_registrations'),
366 366
 			'form_route' => 'newsletter_selected_send',
367 367
 			'form_nonce_name' => 'newsletter_selected_send_nonce',
368
-			'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),
368
+			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'),
369 369
 			'redirect_back_to' => $this->_req_action,
370
-			'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),
371
-			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ),
370
+			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'),
371
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
372 372
 			'shortcodes' => $shortcodes,
373 373
 			'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'
374 374
 			);
375
-		EEH_Template::display_template( $form_template, $form_template_args );
375
+		EEH_Template::display_template($form_template, $form_template_args);
376 376
 	}
377 377
 
378 378
 
@@ -387,35 +387,35 @@  discard block
 block discarded – undo
387 387
 	protected function _newsletter_selected_send() {
388 388
 		$success = TRUE;
389 389
 		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
390
-		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) {
391
-			EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
390
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
391
+			EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
392 392
 			$success = FALSE;
393 393
 		}
394 394
 
395
-		if ( $success ) {
395
+		if ($success) {
396 396
 			//update Message template in case there are any changes
397
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] );
397
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']);
398 398
 			$MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array();
399
-			if ( empty( $MTPs ) ) {
400
-				EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
399
+			if (empty($MTPs)) {
400
+				EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
401 401
 				$success = FALSE;
402 402
 			}
403 403
 
404 404
 			//let's just update the specific fields
405
-			foreach ( $MTPs['attendee'] as $MTP ) {
405
+			foreach ($MTPs['attendee'] as $MTP) {
406 406
 				$field = $MTP->get('MTP_template_field');
407 407
 				$content = $MTP->get('MTP_content');
408 408
 				$new_content = $content;
409
-				switch( $field ) {
409
+				switch ($field) {
410 410
 					case 'from' :
411
-						$new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content;
411
+						$new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content;
412 412
 						break;
413 413
 					case 'subject' :
414
-						$new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content;
414
+						$new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content;
415 415
 						break;
416 416
 					case 'content' :
417 417
 						$new_content = $content;
418
-						$new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
418
+						$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
419 419
 						break;
420 420
 					default :
421 421
 						continue;
@@ -426,20 +426,20 @@  discard block
 block discarded – undo
426 426
 			}
427 427
 
428 428
 			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
429
-			$id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration';
429
+			$id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration';
430 430
 
431 431
 			//id_type will affect how we assemble the ids.
432
-			$ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array();
432
+			$ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array();
433 433
 
434
-			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) );
434
+			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
435 435
 
436 436
 			//we do _action because ALL triggers are handled in EED_Messages.
437
-			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() );
437
+			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID());
438 438
 		}
439 439
 		$query_args = array(
440
-			'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default'
440
+			'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default'
441 441
 			);
442
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
442
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
443 443
 	}
444 444
 
445 445
 
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 	*/
453 453
 	protected function _registration_reports() {
454 454
 
455
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
455
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
456 456
 
457 457
 		$page_args = array();
458 458
 
459
-		$page_args['admin_reports'][] = $this->_registrations_per_day_report( '-1 month' );  //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
-		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report( '-1 month' ); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
459
+		$page_args['admin_reports'][] = $this->_registrations_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
+		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
461 461
 //		$page_args['admin_reports'][] = 'chart1';
462 462
 
463
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
464
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );
463
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
464
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);
465 465
 
466 466
 //		EEH_Debug_Tools::printr( $page_args, '$page_args' );
467 467
 
@@ -480,36 +480,36 @@  discard block
 block discarded – undo
480 480
 	*		@access private
481 481
 	*		@return void
482 482
 	*/
483
-	private function _registrations_per_day_report( $period = '-1 month' ) {
483
+	private function _registrations_per_day_report($period = '-1 month') {
484 484
 
485 485
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
486 486
 		$report_JS = 'espresso_reg_admin_regs_per_day';
487 487
 
488
-		wp_enqueue_script( $report_JS );
488
+		wp_enqueue_script($report_JS);
489 489
 
490 490
 		$REG = EEM_Registration::instance();
491 491
 
492
-		$results = $REG->get_registrations_per_day_report( $period );
492
+		$results = $REG->get_registrations_per_day_report($period);
493 493
 
494 494
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_day' );
495 495
 		$regs = array();
496
-		$xmin = date( 'Y-m-d', strtotime( '+1 year' ));
496
+		$xmin = date('Y-m-d', strtotime('+1 year'));
497 497
 		$xmax = 0;
498 498
 		$ymax = 0;
499 499
 		$results = (array) $results;
500
-		foreach ( $results as $result ) {
501
-			$regs[] = array( $result->regDate, (int)$result->total );
502
-			$xmin = strtotime( $result->regDate ) < strtotime( $xmin ) ? $result->regDate : $xmin;
503
-			$xmax = strtotime( $result->regDate ) > strtotime( $xmax ) ? $result->regDate : $xmax;
500
+		foreach ($results as $result) {
501
+			$regs[] = array($result->regDate, (int) $result->total);
502
+			$xmin = strtotime($result->regDate) < strtotime($xmin) ? $result->regDate : $xmin;
503
+			$xmax = strtotime($result->regDate) > strtotime($xmax) ? $result->regDate : $xmax;
504 504
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
505 505
 		}
506 506
 
507
-		$xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));
508
-		$xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));
507
+		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day'));
508
+		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day'));
509 509
 		// calculate # days between our min and max dates
510
-		$span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;
510
+		$span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;
511 511
 
512
-		$report_title = __( 'Total Registrations per Day', 'event_espresso' );
512
+		$report_title = __('Total Registrations per Day', 'event_espresso');
513 513
 
514 514
 		$report_params = array(
515 515
 				'title' 	=> $report_title,
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
 				'ymax' 	=> ceil($ymax * 1.25),
521 521
 				'span' 	=> $span,
522 522
 				'width'	=> ceil(900 / $span),
523
-				'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
523
+				'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
524 524
 			);
525
-		wp_localize_script( $report_JS, 'regPerDay', $report_params );
525
+		wp_localize_script($report_JS, 'regPerDay', $report_params);
526 526
 
527 527
 		return $report_ID;
528 528
 	}
@@ -537,29 +537,29 @@  discard block
 block discarded – undo
537 537
 	*		@access private
538 538
 	*		@return void
539 539
 	*/
540
-	private function _get_registrations_per_event_report( $period = '-1 month' ) {
540
+	private function _get_registrations_per_event_report($period = '-1 month') {
541 541
 
542 542
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
543 543
 		$report_JS = 'espresso_reg_admin_regs_per_event';
544 544
 
545
-		wp_enqueue_script( $report_JS );
545
+		wp_enqueue_script($report_JS);
546 546
 
547
-		require_once ( EE_MODELS . 'EEM_Registration.model.php' );
547
+		require_once (EE_MODELS.'EEM_Registration.model.php');
548 548
 		$REG = EEM_Registration::instance();
549 549
 
550
-		$results = $REG->get_registrations_per_event_report( $period );
550
+		$results = $REG->get_registrations_per_event_report($period);
551 551
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_event' );
552 552
 		$regs = array();
553 553
 		$ymax = 0;
554 554
 		$results = (array) $results;
555
-		foreach ( $results as $result ) {
556
-			$regs[] = array( wp_trim_words( $result->event_name, 4, '...' ), (int)$result->total );
555
+		foreach ($results as $result) {
556
+			$regs[] = array(wp_trim_words($result->event_name, 4, '...'), (int) $result->total);
557 557
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
558 558
 		}
559 559
 
560 560
 		$span = $period == 'week' ? 9 : 33;
561 561
 
562
-		$report_title = __( 'Total Registrations per Event', 'event_espresso' );
562
+		$report_title = __('Total Registrations per Event', 'event_espresso');
563 563
 
564 564
 		$report_params = array(
565 565
 			'title' 	=> $report_title,
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 			'ymax' 	=> ceil($ymax * 1.25),
569 569
 			'span' 	=> $span,
570 570
 			'width'	=> ceil(900 / $span),
571
-			'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
571
+			'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
572 572
 		);
573
-		wp_localize_script( $report_JS, 'regPerEvent', $report_params );
573
+		wp_localize_script($report_JS, 'regPerEvent', $report_params);
574 574
 
575 575
 		return $report_ID;
576 576
 	}
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @return void
585 585
 	 */
586 586
 	protected function _registration_checkin_list_table() {
587
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
588
-		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
587
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
588
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
589 589
 		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
590 590
 		$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2');
591 591
 
@@ -599,15 +599,15 @@  discard block
 block discarded – undo
599 599
 				'desc' => __('This indicates the attendee has been checked out', 'event_espresso')
600 600
 				)
601 601
 			);
602
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
602
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
603 603
 
604 604
 
605
-		$dtt_id = isset(  $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
606
-		$go_back_url = !empty( $reg_id )  ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : '';
605
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
606
+		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : '';
607 607
 
608
-		$this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : '';
609
-		$this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
610
-		$this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
608
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : '';
609
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
610
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
611 611
 
612 612
 		$this->display_admin_list_table_page_with_no_sidebar();
613 613
 	}
@@ -620,24 +620,24 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function toggle_checkin_status() {
622 622
 		//first make sure we have the necessary data
623
-		if ( !isset( $this->_req_data['_regid'] ) ) {
624
-			EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
623
+		if ( ! isset($this->_req_data['_regid'])) {
624
+			EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
625 625
 			$this->_template_args['success'] = FALSE;
626 626
 			$this->_template_args['error'] = TRUE;
627 627
 			$this->_return_json();
628 628
 		};
629 629
 
630 630
 		//do a nonce check cause we're not coming in from an normal route here.
631
-		$nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';
631
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';
632 632
 		$nonce_ref = 'checkin_nonce';
633 633
 
634
-		$this->_verify_nonce( $nonce, $nonce_ref );
634
+		$this->_verify_nonce($nonce, $nonce_ref);
635 635
 
636 636
 		//beautiful! Made it this far so let's get the status.
637 637
 		$new_status = $this->_toggle_checkin_status();
638 638
 
639 639
 		//setup new class to return via ajax
640
-		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;
640
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;
641 641
 		$this->_template_args['success'] = TRUE;
642 642
 		$this->_return_json();
643 643
 	}
@@ -657,32 +657,32 @@  discard block
 block discarded – undo
657 657
 		//first let's get the query args out of the way for the redirect
658 658
 		$query_args = array(
659 659
 			'action' => 'event_registrations',
660
-			'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,
661
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL
660
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,
661
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL
662 662
 			);
663 663
 		$new_status = FALSE;
664 664
 
665 665
 		// bulk action check in toggle
666
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
666
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
667 667
 			// cycle thru checkboxes
668
-			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) {
669
-				$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
668
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
669
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
670 670
 				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
671 671
 			}
672 672
 
673
-		} elseif ( isset( $this->_req_data['_regid'] ) ) {
673
+		} elseif (isset($this->_req_data['_regid'])) {
674 674
 			//coming from ajax request
675
-			$DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;
675
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;
676 676
 			$query_args['DTT_ID'] = $DTT_ID;
677 677
 			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
678 678
 		} else {
679
-			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
679
+			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
680 680
 		}
681 681
 
682
-		if ( defined('DOING_AJAX' ) )
682
+		if (defined('DOING_AJAX'))
683 683
 			return $new_status;
684 684
 
685
-		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
685
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
686 686
 
687 687
 	}
688 688
 
@@ -698,11 +698,11 @@  discard block
 block discarded – undo
698 698
 	 */
699 699
 	private function _toggle_checkin($REG_ID, $DTT_ID) {
700 700
 		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
701
-		$new_status = $REG->toggle_checkin_status( $DTT_ID );
702
-		if ( $new_status !== FALSE ) {
703
-			EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );
701
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
702
+		if ($new_status !== FALSE) {
703
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
704 704
 		} else {
705
-			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);
706 706
 			$new_status = FALSE;
707 707
 		}
708 708
 		return $new_status;
@@ -718,28 +718,28 @@  discard block
 block discarded – undo
718 718
 	protected function _delete_checkin_rows() {
719 719
 		$query_args = array(
720 720
 			'action' => 'registration_checkins',
721
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
722
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
721
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
722
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
723 723
 			);
724
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
725
-			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
724
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
725
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
726 726
 				$errors = 0;
727
-				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) {
727
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
728 728
 					$errors++;
729 729
 				}
730 730
 			}
731 731
 		} else {
732
-			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
733
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
732
+			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
733
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
734 734
 		}
735 735
 
736
-		if ( $errors > 0 ) {
737
-			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ );
736
+		if ($errors > 0) {
737
+			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__);
738 738
 		} else {
739
-			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') );
739
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
740 740
 		}
741 741
 
742
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
742
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
743 743
 	}
744 744
 
745 745
 
@@ -751,20 +751,20 @@  discard block
 block discarded – undo
751 751
 	protected function _delete_checkin_row() {
752 752
 		$query_args = array(
753 753
 			'action' => 'registration_checkins',
754
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
755
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
754
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
755
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
756 756
 			);
757 757
 
758
-		if ( !empty( $this->_req_data['CHK_ID'] ) ) {
759
-			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) {
760
-				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
758
+		if ( ! empty($this->_req_data['CHK_ID'])) {
759
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
760
+				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
761 761
 			} else {
762
-				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') );
762
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
763 763
 			}
764 764
 		} else {
765
-			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
765
+			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
766 766
 		}
767
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
767
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
768 768
 	}
769 769
 
770 770
 
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 	*		@return void
778 778
 	*/
779 779
 	protected function _event_registrations_list_table() {
780
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
781
-		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
780
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
781
+		$this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
782 782
 
783 783
 		$legend_items = array(
784 784
 			'star-icon' => array(
@@ -802,31 +802,31 @@  discard block
 block discarded – undo
802 802
 				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso')
803 803
 				),
804 804
 			'approved_status' => array(
805
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
806
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
805
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
806
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
807 807
 				),
808 808
             'cancelled_status' => array(
809
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
810
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
809
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
810
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
811 811
 				),
812 812
             'declined_status' => array(
813
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
814
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
813
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
814
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
815 815
 				),
816 816
 			'not_approved' => array(
817
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
818
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
817
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
818
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
819 819
 				),
820 820
 			'pending_status' => array(
821
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
822
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
821
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
822
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
823 823
 				)/**/
824 824
 			);
825
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
825
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
826 826
 
827
-		$event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
828
-		$this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : '';
829
-		$this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';
827
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
828
+		$this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : '';
829
+		$this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';
830 830
 
831 831
 		$this->display_admin_list_table_page_with_no_sidebar();
832 832
 	}
@@ -840,15 +840,15 @@  discard block
 block discarded – undo
840 840
 	*		@access public
841 841
 	*		@return array
842 842
 	*/
843
-	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
843
+	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') {
844 844
 
845
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
846
-		require_once(EE_MODELS . 'EEM_Attendee.model.php');
845
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
846
+		require_once(EE_MODELS.'EEM_Attendee.model.php');
847 847
 		//$ATT_MDL = EEM_Attendee::instance();
848 848
 
849
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
850
-		$CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;
851
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
849
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
850
+		$CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;
851
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
852 852
 
853 853
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
854 854
 
@@ -861,92 +861,92 @@  discard block
 block discarded – undo
861 861
 //				$orderby = 'reg.REG_final_price';
862 862
 		}
863 863
 
864
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
864
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
865 865
 
866
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
867
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
866
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
867
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
868 868
 
869 869
 
870
-		$offset = ($current_page-1)*$per_page;
871
-		$limit = $count ? NULL : array( $offset, $per_page );
872
-		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array()))));
873
-		if ($EVT_ID){
874
-			$query_params[0]['EVT_ID']=$EVT_ID;
870
+		$offset = ($current_page - 1) * $per_page;
871
+		$limit = $count ? NULL : array($offset, $per_page);
872
+		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array()))));
873
+		if ($EVT_ID) {
874
+			$query_params[0]['EVT_ID'] = $EVT_ID;
875 875
 		}
876
-		if($CAT_ID){
876
+		if ($CAT_ID) {
877 877
 			throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?");
878 878
 		}
879 879
 
880 880
 		//if DTT is included we do multiple datetimes.
881
-		if ( $DTT_ID ) {
881
+		if ($DTT_ID) {
882 882
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
883 883
 			$query_params['default_where_conditions'] = 'this_model_only';
884 884
 		}
885 885
 
886
-		$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 ) );
886
+		$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));
887 887
 
888
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
888
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
889 889
 
890
-		if($trash){
891
-			$query_params[0]['Attendee.status']=  EEM_CPT_Base::post_status_trashed;
890
+		if ($trash) {
891
+			$query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;
892 892
 		}
893 893
 
894
-		if ( isset( $this->_req_data['s'] ) ) {
895
-			$sstr = '%' . $this->_req_data['s'] . '%';
894
+		if (isset($this->_req_data['s'])) {
895
+			$sstr = '%'.$this->_req_data['s'].'%';
896 896
 			$query_params[0]['OR'] = array(
897
-				'Event.EVT_name' => array( 'LIKE', $sstr),
898
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
899
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
900
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
901
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
902
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
903
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
904
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
905
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
906
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
907
-				'REG_final_price' => array( 'LIKE', $sstr ),
908
-				'REG_code' => array( 'LIKE', $sstr ),
909
-				'REG_count' => array( 'LIKE' , $sstr ),
910
-				'REG_group_size' => array( 'LIKE' , $sstr ),
911
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
912
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
897
+				'Event.EVT_name' => array('LIKE', $sstr),
898
+				'Event.EVT_desc' => array('LIKE', $sstr),
899
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
900
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
901
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
902
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
903
+				'Attendee.ATT_email' => array('LIKE', $sstr),
904
+				'Attendee.ATT_address' => array('LIKE', $sstr),
905
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
906
+				'Attendee.ATT_city' => array('LIKE', $sstr),
907
+				'REG_final_price' => array('LIKE', $sstr),
908
+				'REG_code' => array('LIKE', $sstr),
909
+				'REG_count' => array('LIKE', $sstr),
910
+				'REG_group_size' => array('LIKE', $sstr),
911
+				'Ticket.TKT_name' => array('LIKE', $sstr),
912
+				'Ticket.TKT_description' => array('LIKE', $sstr)
913 913
 				);
914 914
 		}
915 915
 
916 916
 		$query_params['order_by'][$orderby] = $sort;
917 917
 		$query_params['limit'] = $limit;
918
-		$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
-		if($count){
918
+		$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
+		if ($count) {
920 920
 			$registrations = EEM_Registration::instance()->count(array($query_params[0]));
921
-		}else{
921
+		} else {
922 922
 			$registrations = EEM_Registration::instance()->get_all($query_params);
923 923
 
924 924
 
925 925
 	//		$registrations = EEM_Registration::instance();
926 926
 	//		$all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );
927
-			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) {
927
+			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) {
928 928
 				//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' );
929 929
 				// name
930 930
 				$first_registration = $registrations[0];
931 931
 				$event_obj = $first_registration->event_obj();
932
-				if($event_obj){
932
+				if ($event_obj) {
933 933
 					$event_name = $first_registration->event_obj()->name();
934
-					$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 ) : '';
934
+					$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 ) : '';
935 935
 					// edit event link
936
-					if ( $event_name != '' ) {
937
-						$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
938
-						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
939
-						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
936
+					if ($event_name != '') {
937
+						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
938
+						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
939
+						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
940 940
 					}
941 941
 
942
-					$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
943
-					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
942
+					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
943
+					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
944 944
 
945 945
 					$this->_template_args['before_admin_page_content'] = '
946 946
 				<div id="admin-page-header">
947
-					<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
948
-					<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
949
-					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
947
+					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
948
+					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
949
+					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
950 950
 				</div>
951 951
 				';
952 952
 				}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -679,8 +680,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
admin/extend/transactions/Extend_Transactions_Admin_Page.core.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.