Completed
Branch BUG-9581-untranslatable-error-... (6b7c51)
by
unknown
544:01 queued 528:59
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
 			);
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	public function admin_init() {
225
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
226
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
227
-		EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' );
228
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
229
-		EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol );
225
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
226
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
227
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso');
228
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
229
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol);
230 230
 	}
231 231
 
232 232
 	public function admin_notices() {}
@@ -239,21 +239,21 @@  discard block
 block discarded – undo
239 239
 		//scripts
240 240
 		wp_enqueue_script('media-upload');
241 241
 		wp_enqueue_script('thickbox');
242
-		wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );
243
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
244
-		wp_enqueue_script( 'organization_settings' );
245
-		wp_enqueue_style( 'organization-css' );
246
-		$confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
-		wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );
242
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE);
243
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
244
+		wp_enqueue_script('organization_settings');
245
+		wp_enqueue_style('organization-css');
246
+		$confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
248 248
 
249 249
 	}
250 250
 
251 251
 	public function load_scripts_styles_country_settings() {
252 252
 		//scripts
253
-		wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );
254
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
255
-		wp_enqueue_script( 'gen_settings_countries' );
256
-		wp_enqueue_style( 'organization-css' );
253
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
254
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
255
+		wp_enqueue_script('gen_settings_countries');
256
+		wp_enqueue_style('organization-css');
257 257
 
258 258
 	}
259 259
 
@@ -265,37 +265,37 @@  discard block
 block discarded – undo
265 265
 
266 266
 		// Check to make sure all of the main pages are setup properly,
267 267
 		// if not create the default pages and display an admin notice
268
-		EE_Registry::instance()->load_helper( 'Activation' );
268
+		EE_Registry::instance()->load_helper('Activation');
269 269
 		EEH_Activation::verify_default_pages_exist();
270 270
 
271 271
 		$this->_transient_garbage_collection();
272 272
 		$this->_template_args['values'] = $this->_yes_no_values;
273 273
 
274
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
275
-		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;
274
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL;
275
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;
276 276
 
277
-		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
278
-		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;
277
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL;
278
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;
279 279
 
280
-		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
281
-		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;
280
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
281
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;
282 282
 
283
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
284
-		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;
283
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
284
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;
285 285
 
286
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
287
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
288
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
286
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
287
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
288
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
289 289
 		$this->display_admin_page_with_sidebar();
290 290
 
291 291
 	}
292 292
 
293 293
 	protected function _update_espresso_page_settings() {
294 294
 		// capture incoming request data
295
-		$reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;
296
-		$txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;
297
-		$thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;
298
-		$cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;
295
+		$reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
296
+		$txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
297
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
298
+		$cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
299 299
 		// pack critical_pages into an array
300 300
 		$critical_pages = array(
301 301
 			'reg_page_id' 				=> $reg_page_id,
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
 			'thank_you_page_id' 	=> $thank_you_page_id,
304 304
 			'cancel_page_id' 		=> $cancel_page_id
305 305
 		);
306
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
306
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
307 307
 			// has the page changed ?
308
-			if ( EE_Registry::instance()->CFG->core->{$critical_page_name} != $critical_page_id ) {
308
+			if (EE_Registry::instance()->CFG->core->{$critical_page_name} != $critical_page_id) {
309 309
 				// grab post object for old page
310
-				$post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} );
310
+				$post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} );
311 311
 				// update post shortcodes for old page
312
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
312
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
313 313
 				// grab post object for new page
314
-				$post = get_post( $critical_page_id );
314
+				$post = get_post($critical_page_id);
315 315
 				// update post shortcodes for new page
316
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
316
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
317 317
 			}
318 318
 		}
319 319
 		// set page IDs
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
323 323
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
324 324
 
325
-		EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );
325
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
326 326
 
327 327
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
328
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
328
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
329 329
 		$query_args = array(
330 330
 			'action' => 'critical_pages'
331 331
 			);
332
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
332
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
333 333
 
334 334
 	}
335 335
 
@@ -344,35 +344,35 @@  discard block
 block discarded – undo
344 344
 
345 345
 	protected function _your_organization_settings() {
346 346
 
347
-		$this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';
348
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
349
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
350
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
351
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
352
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
353
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
354
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
355
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
356
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
357
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
358
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
359
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
360
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
361
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
362
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
363
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
347
+		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
348
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
349
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
350
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
351
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
352
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
353
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
354
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
355
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
356
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
357
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
358
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
359
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
360
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
361
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
362
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
363
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
364 364
 		//UXIP settings
365
-		$this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;
365
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE;
366 366
 
367
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
368
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
367
+		EE_Registry::instance()->load_helper('Form_Fields');
368
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
369 369
 		$this->_template_args['states'] = new EE_Question_Form_Input(
370
-				EE_Question::new_instance ( array(
370
+				EE_Question::new_instance(array(
371 371
 					'QST_ID'=> 0,
372 372
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
373 373
 					'QST_system'=>'admin-state'
374 374
 				)),
375
-				EE_Answer::new_instance ( array(
375
+				EE_Answer::new_instance(array(
376 376
 					'ANS_ID' => 0,
377 377
 					'ANS_value' => $STA_ID
378 378
 				)),
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 				)
385 385
 			);
386 386
 
387
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
387
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
388 388
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
389
-				EE_Question::new_instance ( array(
389
+				EE_Question::new_instance(array(
390 390
 					'QST_ID'=> 0,
391 391
 					'QST_display_text'=> __('Country', 'event_espresso'),
392 392
 					'QST_system'=>'admin-country'
393 393
 				)),
394
-				EE_Answer::new_instance ( array(
394
+				EE_Answer::new_instance(array(
395 395
 					'ANS_ID' => 0,
396 396
 					'ANS_value' => $CNT_ISO
397 397
 				)),
@@ -403,51 +403,51 @@  discard block
 block discarded – undo
403 403
 				)
404 404
 			);
405 405
 
406
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
407
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
406
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
407
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
408 408
 
409 409
 		//PUE verification stuff
410
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
411
-		$verify_fail = get_option( $ver_option_key );
412
-		$this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
410
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
411
+		$verify_fail = get_option($ver_option_key);
412
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
413 413
 
414
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
415
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
416
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
414
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
415
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
416
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
417 417
 
418 418
 		$this->display_admin_page_with_sidebar();
419 419
 	}
420 420
 
421 421
 	protected function _update_your_organization_settings() {
422
-		if ( is_main_site() )
423
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
424
-		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
425
-		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
426
-		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
427
-		EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city;
428
-		EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID;
429
-		EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO;
430
-		EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip;
431
-		EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email;
432
-		EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat;
433
-		EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone;
434
-		EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url;
435
-		EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook;
436
-		EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter;
437
-		EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin;
438
-		EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest;
439
-		EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google;
440
-		EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram;
441
-		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
442
-
443
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
444
-
445
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
422
+		if (is_main_site())
423
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
424
+		EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
425
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
426
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
427
+		EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
428
+		EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
429
+		EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
430
+		EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
431
+		EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
432
+		EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
433
+		EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
434
+		EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
435
+		EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
436
+		EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
437
+		EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
438
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
439
+		EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
440
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
441
+		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
442
+
443
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
444
+
445
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
446 446
 
447 447
 		$what = 'Your Organization Settings';
448
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
448
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
449 449
 
450
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
450
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
451 451
 
452 452
 	}
453 453
 
@@ -458,36 +458,36 @@  discard block
 block discarded – undo
458 458
 	protected function _admin_option_settings() {
459 459
 
460 460
 		$this->_template_args['values'] = $this->_yes_no_values;
461
-		$this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE;
462
-		$this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE;
463
-		$this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30;
464
-		$this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE;
465
-		$this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE;
466
-		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
467
-		$this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1;
468
-
469
-		$this->_set_add_edit_form_tags( 'update_admin_option_settings' );
470
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
461
+		$this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE;
462
+		$this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE;
463
+		$this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30;
464
+		$this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE;
465
+		$this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE;
466
+		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
467
+		$this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1;
468
+
469
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
470
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
471 471
 		$this->_template_args['template_args'] = $this->_template_args;
472
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );
472
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);
473 473
 		$this->display_admin_page_with_sidebar();
474 474
 	}
475 475
 
476 476
 	protected function _update_admin_option_settings() {
477
-		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
478
-		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
479
-		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
480
-		EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones;
481
-		EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer;
482
-		EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id;
483
-		EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation;
477
+		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
478
+		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
479
+		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
480
+		EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones;
481
+		EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer;
482
+		EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id;
483
+		EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation;
484 484
 
485
-		EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );
485
+		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin);
486 486
 
487 487
 		$what = 'Admin Options';
488
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );
489
-		$success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );
490
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );
488
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);
489
+		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success);
490
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings'));
491 491
 
492 492
 	}
493 493
 
@@ -500,21 +500,21 @@  discard block
 block discarded – undo
500 500
 
501 501
 	protected function _country_settings() {
502 502
 
503
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
504
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
503
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
504
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
505 505
 
506 506
 		//load field generator helper
507
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
507
+		EE_Registry::instance()->load_helper('Form_Fields');
508 508
 
509 509
 		$this->_template_args['values'] = $this->_yes_no_values;
510 510
 
511 511
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
512
-				EE_Question::new_instance ( array(
512
+				EE_Question::new_instance(array(
513 513
 					'QST_ID'=> 0,
514 514
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
515 515
 					'QST_system'=>'admin-country'
516 516
 				)),
517
-				EE_Answer::new_instance ( array(
517
+				EE_Answer::new_instance(array(
518 518
 					'ANS_ID' => 0,
519 519
 					'ANS_value' => $CNT_ISO
520 520
 				)),
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 			);
528 528
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
529 529
 
530
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
531
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
530
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
531
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
532 532
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
533 533
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
534 534
 
535
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
536
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
537
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
535
+		$this->_set_add_edit_form_tags('update_country_settings');
536
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
537
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
538 538
 		$this->display_admin_page_with_no_sidebar();
539 539
 	}
540 540
 
@@ -547,44 +547,44 @@  discard block
 block discarded – undo
547 547
 	 * 		@param 	string 		$CNT_ISO
548 548
 	 * 		@return 		mixed		string | array
549 549
 	 */
550
-	public function display_country_settings( $CNT_ISO = '' ) {
550
+	public function display_country_settings($CNT_ISO = '') {
551 551
 
552
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
553
-		if ( ! $CNT_ISO ) {
552
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
553
+		if ( ! $CNT_ISO) {
554 554
 			return '';
555 555
 		}
556 556
 
557 557
 		// for ajax
558
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
559
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
560
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
561
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
562
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
563
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
558
+		EE_Registry::instance()->load_helper('Form_Fields');
559
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
560
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
561
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
562
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
563
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
564 564
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
565 565
 		$country_input_types = array(
566
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
567
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
568
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
569
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
570
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
571
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
572
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
573
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
574
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
575
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
576
-			'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))),
577
-			'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
578
-			'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
579
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
580
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
566
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
567
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
568
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
569
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
570
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
571
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
572
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
573
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
574
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
575
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
576
+			'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))),
577
+			'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
578
+			'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
579
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
580
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
581 581
 		);
582
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
583
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
582
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
583
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
584 584
 
585
-		if ( defined( 'DOING_AJAX' )) {
586
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
587
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
585
+		if (defined('DOING_AJAX')) {
586
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
587
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
588 588
 			die();
589 589
 		} else {
590 590
 			return $country_details_settings;
@@ -602,50 +602,50 @@  discard block
 block discarded – undo
602 602
 	 * 		@param 	string 		$CNT_ISO
603 603
 	 * 		@return 		string
604 604
 	 */
605
-	public function display_country_states( $CNT_ISO = '' ) {
605
+	public function display_country_states($CNT_ISO = '') {
606 606
 
607
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
607
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
608 608
 
609
-		if ( ! $CNT_ISO ) {
609
+		if ( ! $CNT_ISO) {
610 610
 			return '';
611 611
 		}
612 612
 		// for ajax
613
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
614
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
615
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
616
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
617
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
618
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
613
+		EE_Registry::instance()->load_helper('Form_Fields');
614
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
615
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
616
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
617
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
618
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
619 619
 
620 620
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
621 621
 //			global $wpdb;
622 622
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
623 623
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
624
-		if ( $states ) {
625
-			foreach ( $states as $STA_ID => $state ) {
626
-				if ( $state instanceof EE_State ) {
624
+		if ($states) {
625
+			foreach ($states as $STA_ID => $state) {
626
+				if ($state instanceof EE_State) {
627 627
 					//STA_abbrev 	STA_name 	STA_active
628 628
 					$state_input_types = array(
629
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
630
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
631
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
629
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
630
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
631
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
632 632
 					);
633
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
634
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
635
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
633
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
634
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
635
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
636 636
 				}
637 637
 			}
638 638
 		} else {
639 639
 			$this->_template_args['states'] = FALSE;
640 640
 		}
641 641
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
642
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
642
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
643 643
 
644
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
644
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
645 645
 
646
-		if ( defined( 'DOING_AJAX' )) {
647
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
648
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
646
+		if (defined('DOING_AJAX')) {
647
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
648
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
649 649
 			die();
650 650
 		} else {
651 651
 			return $state_details_settings;
@@ -666,40 +666,39 @@  discard block
 block discarded – undo
666 666
 
667 667
 		$success = TRUE;
668 668
 
669
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
670
-		if ( ! $CNT_ISO ) {
671
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
669
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
670
+		if ( ! $CNT_ISO) {
671
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
672 672
 			$success = FALSE;
673 673
 		}
674
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
675
-		if ( ! $STA_abbrev ) {
676
-			EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
674
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
675
+		if ( ! $STA_abbrev) {
676
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
677 677
 			$success = FALSE;
678 678
 		}
679
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
680
-			FALSE;
681
-		if ( ! $STA_name ) {
682
-			EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
679
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE;
680
+		if ( ! $STA_name) {
681
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
683 682
 			$success = FALSE;
684 683
 		}
685 684
 
686
-		if ( $success ) {
685
+		if ($success) {
687 686
 			$cols_n_values = array(
688 687
 				'CNT_ISO' => $CNT_ISO,
689 688
 				'STA_abbrev' => $STA_abbrev,
690 689
 				'STA_name' => $STA_name,
691 690
 				'STA_active' => TRUE
692 691
 			);
693
-			$success = EEM_State::instance()->insert ( $cols_n_values );
694
-			EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) );
692
+			$success = EEM_State::instance()->insert($cols_n_values);
693
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
695 694
 		}
696 695
 
697
-		if ( defined( 'DOING_AJAX' )) {
698
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
699
-			echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) );
696
+		if (defined('DOING_AJAX')) {
697
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
698
+			echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
700 699
 			die();
701 700
 		} else {
702
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
701
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
703 702
 		}
704 703
 	}
705 704
 
@@ -712,25 +711,25 @@  discard block
 block discarded – undo
712 711
 	 * 		@return 		boolean | void
713 712
 	 */
714 713
 	public function delete_state() {
715
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
716
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
717
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
718
-		if ( ! $STA_ID ) {
719
-			EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
714
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
715
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
716
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
717
+		if ( ! $STA_ID) {
718
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
720 719
 			return FALSE;
721 720
 		}
722
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
723
-		if ( $success !== FALSE ) {
724
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
725
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
721
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
722
+		if ($success !== FALSE) {
723
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
724
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
726 725
 		}
727
-		if ( defined( 'DOING_AJAX' )) {
728
-			$notices = EE_Error::get_notices( FALSE, FALSE );
726
+		if (defined('DOING_AJAX')) {
727
+			$notices = EE_Error::get_notices(FALSE, FALSE);
729 728
 			$notices['return_data'] = TRUE;
730
-			echo json_encode( $notices );
729
+			echo json_encode($notices);
731 730
 			die();
732 731
 		} else {
733
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
732
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
734 733
 		}
735 734
 	}
736 735
 
@@ -746,63 +745,63 @@  discard block
 block discarded – undo
746 745
 	protected function _update_country_settings() {
747 746
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
748 747
 		// grab the country ISO code
749
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
750
-		if ( ! $CNT_ISO ) {
751
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
748
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
749
+		if ( ! $CNT_ISO) {
750
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
752 751
 			return;
753 752
 		}
754 753
 		$cols_n_values = array();
755
-		$cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE;
756
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
757
-		$cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL;
758
-		$cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD';
759
-		$cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar';
760
-		$cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars';
761
-		$cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$';
762
-		$cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE;
763
-		$cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2;
764
-		$cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.';
765
-		$cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ',';
766
-		$cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL;
767
-		$cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE;
768
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
754
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE;
755
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
756
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL;
757
+		$cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
758
+		$cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
759
+		$cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
760
+		$cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
761
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE;
762
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
763
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
764
+		$cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
765
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL;
766
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE;
767
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
769 768
 		// allow filtering of country data
770
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
769
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
771 770
 		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
772 771
 		// where values
773
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
772
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
774 773
 		// run the update
775
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
774
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
776 775
 //		global $wpdb;
777 776
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
778 777
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
779
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
778
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
780 779
 			// allow filtering of states data
781
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
780
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
782 781
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
783 782
 			// loop thru state data ( looks like : states[75][STA_name] )
784
-			foreach( $states as $STA_ID => $state ) {
783
+			foreach ($states as $STA_ID => $state) {
785 784
 				$cols_n_values = array(
786 785
 					'CNT_ISO' 		=> $CNT_ISO,
787
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
788
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
789
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
786
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
787
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
788
+					'STA_active' 	=> (bool) absint($state['STA_active'])
790 789
 				);
791 790
 				// where values
792
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
791
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
793 792
 				// run the update
794
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
795
-				if ( $success !== FALSE ) {
796
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
793
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
794
+				if ($success !== FALSE) {
795
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
797 796
 				}
798 797
 			}
799 798
 		}
800 799
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
801
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
802
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
800
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
801
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
803 802
 			EE_Registry::instance()->CFG->update_espresso_config();
804 803
 		}
805
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
804
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
806 805
 	}
807 806
 
808 807
 
@@ -816,11 +815,11 @@  discard block
 block discarded – undo
816 815
 	 * 		@param 		string 		$label
817 816
 	 * 		@return 		string
818 817
 	 */
819
-	public function country_form_field_label_wrap( $label, $required_text ) {
818
+	public function country_form_field_label_wrap($label, $required_text) {
820 819
 		return '
821 820
 			<tr>
822 821
 				<th>
823
-					' . $label  . '
822
+					' . $label.'
824 823
 				</th>';
825 824
 	}
826 825
 
@@ -834,10 +833,10 @@  discard block
 block discarded – undo
834 833
 	 * 		@param 		string 		$label
835 834
 	 * 		@return 		string
836 835
 	 */
837
-	public function country_form_field_input__wrap( $input, $label ) {
836
+	public function country_form_field_input__wrap($input, $label) {
838 837
 		return '
839 838
 				<td class="general-settings-country-input-td">
840
-					' . $input . '
839
+					' . $input.'
841 840
 				</td>
842 841
 			</tr>';
843 842
 	}
@@ -853,7 +852,7 @@  discard block
 block discarded – undo
853 852
 	 * 		@param 		string 		$required_text
854 853
 	 * 		@return 		string
855 854
 	 */
856
-	public function state_form_field_label_wrap( $label, $required_text  ) {
855
+	public function state_form_field_label_wrap($label, $required_text) {
857 856
 		return $required_text;
858 857
 	}
859 858
 
@@ -867,10 +866,10 @@  discard block
 block discarded – undo
867 866
 	 * 		@param 		string 		$label
868 867
 	 * 		@return 		string
869 868
 	 */
870
-	public function state_form_field_input__wrap( $input, $label ) {
869
+	public function state_form_field_input__wrap($input, $label) {
871 870
 		return '
872 871
 				<td class="general-settings-country-state-input-td">
873
-					' . $input . '
872
+					' . $input.'
874 873
 				</td>';
875 874
 
876 875
 	}
@@ -893,10 +892,10 @@  discard block
 block discarded – undo
893 892
 	 * @param int $ee_page_id
894 893
 	 * @return string
895 894
 	 */
896
-	public static function edit_view_links( $ee_page_id ) {
897
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
895
+	public static function edit_view_links($ee_page_id) {
896
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
898 897
 		$links .= ' &nbsp;|&nbsp; ';
899
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
898
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
900 899
 		return $links;
901 900
 	}
902 901
 
@@ -909,27 +908,27 @@  discard block
 block discarded – undo
909 908
 	 * @param WP page object $ee_page
910 909
 	 * @return string
911 910
 	 */
912
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
911
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
913 912
 
914 913
 		// page status
915
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
914
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
916 915
 			$pg_colour = 'green';
917
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
916
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
918 917
 		 } else {
919 918
 			$pg_colour = 'red';
920
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
919
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
921 920
 		}
922 921
 
923 922
 		// shortcode status
924
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
923
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
925 924
 			$sc_colour = 'green';
926
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
925
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
927 926
 		 } else {
928 927
 			$sc_colour = 'red';
929
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
928
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
930 929
 		}
931 930
 
932
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
931
+		return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
933 932
 
934 933
 	}
935 934
 
@@ -944,20 +943,20 @@  discard block
 block discarded – undo
944 943
 	 * @param unknown_type $level
945 944
 	 * @return unknown
946 945
 	 */
947
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
946
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
948 947
 		global $wpdb;
949
-		$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) );
948
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent));
950 949
 
951
-		if ( $items ) {
952
-			foreach ( $items as $item ) {
953
-				$pad = str_repeat( '&nbsp;', $level * 3 );
954
-				if ( $item->ID == $default)
950
+		if ($items) {
951
+			foreach ($items as $item) {
952
+				$pad = str_repeat('&nbsp;', $level * 3);
953
+				if ($item->ID == $default)
955 954
 					$current = ' selected="selected"';
956 955
 				else
957 956
 					$current = '';
958 957
 
959
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
960
-				parent_dropdown( $default, $item->ID, $level +1 );
958
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
959
+				parent_dropdown($default, $item->ID, $level + 1);
961 960
 			}
962 961
 		} else {
963 962
 			return false;
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.
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.
Indentation   +23 added lines, -23 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
 				)
@@ -1564,14 +1564,14 @@  discard block
 block discarded – undo
1564 1564
 
1565 1565
 
1566 1566
 	/**
1567
-     * This returns the shortcode selector skeleton for a given context and field.
1568
-     *
1569
-     * @since 4.9.rc.000
1570
-     *
1567
+	 * This returns the shortcode selector skeleton for a given context and field.
1568
+	 *
1569
+	 * @since 4.9.rc.000
1570
+	 *
1571 1571
 	 * @param string $field  The name of the field retrieving shortcodes for.
1572
-     * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1573
-     * @return string
1574
-    */
1572
+	 * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1573
+	 * @return string
1574
+	 */
1575 1575
 	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1576 1576
 		$template_args = array(
1577 1577
 			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
@@ -2111,9 +2111,9 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
 	/**
2113 2113
 	 * 	_learn_more_about_message_templates_link
2114
-	*	@access protected
2115
-	*	@return string
2116
-	*/
2114
+	 *	@access protected
2115
+	 *	@return string
2116
+	 */
2117 2117
 	protected function _learn_more_about_message_templates_link() {
2118 2118
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2119 2119
 	}
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(
@@ -479,43 +479,43 @@  discard block
 block discarded – undo
479 479
 
480 480
 
481 481
 	public function messages_help_tab() {
482
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
483
-		EEH_Template::display_template( $templatepath, array());
482
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
483
+		EEH_Template::display_template($templatepath, array());
484 484
 	}
485 485
 
486 486
 
487 487
 	public function messengers_help_tab() {
488
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
489
-		EEH_Template::display_template( $templatepath, array());
488
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
489
+		EEH_Template::display_template($templatepath, array());
490 490
 	}
491 491
 
492 492
 
493 493
 	public function message_types_help_tab() {
494
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
495
-		EEH_Template::display_template( $templatepath, array());
494
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
495
+		EEH_Template::display_template($templatepath, array());
496 496
 	}
497 497
 
498 498
 
499 499
 	public function messages_overview_help_tab() {
500
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
501
-		EEH_Template::display_template( $templatepath, array());
500
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
501
+		EEH_Template::display_template($templatepath, array());
502 502
 	}
503 503
 
504 504
 
505 505
 	public function message_templates_help_tab() {
506
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
507
-		EEH_Template::display_template( $templatepath, array());
506
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
507
+		EEH_Template::display_template($templatepath, array());
508 508
 	}
509 509
 
510 510
 
511 511
 	public function edit_message_template_help_tab() {
512
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
513
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
514
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
515
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
516
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
517
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
518
-		EEH_Template::display_template( $templatepath, $args);
512
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
513
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
514
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
515
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
516
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
517
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
518
+		EEH_Template::display_template($templatepath, $args);
519 519
 	}
520 520
 
521 521
 
@@ -523,25 +523,25 @@  discard block
 block discarded – undo
523 523
 	public function message_template_shortcodes_help_tab() {
524 524
 		$this->_set_shortcodes();
525 525
 		$args['shortcodes'] = $this->_shortcodes;
526
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
527
-		EEH_Template::display_template( $template_path, $args );
526
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
527
+		EEH_Template::display_template($template_path, $args);
528 528
 	}
529 529
 
530 530
 
531 531
 
532 532
 	public function preview_message_help_tab() {
533
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
534
-		EEH_Template::display_template( $templatepath, array());
533
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
534
+		EEH_Template::display_template($templatepath, array());
535 535
 	}
536 536
 
537 537
 
538 538
 	public function settings_help_tab() {
539
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
540
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
541
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
539
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
540
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
541
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
542 542
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
543 543
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
544
-		EEH_Template::display_template( $templatepath, $args);
544
+		EEH_Template::display_template($templatepath, $args);
545 545
 	}
546 546
 
547 547
 
@@ -549,24 +549,24 @@  discard block
 block discarded – undo
549 549
 
550 550
 
551 551
 	public function load_scripts_styles() {
552
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
552
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
553 553
 		wp_enqueue_style('espresso_ee_msg');
554 554
 
555
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE );
555
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
556 556
 	}
557 557
 
558 558
 
559 559
 
560 560
 
561 561
 
562
-	public function wp_editor_css( $mce_css ) {
562
+	public function wp_editor_css($mce_css) {
563 563
 		//if we're on the edit_message_template route
564
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
564
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
565 565
 			$message_type_name = $this->_active_message_type_name;
566 566
 
567 567
 			//we're going to REPLACE the existing mce css
568 568
 			//we need to get the css file location from the active messenger
569
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
569
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
570 570
 		}
571 571
 
572 572
 		return $mce_css;
@@ -584,37 +584,37 @@  discard block
 block discarded – undo
584 584
 			$this->_message_template_group->messenger_obj()->label['singular'],
585 585
 			$this->_message_template_group->message_type_obj()->label['singular']
586 586
 		);
587
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
587
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
588 588
 
589
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
589
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
590 590
 
591 591
 		wp_enqueue_script('ee_admin_js');
592 592
 		wp_enqueue_script('ee_msgs_edit_js');
593 593
 
594 594
 		//add in special css for tiny_mce
595
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
595
+		add_filter('mce_css', array($this, 'wp_editor_css'));
596 596
 	}
597 597
 
598 598
 
599 599
 
600 600
 	public function load_scripts_styles_display_preview_message() {
601 601
 		$this->_set_message_template_group();
602
-		if ( isset( $this->_req_data['messenger'] ) ) {
602
+		if (isset($this->_req_data['messenger'])) {
603 603
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
604 604
 		}
605 605
 
606
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
606
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
607 607
 
608 608
 
609
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
609
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
610 610
 	}
611 611
 
612 612
 
613 613
 
614 614
 	public function load_scripts_styles_settings() {
615
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
616
-		wp_enqueue_style( 'ee-text-links' );
617
-		wp_enqueue_style( 'ee-message-settings' );
615
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
616
+		wp_enqueue_style('ee-text-links');
617
+		wp_enqueue_style('ee-message-settings');
618 618
 
619 619
 		wp_enqueue_script('ee-messages-settings');
620 620
 	}
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 
651 651
 	protected function _custom_mtps_preview() {
652 652
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
653
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
653
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
654 654
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
655
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
655
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
656 656
 	}
657 657
 
658 658
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @param bool $global whether to return just global (true) or custom templates (false)
675 675
 	 * @return array|WP_Error object
676 676
 	 */
677
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
677
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
678 678
 		global $espresso_wp_user;
679 679
 		// start with an empty array
680 680
 		$message_templates = array();
@@ -684,24 +684,24 @@  discard block
 block discarded – undo
684 684
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
685 685
 		$orderby = $this->_req_data['orderby'];
686 686
 
687
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
687
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
688 688
 
689
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
690
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
689
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
690
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
691 691
 
692
-		$offset = ($current_page-1)*$per_page;
693
-		$limit = $all ? NULL : array( $offset, $per_page );
692
+		$offset = ($current_page - 1) * $per_page;
693
+		$limit = $all ? NULL : array($offset, $per_page);
694 694
 
695 695
 
696 696
 		//options will match what is in the _views array property
697
-		switch( $type ) {
697
+		switch ($type) {
698 698
 
699 699
 			case 'in_use':
700
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
700
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
701 701
 				break;
702 702
 
703 703
 			default:
704
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
704
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
705 705
 
706 706
 		}
707 707
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		$imts = $installed_objects['message_types'];
738 738
 		$installed = array();
739 739
 
740
-		foreach ( $imts as $message_type ) {
740
+		foreach ($imts as $message_type) {
741 741
 			$installed[$message_type->name]['obj'] = $message_type;
742 742
 		}
743 743
 
@@ -769,24 +769,24 @@  discard block
 block discarded – undo
769 769
 	 * @access  protected
770 770
 	 * @return void
771 771
 	 */
772
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
772
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
773 773
 		//set values override any request data
774
-		$message_type = !empty( $message_type ) ? $message_type : '';
775
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
774
+		$message_type = ! empty($message_type) ? $message_type : '';
775
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
776 776
 
777
-		$messenger = !empty( $messenger ) ? $messenger : '';
778
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
777
+		$messenger = ! empty($messenger) ? $messenger : '';
778
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
779 779
 
780
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
781
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
780
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
781
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
782 782
 
783 783
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
784
-		if ( empty( $message_type ) || empty( $messenger )  )
784
+		if (empty($message_type) || empty($messenger))
785 785
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
786 786
 
787 787
 		//we need the GRP_ID for the template being used as the base for the new template
788
-		if ( empty( $GRP_ID ) )
789
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
788
+		if (empty($GRP_ID))
789
+			throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso'));
790 790
 
791 791
 		//let's just make sure the template gets generated!
792 792
 
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
 	 * @param string $messenger    messenger slug
806 806
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
807 807
 	 */
808
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
809
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
808
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
809
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
810 810
 	}
811 811
 
812 812
 
@@ -817,36 +817,36 @@  discard block
 block discarded – undo
817 817
 	 * @return void
818 818
 	 */
819 819
 	protected function _edit_message_template() {
820
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
820
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
821 821
 
822 822
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
823
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
823
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
824 824
 
825
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
825
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
826 826
 
827 827
 		$this->_set_shortcodes(); //this also sets the _message_template property.
828 828
 		$message_template_group = $this->_message_template_group;
829 829
 		$c_label = $message_template_group->context_label();
830 830
 		$c_config = $message_template_group->contexts_config();
831 831
 
832
-		reset( $c_config );
833
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
832
+		reset($c_config);
833
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
834 834
 
835 835
 
836
-		if ( empty($GRP_ID) ) {
836
+		if (empty($GRP_ID)) {
837 837
 			$action = 'insert_message_template';
838 838
 			$button_both = FALSE;
839
-			$button_text = array( __( 'Save','event_espresso') );
839
+			$button_text = array(__('Save', 'event_espresso'));
840 840
 			$button_actions = array('something_different');
841 841
 			$referrer = FALSE;
842
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
842
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
843 843
 		} else {
844 844
 			$action = 'update_message_template';
845 845
 			$button_both = TRUE;
846 846
 			$button_text = array();
847 847
 			$button_actions = array();
848 848
 			$referrer = $this->_admin_base_url;
849
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
849
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
850 850
 		}
851 851
 
852 852
 		//set active messenger for this view
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 
857 857
 		//Do we have any validation errors?
858 858
 		$validators = $this->_get_transient();
859
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
859
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
860 860
 
861 861
 
862 862
 		//we need to assemble the title from Various details
863
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
863
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
864 864
 
865
-		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label );
865
+		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label);
866 866
 
867 867
 		$this->_template_args['GRP_ID'] = $GRP_ID;
868 868
 		$this->_template_args['message_template'] = $message_template_group;
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 		$MSG = new EE_messages();
874 874
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
875 875
 
876
-		if ( !$template_field_structure ) {
876
+		if ( ! $template_field_structure) {
877 877
 			$template_field_structure = FALSE;
878 878
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
879 879
 		}
@@ -883,38 +883,38 @@  discard block
 block discarded – undo
883 883
 
884 884
 
885 885
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
886
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
887
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
888
-				unset( $template_field_structure[$context][$reference_field] );
886
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
887
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
888
+				unset($template_field_structure[$context][$reference_field]);
889 889
 			}
890 890
 		}
891 891
 
892 892
 		//let's loop through the template_field_structure and actually assemble the input fields!
893
-		if ( !empty($template_field_structure) ) {
894
-			$id_prefix= 'ee-msg-edit-template-fields-';
895
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
893
+		if ( ! empty($template_field_structure)) {
894
+			$id_prefix = 'ee-msg-edit-template-fields-';
895
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
896 896
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
897
-				if ( $template_field == 'extra' ) {
897
+				if ($template_field == 'extra') {
898 898
 					$this->_template_args['is_extra_fields'] = TRUE;
899
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
900
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
899
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
900
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
901 901
 							//let's verify if we need this extra field via the shortcodes parameter.
902 902
 							$continue = FALSE;
903
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
904
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
905
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
903
+							if (isset($extra_array['shortcodes_required'])) {
904
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
905
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
906 906
 										$continue = TRUE;
907 907
 								}
908
-								if ( $continue ) continue;
908
+								if ($continue) continue;
909 909
 							}
910 910
 
911
-							$field_id = $reference_field . '-' . $extra_field . '-content';
911
+							$field_id = $reference_field.'-'.$extra_field.'-content';
912 912
 							$template_form_fields[$field_id] = $extra_array;
913
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
914
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
915
-							$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;
913
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
914
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
915
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;
916 916
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
917
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
917
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
918 918
 
919 919
 							//do we have a validation error?  if we do then let's use that value instead
920 920
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -924,32 +924,32 @@  discard block
 block discarded – undo
924 924
 
925 925
 							//shortcode selector
926 926
 							$field_name_to_use = $extra_field == 'main' ? 'content' : $extra_field;
927
-							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $field_name_to_use, $field_id );
927
+							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($field_name_to_use, $field_id);
928 928
 
929
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
929
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
930 930
 								//we want to decode the entities
931
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
931
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
932 932
 
933 933
 							}/**/
934 934
 						}
935
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
936
-						$templatefield_templatename_id = $reference_field . '-name';
935
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
936
+						$templatefield_templatename_id = $reference_field.'-name';
937 937
 
938 938
 						$template_form_fields[$templatefield_MTP_id] = array(
939
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
939
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
940 940
 							'label' => NULL,
941 941
 							'input' => 'hidden',
942 942
 							'type' => 'int',
943 943
 							'required' => FALSE,
944 944
 							'validation' => FALSE,
945
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
945
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
946 946
 							'css_class' => '',
947 947
 							'format' => '%d',
948 948
 							'db-col' => 'MTP_ID'
949 949
 						);
950 950
 
951 951
 						$template_form_fields[$templatefield_templatename_id] = array(
952
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
952
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
953 953
 							'label' => NULL,
954 954
 							'input' => 'hidden',
955 955
 							'type' => 'string',
@@ -963,10 +963,10 @@  discard block
 block discarded – undo
963 963
 					}
964 964
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
965 965
 				} else {
966
-					$field_id = $template_field . '-content';
966
+					$field_id = $template_field.'-content';
967 967
 					$template_form_fields[$field_id] = $field_setup_array;
968
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
969
-					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : '';
968
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
969
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : '';
970 970
 
971 971
 					//do we have a validator error for this field?  if we do then we'll use that value instead
972 972
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
 
975 975
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
976 976
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
977
-					$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;
977
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;
978 978
 
979 979
 					//shortcode selector
980
-					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $template_field, $field_id );
980
+					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($template_field, $field_id);
981 981
 
982
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
982
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
983 983
 						//we want to decode the entities
984 984
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
985 985
 					}/**/
@@ -987,25 +987,25 @@  discard block
 block discarded – undo
987 987
 
988 988
 				//k took care of content field(s) now let's take care of others.
989 989
 
990
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
991
-				$templatefield_field_templatename_id = $template_field . '-name';
990
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
991
+				$templatefield_field_templatename_id = $template_field.'-name';
992 992
 
993 993
 				//foreach template field there are actually two form fields created
994 994
 				$template_form_fields[$templatefield_MTP_id] = array(
995
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
995
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
996 996
 					'label' => NULL,
997 997
 					'input' => 'hidden',
998 998
 					'type' => 'int',
999 999
 					'required' => FALSE,
1000 1000
 					'validation' => TRUE,
1001
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1001
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1002 1002
 					'css_class' => '',
1003 1003
 					'format' => '%d',
1004 1004
 					'db-col' => 'MTP_ID'
1005 1005
 				);
1006 1006
 
1007 1007
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1008
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1008
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1009 1009
 					'label' => NULL,
1010 1010
 					'input' => 'hidden',
1011 1011
 					'type' => 'string',
@@ -1149,15 +1149,15 @@  discard block
 block discarded – undo
1149 1149
 				'value' => $GRP_ID
1150 1150
 				);
1151 1151
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1152
-				'name' => $action . '_nonce',
1152
+				'name' => $action.'_nonce',
1153 1153
 				'input' => 'hidden',
1154 1154
 				'type' => 'string',
1155
-				'value' => wp_create_nonce( $action . '_nonce')
1155
+				'value' => wp_create_nonce($action.'_nonce')
1156 1156
 				);
1157 1157
 
1158 1158
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1159 1159
 
1160
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1160
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1161 1161
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1162 1162
 					'name' => 'template_switch',
1163 1163
 					'input' => 'hidden',
@@ -1167,19 +1167,19 @@  discard block
 block discarded – undo
1167 1167
 			}
1168 1168
 
1169 1169
 
1170
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1171
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1170
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1171
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1172 1172
 
1173 1173
 
1174 1174
 		} //end if ( !empty($template_field_structure) )
1175 1175
 
1176 1176
 		//set extra content for publish box
1177 1177
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1178
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1178
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1179 1179
 
1180 1180
 		//add preview button
1181
-		$preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );
1182
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1181
+		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url);
1182
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1183 1183
 
1184 1184
 
1185 1185
 		//setup context switcher
@@ -1206,16 +1206,16 @@  discard block
 block discarded – undo
1206 1206
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1207 1207
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1208 1208
 
1209
-		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1209
+		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1210 1210
 
1211 1211
 		//send along EE_Message_Template_Group object for further template use.
1212 1212
 		$this->_template_args['MTP'] = $message_template_group;
1213 1213
 
1214
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1214
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1215 1215
 
1216 1216
 
1217 1217
 		//finally, let's set the admin_page title
1218
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1218
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1219 1219
 
1220 1220
 
1221 1221
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 	}
1229 1229
 
1230 1230
 
1231
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1231
+	public function filter_tinymce_init($mceInit, $editor_id) {
1232 1232
 		return $mceInit;
1233 1233
 	}
1234 1234
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 	}
1240 1240
 
1241 1241
 	public function _add_form_element_before() {
1242
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1242
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1243 1243
 	}
1244 1244
 
1245 1245
 	public function _add_form_element_after() {
@@ -1257,32 +1257,32 @@  discard block
 block discarded – undo
1257 1257
 	 * @return json json object
1258 1258
 	 */
1259 1259
 	public function switch_template_pack() {
1260
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1261
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1260
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1261
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1262 1262
 
1263 1263
 		//verify we have needed values.
1264
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1264
+		if (empty($GRP_ID) || empty($template_pack)) {
1265 1265
 			$this->_template_args['error'] = TRUE;
1266
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1266
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1267 1267
 		} else {
1268 1268
 			//get template, set the new template_pack and then reset to default
1269
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1269
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1270 1270
 
1271
-			$mtpg->set_template_pack_name( $template_pack );
1271
+			$mtpg->set_template_pack_name($template_pack);
1272 1272
 			$this->_req_data['msgr'] = $mtpg->messenger();
1273 1273
 			$this->_req_data['mt'] = $mtpg->message_type();
1274 1274
 
1275 1275
 			$query_args = $this->_reset_to_default_template();
1276 1276
 
1277
-			if ( empty( $query_args['id'] ) ) {
1278
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1277
+			if (empty($query_args['id'])) {
1278
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1279 1279
 				$this->_template_args['error'] = TRUE;
1280 1280
 			} else {
1281
-				$template_label =$mtpg->get_template_pack()->label;
1281
+				$template_label = $mtpg->get_template_pack()->label;
1282 1282
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1283
-				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) );
1283
+				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack));
1284 1284
 				//generate the redirect url for js.
1285
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1285
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1286 1286
 				$this->_template_args['data']['redirect_url'] = $url;
1287 1287
 				$this->_template_args['success'] = true;
1288 1288
 			}
@@ -1303,56 +1303,56 @@  discard block
 block discarded – undo
1303 1303
 	protected function _reset_to_default_template() {
1304 1304
 		$success = TRUE;
1305 1305
 		$templates = array();
1306
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1306
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1307 1307
 		//we need to make sure we've got the info we need.
1308
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1309
-			EE_Error::add_error( __('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1308
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1309
+			EE_Error::add_error(__('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1310 1310
 			$success = FALSE;
1311 1311
 		}
1312 1312
 
1313 1313
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1314
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1314
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1315 1315
 
1316
-		if ( $success ) {
1316
+		if ($success) {
1317 1317
 
1318 1318
 			//let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.
1319
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1319
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1320 1320
 
1321 1321
 
1322 1322
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1323
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1323
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1324 1324
 
1325
-			if ( $success ) {
1325
+			if ($success) {
1326 1326
 				//if successfully deleted, lets generate the new ones.  Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration.  This means that if a custom template is reset it resets to whatever the related global template is.  HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.
1327
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1327
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1328 1328
 			}
1329 1329
 
1330 1330
 		}
1331 1331
 
1332 1332
 		//any error messages?
1333
-		if ( !$success ) {
1334
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1333
+		if ( ! $success) {
1334
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1335 1335
 		}
1336 1336
 
1337 1337
 		//all good, let's add a success message!
1338
-		if ( $success && ! empty( $templates ) ) {
1338
+		if ($success && ! empty($templates)) {
1339 1339
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1340 1340
 			EE_Error::overwrite_success();
1341
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1341
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1342 1342
 		}
1343 1343
 
1344 1344
 
1345 1345
 		$query_args = array(
1346
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1347
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1348
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1346
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1347
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1348
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1349 1349
 			);
1350 1350
 
1351 1351
 		//if called via ajax then we return query args otherwise redirect
1352
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1352
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1353 1353
 			return $query_args;
1354 1354
 		} else {
1355
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1355
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1356 1356
 		}
1357 1357
 
1358 1358
 	}
@@ -1365,20 +1365,20 @@  discard block
 block discarded – undo
1365 1365
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1366 1366
 	 * @return void
1367 1367
 	 */
1368
-	public function _preview_message( $send = FALSE ) {
1368
+	public function _preview_message($send = FALSE) {
1369 1369
 		//first make sure we've got the necessary parameters
1370
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1371
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1370
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1371
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1372 1372
 		}
1373 1373
 
1374
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1374
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1375 1375
 
1376 1376
 		$MSG = new EE_messages();
1377 1377
 
1378 1378
 		//get the preview!
1379
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1379
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1380 1380
 
1381
-		if ( $send ) {
1381
+		if ($send) {
1382 1382
 			return $preview;
1383 1383
 		}
1384 1384
 
@@ -1388,16 +1388,16 @@  discard block
 block discarded – undo
1388 1388
 			'context' => $this->_req_data['context'],
1389 1389
 			'action' => 'edit_message_template'
1390 1390
 			);
1391
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1392
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1391
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1392
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1393 1393
 
1394 1394
 		//let's provide a helpful title for context
1395
-		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) );
1395
+		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']));
1396 1396
 
1397 1397
 
1398 1398
 		//setup display of preview.
1399 1399
 		$this->_admin_page_title = $preview_title;
1400
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1400
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1401 1401
 		$this->_template_args['data']['force_json'] = TRUE;
1402 1402
 	}
1403 1403
 
@@ -1425,9 +1425,9 @@  discard block
 block discarded – undo
1425 1425
 	 * @return void
1426 1426
 	 */
1427 1427
 	protected function _register_edit_meta_boxes() {
1428
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1429
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1430
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1428
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1429
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1430
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1448,10 +1448,10 @@  discard block
 block discarded – undo
1448 1448
 
1449 1449
 		$tp_select_values = array();
1450 1450
 
1451
-		foreach ( $template_packs as $tp ) {
1451
+		foreach ($template_packs as $tp) {
1452 1452
 			//only include template packs that support this messenger and message type!
1453 1453
 			$supports = $tp->get_supports();
1454
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1454
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1455 1455
 				//not supported
1456 1456
 				continue;
1457 1457
 			}
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 		}
1464 1464
 
1465 1465
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1466
-		if ( empty( $tp_select_values ) ) {
1466
+		if (empty($tp_select_values)) {
1467 1467
 			$tp_select_values[] = array(
1468 1468
 				'text' => __('Default', 'event_espresso'),
1469 1469
 				'id' => 'default'
@@ -1471,27 +1471,27 @@  discard block
 block discarded – undo
1471 1471
 		}
1472 1472
 
1473 1473
 		//setup variation select values for the currently selected template.
1474
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1474
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1475 1475
 		$variations_select_values = array();
1476
-		foreach ( $variations as $variation => $label ) {
1476
+		foreach ($variations as $variation => $label) {
1477 1477
 			$variations_select_values[] = array(
1478 1478
 				'text' => $label,
1479 1479
 				'id' => $variation
1480 1480
 				);
1481 1481
 		}
1482 1482
 
1483
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1483
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1484 1484
 
1485
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1486
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1485
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1486
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1487 1487
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1488 1488
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1489 1489
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1490 1490
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1491 1491
 
1492
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1492
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1493 1493
 
1494
-		EEH_Template::display_template( $template, $template_args );
1494
+		EEH_Template::display_template($template, $template_args);
1495 1495
 	}
1496 1496
 
1497 1497
 
@@ -1512,52 +1512,52 @@  discard block
 block discarded – undo
1512 1512
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1513 1513
 			);
1514 1514
 
1515
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1515
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1516 1516
 
1517 1517
 
1518 1518
 		//test button
1519 1519
 		//first we need to see if there are any fields
1520 1520
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1521 1521
 
1522
-		if ( !empty( $fields ) ) {
1522
+		if ( ! empty($fields)) {
1523 1523
 			//yup there be fields
1524
-			foreach ( $fields as $field => $config ) {
1525
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1524
+			foreach ($fields as $field => $config) {
1525
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1526 1526
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1527
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1528
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1527
+				$default = isset($config['default']) ? $config['default'] : '';
1528
+				$default = isset($config['value']) ? $config['value'] : $default;
1529 1529
 
1530 1530
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1531 1531
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1532
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1532
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1533 1533
 
1534 1534
 				$template_form_fields[$field_id] = array(
1535
-					'name' => 'test_settings_fld[' . $field . ']',
1535
+					'name' => 'test_settings_fld['.$field.']',
1536 1536
 					'label' => $config['label'],
1537 1537
 					'input' => $config['input'],
1538 1538
 					'type' => $config['type'],
1539 1539
 					'required' => $config['required'],
1540 1540
 					'validation' => $config['validation'],
1541
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1541
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1542 1542
 					'css_class' => $config['css_class'],
1543
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1543
+					'options' => isset($config['options']) ? $config['options'] : array(),
1544 1544
 					'default' => $default,
1545 1545
 					'format' => $config['format']
1546 1546
 					);
1547 1547
 			}
1548 1548
 		}
1549 1549
 
1550
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1550
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1551 1551
 
1552 1552
 		$test_settings_html = '';
1553 1553
 		//print out $test_settings_fields
1554
-		if ( !empty( $test_settings_fields ) ) {
1554
+		if ( ! empty($test_settings_fields)) {
1555 1555
 			echo $test_settings_fields;
1556
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>';
1556
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>';
1557 1557
 		}
1558 1558
 
1559 1559
 		//and button
1560
-		echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1560
+		echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1561 1561
 	}
1562 1562
 
1563 1563
 
@@ -1572,13 +1572,13 @@  discard block
 block discarded – undo
1572 1572
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1573 1573
      * @return string
1574 1574
     */
1575
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1575
+	protected function _get_shortcode_selector($field, $linked_input_id) {
1576 1576
 		$template_args = array(
1577
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
1577
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
1578 1578
 			'fieldname' => $field,
1579 1579
 			'linked_input_id' => $linked_input_id
1580 1580
 		);
1581
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
1581
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
1582 1582
 	}
1583 1583
 
1584 1584
 
@@ -1592,13 +1592,13 @@  discard block
 block discarded – undo
1592 1592
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1593 1593
 		$messenger = $this->_message_template_group->messenger_obj();
1594 1594
 		//now let's set the content depending on the status of the shortcodes array
1595
-		if ( empty( $shortcodes ) ) {
1596
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1595
+		if (empty($shortcodes)) {
1596
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1597 1597
 			echo $content;
1598 1598
 		} else {
1599 1599
 			$alt = 0;
1600 1600
 			?>
1601
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
1601
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p>
1602 1602
 			<?php
1603 1603
 		}
1604 1604
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 	protected function _set_shortcodes() {
1616 1616
 
1617 1617
 		//no need to run this if the property is already set
1618
-		if ( !empty($this->_shortcodes ) ) return;
1618
+		if ( ! empty($this->_shortcodes)) return;
1619 1619
 
1620 1620
 		$this->_shortcodes = $this->_get_shortcodes();
1621 1621
 	}
@@ -1632,14 +1632,14 @@  discard block
 block discarded – undo
1632 1632
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1633 1633
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true just an array of shortcode/label pairs.
1634 1634
 	 */
1635
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1635
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1636 1636
 		$this->_set_message_template_group();
1637 1637
 
1638 1638
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1639
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1640
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1639
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1640
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1641 1641
 
1642
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1642
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1643 1643
 	}
1644 1644
 
1645 1645
 
@@ -1652,19 +1652,19 @@  discard block
 block discarded – undo
1652 1652
 	 */
1653 1653
 	protected function _set_message_template_group() {
1654 1654
 
1655
-		if ( !empty( $this->_message_template_group ) )
1655
+		if ( ! empty($this->_message_template_group))
1656 1656
 			return; //get out if this is already set.
1657 1657
 
1658
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1659
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1658
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1659
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1660 1660
 
1661 1661
 		//let's get the message templates
1662 1662
 		$MTP = EEM_Message_Template_Group::instance();
1663 1663
 
1664
-		if ( empty($GRP_ID) )
1664
+		if (empty($GRP_ID))
1665 1665
 			$this->_message_template_group = $MTP->create_default_object();
1666 1666
 		else
1667
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1667
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1668 1668
 
1669 1669
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1670 1670
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1690,26 +1690,26 @@  discard block
 block discarded – undo
1690 1690
 		<div class="ee-msg-switcher-container">
1691 1691
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1692 1692
 				<?php
1693
-					foreach ( $args as $name => $value ) {
1694
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1693
+					foreach ($args as $name => $value) {
1694
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1695 1695
 						?>
1696 1696
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1697 1697
 						<?php
1698 1698
 					}
1699 1699
 					//setup nonce_url
1700
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1700
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1701 1701
 				?>
1702 1702
 				<select name="context">
1703 1703
 					<?php
1704 1704
 					$context_templates = $template_group_object->context_templates();
1705
-					if ( is_array($context_templates) ) :
1706
-							foreach ( $context_templates as $context => $template_fields ) :
1705
+					if (is_array($context_templates)) :
1706
+							foreach ($context_templates as $context => $template_fields) :
1707 1707
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1708 1708
 					?>
1709 1709
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1710 1710
 					<?php endforeach; endif; ?>
1711 1711
 				</select>
1712
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1712
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1713 1713
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1714 1714
 			</form>
1715 1715
 			<?php echo $args['extra']; ?>
@@ -1733,8 +1733,8 @@  discard block
 block discarded – undo
1733 1733
 	 * @param int $index This helps us know which template field to select from the request array.
1734 1734
 	 */
1735 1735
 	protected function _set_message_template_column_values($index) {
1736
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1737
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1736
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1737
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1738 1738
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1739 1739
 			}
1740 1740
 		} else {
@@ -1766,27 +1766,27 @@  discard block
 block discarded – undo
1766 1766
 
1767 1767
 
1768 1768
 
1769
-	protected function _insert_or_update_message_template($new = FALSE ) {
1769
+	protected function _insert_or_update_message_template($new = FALSE) {
1770 1770
 
1771
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1771
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1772 1772
 		$success = 0;
1773 1773
 		$override = FALSE;
1774 1774
 
1775 1775
 		//setup notices description
1776
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1777
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1778
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1776
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1777
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1778
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1779 1779
 
1780
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1780
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1781 1781
 		$item_desc .= 'Message Template';
1782 1782
 		$query_args = array();
1783 1783
 		$validates = '';
1784 1784
 
1785 1785
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1786
-		if ( $new ) {
1787
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1788
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1789
-				if ( empty($edit_array) ) {
1786
+		if ($new) {
1787
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1788
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1789
+				if (empty($edit_array)) {
1790 1790
 					$success = 0;
1791 1791
 				} else {
1792 1792
 					$success = 1;
@@ -1805,34 +1805,34 @@  discard block
 block discarded – undo
1805 1805
 
1806 1806
 
1807 1807
 			//run update for each template field in displayed context
1808
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1809
-				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1808
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1809
+				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1810 1810
 				$success = 0;
1811 1811
 				$action_desc = '';
1812 1812
 
1813 1813
 			} else {
1814 1814
 				//first validate all fields!
1815
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1815
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1816 1816
 
1817 1817
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
1818
-				if ( is_array($validates) && !empty($validates) ) {
1818
+				if (is_array($validates) && ! empty($validates)) {
1819 1819
 					//add the transient so when the form loads we know which fields to highlight
1820
-					$this->_add_transient( 'edit_message_template', $validates );
1820
+					$this->_add_transient('edit_message_template', $validates);
1821 1821
 
1822 1822
 					$success = 0;
1823
-					$action_desc ='';
1823
+					$action_desc = '';
1824 1824
 
1825 1825
 					//setup notices
1826
-					foreach ( $validates as $field => $error ) {
1827
-						if ( isset($error['msg'] ) )
1828
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1826
+					foreach ($validates as $field => $error) {
1827
+						if (isset($error['msg']))
1828
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1829 1829
 					}
1830 1830
 
1831 1831
 				} else {
1832
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1832
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1833 1833
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1834 1834
 
1835
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1835
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1836 1836
 
1837 1837
 						$message_template_fields = array(
1838 1838
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1840,10 +1840,10 @@  discard block
 block discarded – undo
1840 1840
 							'MTP_context' => $set_column_values['MTP_context'],
1841 1841
 							'MTP_content' => $set_column_values['MTP_content']
1842 1842
 							);
1843
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1844
-							if ( $updated === FALSE ) {
1845
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1846
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1843
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1844
+							if ($updated === FALSE) {
1845
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1846
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1847 1847
 							} else {
1848 1848
 								$success = 1;
1849 1849
 							}
@@ -1860,24 +1860,24 @@  discard block
 block discarded – undo
1860 1860
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1861 1861
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1862 1862
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1863
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1864
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1863
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1864
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1865 1865
 						);
1866 1866
 
1867
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1868
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1867
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1868
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1869 1869
 
1870
-					if ( $updated === FALSE ) {
1871
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1872
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1870
+					if ($updated === FALSE) {
1871
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1872
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1873 1873
 					} else {
1874 1874
 						//k now we need to ensure the template_pack and template_variation fields are set.
1875
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1876
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1877
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1878
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1879
-							$mtpg_obj->set_template_pack_name( $template_pack );
1880
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1875
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1876
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1877
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1878
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1879
+							$mtpg_obj->set_template_pack_name($template_pack);
1880
+							$mtpg_obj->set_template_pack_variation($template_variation);
1881 1881
 						}
1882 1882
 						$success = 1;
1883 1883
 					}
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 		}
1888 1888
 
1889 1889
 		//we return things differently if doing ajax
1890
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1890
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1891 1891
 			$this->_template_args['success'] = $success;
1892 1892
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1893 1893
 			$this->_template_args['content'] = '';
@@ -1895,9 +1895,9 @@  discard block
 block discarded – undo
1895 1895
 				'grpID' => $edit_array['GRP_ID'],
1896 1896
 				'templateName' => $edit_array['template_name']
1897 1897
 				);
1898
-			if ( $success ) {
1898
+			if ($success) {
1899 1899
 				EE_Error::overwrite_success();
1900
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
1900
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
1901 1901
 			}
1902 1902
 
1903 1903
 			$this->_return_json();
@@ -1905,13 +1905,13 @@  discard block
 block discarded – undo
1905 1905
 
1906 1906
 
1907 1907
 		//was a test send triggered?
1908
-		if ( isset( $this->_req_data['test_button'] ) ) {
1908
+		if (isset($this->_req_data['test_button'])) {
1909 1909
 			EE_Error::overwrite_success();
1910
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1910
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1911 1911
 			$override = TRUE;
1912 1912
 		}
1913 1913
 
1914
-		if ( empty( $query_args ) ) {
1914
+		if (empty($query_args)) {
1915 1915
 			$query_args = array(
1916 1916
 				'id' => $this->_req_data['GRP_ID'],
1917 1917
 				'context' => $this->_req_data['MTP_context'],
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 				);
1920 1920
 		}
1921 1921
 
1922
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1922
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1923 1923
 	}
1924 1924
 
1925 1925
 
@@ -1932,24 +1932,24 @@  discard block
 block discarded – undo
1932 1932
 	 * @param  string $message_type message type being tested
1933 1933
 	 * @return void
1934 1934
 	 */
1935
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1935
+	protected function _do_test_send($context, $messenger, $message_type) {
1936 1936
 		//set things up for preview
1937 1937
 		$this->_req_data['messenger'] = $messenger;
1938 1938
 		$this->_req_data['message_type'] = $message_type;
1939 1939
 		$this->_req_data['context'] = $context;
1940
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1940
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1941 1941
 
1942 1942
 		//let's save any existing fields that might be required by the messenger
1943
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1944
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1943
+		if (isset($this->_req_data['test_settings_fld'])) {
1944
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1945 1945
 		}
1946 1946
 
1947 1947
 		$success = $this->_preview_message(TRUE);
1948 1948
 
1949
-		if ( $success ) {
1950
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1949
+		if ($success) {
1950
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1951 1951
 		} else {
1952
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1952
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1953 1953
 		}
1954 1954
 	}
1955 1955
 
@@ -1971,12 +1971,12 @@  discard block
 block discarded – undo
1971 1971
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1972 1972
 
1973 1973
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1974
-		if ( empty( $message_types ) )
1974
+		if (empty($message_types))
1975 1975
 			return true;
1976 1976
 
1977
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1977
+		EE_Registry::instance()->load_helper('MSG_Template');
1978 1978
 
1979
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1979
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1980 1980
 
1981 1981
 	}
1982 1982
 
@@ -1992,33 +1992,33 @@  discard block
 block discarded – undo
1992 1992
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1993 1993
 	 * @return void
1994 1994
 	 */
1995
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1996
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1995
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1996
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1997 1997
 		$MTP = EEM_Message_Template_Group::instance();
1998 1998
 
1999 1999
 		$success = 1;
2000 2000
 
2001 2001
 		//incoming GRP_IDs
2002
-		if ( $all ) {
2002
+		if ($all) {
2003 2003
 			//Checkboxes
2004
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2004
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2005 2005
 				//if array has more than one element then success message should be plural.
2006 2006
 				//todo: what about nonce?
2007
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2007
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2008 2008
 
2009 2009
 				//cycle through checkboxes
2010
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2011
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2012
-					if ( ! $trashed_or_restored ) {
2010
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2011
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2012
+					if ( ! $trashed_or_restored) {
2013 2013
 						$success = 0;
2014 2014
 					}
2015 2015
 				}
2016 2016
 			} else {
2017 2017
 				//grab single GRP_ID and handle
2018
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2019
-				if ( ! empty( $GRP_ID ) ) {
2020
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2021
-					if ( ! $trashed_or_restored ) {
2018
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2019
+				if ( ! empty($GRP_ID)) {
2020
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2021
+					if ( ! $trashed_or_restored) {
2022 2022
 						$success = 0;
2023 2023
 					}
2024 2024
 				} else {
@@ -2030,13 +2030,13 @@  discard block
 block discarded – undo
2030 2030
 
2031 2031
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2032 2032
 
2033
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2033
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2034 2034
 
2035 2035
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2036 2036
 
2037
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2037
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2038 2038
 
2039
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2039
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2040 2040
 
2041 2041
 	}
2042 2042
 
@@ -2052,26 +2052,26 @@  discard block
 block discarded – undo
2052 2052
 	 * @return void
2053 2053
 	 */
2054 2054
 	protected function _delete_message_template() {
2055
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2055
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2056 2056
 
2057 2057
 		$success = 1;
2058 2058
 
2059 2059
 		//checkboxes
2060
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2060
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2061 2061
 			//if array has more than one element then success message should be plural
2062
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2062
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2063 2063
 
2064 2064
 			//cycle through bulk action checkboxes
2065
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2066
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2065
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2066
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2067 2067
 			}
2068 2068
 		} else {
2069 2069
 			//grab single grp_id and delete
2070
-			$GRP_ID = absint($this->_req_data['id'] );
2071
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2070
+			$GRP_ID = absint($this->_req_data['id']);
2071
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2072 2072
 		}
2073 2073
 
2074
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2074
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2075 2075
 
2076 2076
 	}
2077 2077
 
@@ -2084,20 +2084,20 @@  discard block
 block discarded – undo
2084 2084
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2085 2085
 	 * @return success        boolean to indicate the success of the deletes or not.
2086 2086
 	 */
2087
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2087
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2088 2088
 		$success = 1;
2089 2089
 		$MTPG = EEM_Message_Template_Group::instance();
2090 2090
 		//first let's GET this group
2091
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2091
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2092 2092
 		//then delete permanently all the related Message Templates
2093
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2093
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2094 2094
 
2095
-		if ( $deleted === 0 )
2095
+		if ($deleted === 0)
2096 2096
 			$success = 0;
2097 2097
 
2098 2098
 		//now delete permanently this particular group
2099 2099
 
2100
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2100
+		if ($include_group && ! $MTG->delete_permanently()) {
2101 2101
 			$success = 0;
2102 2102
 		}
2103 2103
 		return $success;
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	*	@return string
2116 2116
 	*/
2117 2117
 	protected function _learn_more_about_message_templates_link() {
2118
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2118
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2119 2119
 	}
2120 2120
 
2121 2121
 
@@ -2129,14 +2129,14 @@  discard block
 block discarded – undo
2129 2129
 	 */
2130 2130
 	protected function _settings() {
2131 2131
 
2132
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2132
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2133 2133
 
2134 2134
 		$this->_set_m_mt_settings();
2135 2135
 
2136
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2136
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2137 2137
 
2138 2138
 		//let's setup the messenger tabs
2139
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2139
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2140 2140
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2141 2141
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2142 2142
 
@@ -2155,10 +2155,10 @@  discard block
 block discarded – undo
2155 2155
 	 */
2156 2156
 	protected function _set_m_mt_settings() {
2157 2157
 		//first if this is already set then lets get out no need to regenerate data.
2158
-		if ( !empty($this->_m_mt_settings) )
2158
+		if ( ! empty($this->_m_mt_settings))
2159 2159
 			return;
2160 2160
 
2161
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2161
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2162 2162
 
2163 2163
 		//get all installed messengers and message_types
2164 2164
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2168,10 +2168,10 @@  discard block
 block discarded – undo
2168 2168
 
2169 2169
 		//assemble the array for the _tab_text_links helper
2170 2170
 
2171
-		foreach ( $messengers as $messenger ) {
2171
+		foreach ($messengers as $messenger) {
2172 2172
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2173 2173
 				'label' => ucwords($messenger->label['singular']),
2174
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2174
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2175 2175
 				'href' => $messenger->name,
2176 2176
 				'title' => __('Modify this Messenger', 'event_espresso'),
2177 2177
 				'slug' => $messenger->name,
@@ -2181,23 +2181,23 @@  discard block
 block discarded – undo
2181 2181
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2182 2182
 
2183 2183
 			//assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.
2184
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2185
-			foreach ( $message_types as $message_type ) {
2184
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2185
+			foreach ($message_types as $message_type) {
2186 2186
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2187
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2187
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2188 2188
 					continue;
2189 2189
 				}
2190 2190
 
2191
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2191
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2192 2192
 
2193 2193
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2194 2194
 						'label' => ucwords($message_type->label['singular']),
2195
-						'class' => 'message-type-' . $a_or_i,
2196
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2197
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2198
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2195
+						'class' => 'message-type-'.$a_or_i,
2196
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2197
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2198
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2199 2199
 						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'),
2200
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2200
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2201 2201
 						'slug' => $message_type->name,
2202 2202
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2203 2203
 						'obj' => $message_type
@@ -2214,34 +2214,34 @@  discard block
 block discarded – undo
2214 2214
 	 * @param  boolean $active       Whether the message type is active or not
2215 2215
 	 * @return string                html output for the content
2216 2216
 	 */
2217
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2217
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2218 2218
 		//get message type fields
2219 2219
 		$fields = $message_type->get_admin_settings_fields();
2220
-		$settings_template_args['template_form_fields']= '';
2220
+		$settings_template_args['template_form_fields'] = '';
2221 2221
 
2222
-		if ( !empty( $fields ) && $active ) {
2222
+		if ( ! empty($fields) && $active) {
2223 2223
 
2224
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2224
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2225 2225
 
2226
-			foreach( $fields as $fldname => $fldprops ) {
2227
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2226
+			foreach ($fields as $fldname => $fldprops) {
2227
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2228 2228
 				$template_form_field[$field_id] = array(
2229
-					'name' => 'message_type_settings[' . $fldname . ']',
2229
+					'name' => 'message_type_settings['.$fldname.']',
2230 2230
 					'label' => $fldprops['label'],
2231 2231
 					'input' => $fldprops['field_type'],
2232 2232
 					'type' => $fldprops['value_type'],
2233 2233
 					'required' => $fldprops['required'],
2234 2234
 					'validation' => $fldprops['validation'],
2235
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2236
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2237
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2235
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2236
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2237
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2238 2238
 					'css_class' => 'no-drag',
2239 2239
 					'format' => $fldprops['format']
2240 2240
 					);
2241 2241
 			}
2242 2242
 
2243 2243
 
2244
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2244
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2245 2245
 		}
2246 2246
 
2247 2247
 		$settings_template_args['description'] = $message_type->description;
@@ -2261,13 +2261,13 @@  discard block
 block discarded – undo
2261 2261
 					)
2262 2262
 				);
2263 2263
 
2264
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2265
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2264
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2265
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2266 2266
 
2267 2267
 
2268 2268
 
2269
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2270
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2269
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2270
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2271 2271
 		return $content;
2272 2272
 	}
2273 2273
 
@@ -2284,21 +2284,21 @@  discard block
 block discarded – undo
2284 2284
 		$m_boxes = $mt_boxes = array();
2285 2285
 		$m_template_args = $mt_template_args = array();
2286 2286
 
2287
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2287
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2288 2288
 
2289
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2289
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2290 2290
 
2291
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2292
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2291
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2292
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2293 2293
 
2294 2294
 			//messenger meta boxes
2295 2295
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2296
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2297
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2298
-			$m_template_args[$messenger . '_a_box'] = array(
2299
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2300
-					'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2301
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2296
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2297
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2298
+			$m_template_args[$messenger.'_a_box'] = array(
2299
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2300
+					'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2301
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2302 2302
 					'hidden' => $active ? '' : ' hidden',
2303 2303
 					'hide_on_message' => $hide_on_message,
2304 2304
 					'messenger' => $messenger,
@@ -2307,10 +2307,10 @@  discard block
 block discarded – undo
2307 2307
 
2308 2308
 
2309 2309
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2310
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2311
-			$mt_template_args[$messenger . '_i_box'] = array(
2312
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2313
-				'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2310
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2311
+			$mt_template_args[$messenger.'_i_box'] = array(
2312
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2313
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2314 2314
 				'hidden' => $active ? '' : ' hidden',
2315 2315
 				'hide_on_message' => $hide_on_message,
2316 2316
 				'hide_off_message' => $hide_off_message,
@@ -2320,19 +2320,19 @@  discard block
 block discarded – undo
2320 2320
 		}
2321 2321
 
2322 2322
 		//register messenger metaboxes
2323
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2324
-		foreach ( $m_boxes as $box => $label ) {
2325
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2326
-			$msgr = str_replace( '_a_box', '', $box );
2327
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2323
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2324
+		foreach ($m_boxes as $box => $label) {
2325
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2326
+			$msgr = str_replace('_a_box', '', $box);
2327
+			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
2328 2328
 		}
2329 2329
 
2330 2330
 		//register message type metaboxes
2331
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2332
-		foreach ( $mt_boxes as $box => $label ) {
2333
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2334
-			$mt = str_replace( '_i_box', '', $box );
2335
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2331
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2332
+		foreach ($mt_boxes as $box => $label) {
2333
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2334
+			$mt = str_replace('_i_box', '', $box);
2335
+			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args);
2336 2336
 		}
2337 2337
 
2338 2338
 	}
@@ -2343,13 +2343,13 @@  discard block
 block discarded – undo
2343 2343
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2344 2344
 	 * @return string            html formatted tabs
2345 2345
 	 */
2346
-	protected function _get_mt_tabs( $tab_array ) {
2346
+	protected function _get_mt_tabs($tab_array) {
2347 2347
 		$tab_array = (array) $tab_array;
2348
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2348
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2349 2349
 		$tabs = '';
2350 2350
 
2351
-		foreach ( $tab_array as $tab ) {
2352
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2351
+		foreach ($tab_array as $tab) {
2352
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2353 2353
 		}
2354 2354
 
2355 2355
 		return $tabs;
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 	 * @param  object $messenger The messenger we're setting up content for
2364 2364
 	 * @return string            html formatted content
2365 2365
 	 */
2366
-	protected function _get_messenger_box_content( $messenger ) {
2366
+	protected function _get_messenger_box_content($messenger) {
2367 2367
 
2368 2368
 		$fields = $messenger->get_admin_settings_fields();
2369 2369
 		$settings_template_args['template_form_fields'] = '';
@@ -2372,27 +2372,27 @@  discard block
 block discarded – undo
2372 2372
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2373 2373
 
2374 2374
 
2375
-		if ( !empty( $fields ) ) {
2375
+		if ( ! empty($fields)) {
2376 2376
 
2377 2377
 			$existing_settings = $messenger->get_existing_admin_settings();
2378 2378
 
2379
-			foreach( $fields as $fldname => $fldprops ) {
2380
-				$field_id = $messenger->name . '-' . $fldname;
2379
+			foreach ($fields as $fldname => $fldprops) {
2380
+				$field_id = $messenger->name.'-'.$fldname;
2381 2381
 				$template_form_field[$field_id] = array(
2382
-					'name' => 'messenger_settings[' . $field_id . ']',
2382
+					'name' => 'messenger_settings['.$field_id.']',
2383 2383
 					'label' => $fldprops['label'],
2384 2384
 					'input' => $fldprops['field_type'],
2385 2385
 					'type' => $fldprops['value_type'],
2386 2386
 					'required' => $fldprops['required'],
2387 2387
 					'validation' => $fldprops['validation'],
2388
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2388
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2389 2389
 					'css_class' => '',
2390 2390
 					'format' => $fldprops['format']
2391 2391
 					);
2392 2392
 			}
2393 2393
 
2394 2394
 
2395
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2395
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2396 2396
 		}
2397 2397
 
2398 2398
 		//we also need some hidden fields
@@ -2408,8 +2408,8 @@  discard block
 block discarded – undo
2408 2408
 			);
2409 2409
 
2410 2410
 		//make sure any active message types that are existing are included in the hidden fields
2411
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2412
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2411
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2412
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2413 2413
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2414 2414
 						'type' => 'hidden',
2415 2415
 						'value' => $mt
@@ -2417,25 +2417,25 @@  discard block
 block discarded – undo
2417 2417
 			}
2418 2418
 		}
2419 2419
 
2420
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2420
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2421 2421
 
2422
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2422
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2423 2423
 
2424 2424
 		$settings_template_args['messenger'] = $messenger->name;
2425 2425
 		$settings_template_args['description'] = $messenger->description;
2426 2426
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2427 2427
 
2428 2428
 
2429
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2429
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2430 2430
 
2431
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2431
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2432 2432
 
2433 2433
 
2434 2434
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2435
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2435
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2436 2436
 		$settings_template_args['on_off_status'] = $active ? true : false;
2437
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2438
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2437
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2438
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2439 2439
 		return $content;
2440 2440
 	}
2441 2441
 
@@ -2449,39 +2449,39 @@  discard block
 block discarded – undo
2449 2449
 	public function activate_messenger_toggle() {
2450 2450
 		$success = TRUE;
2451 2451
 		//let's check that we have required data
2452
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2453
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2452
+		if ( ! isset($this->_req_data['messenger'])) {
2453
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2454 2454
 			$success = FALSE;
2455 2455
 		}
2456 2456
 
2457 2457
 		//do a nonce check here since we're not arriving via a normal route
2458
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2459
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2458
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2459
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2460 2460
 
2461
-		$this->_verify_nonce( $nonce, $nonce_ref );
2461
+		$this->_verify_nonce($nonce, $nonce_ref);
2462 2462
 
2463 2463
 
2464 2464
 
2465
-		if ( !isset( $this->_req_data[ 'status' ])) {
2466
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2465
+		if ( ! isset($this->_req_data['status'])) {
2466
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2467 2467
 			$success = FALSE;
2468 2468
 		}
2469 2469
 
2470 2470
 		//do check to verify we have a valid status.
2471 2471
 		$status = $this->_req_data['status'];
2472 2472
 
2473
-		if ( $status != 'off' && $status != 'on' ) {
2474
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2473
+		if ($status != 'off' && $status != 'on') {
2474
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2475 2475
 			$success = FALSE;
2476 2476
 		}
2477 2477
 
2478
-		if ( $success ) {
2478
+		if ($success) {
2479 2479
 			//made it here?  Stop dawdling then!!
2480
-			if ( $status == 'off' ) {
2480
+			if ($status == 'off') {
2481 2481
 				//off = deactivate.  get it?
2482
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2482
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2483 2483
 			} else {
2484
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2484
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2485 2485
 			}
2486 2486
 		}
2487 2487
 
@@ -2507,26 +2507,26 @@  discard block
 block discarded – undo
2507 2507
 
2508 2508
 
2509 2509
 		//let's make sure we have the necessary data
2510
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2511
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2510
+		if ( ! isset($this->_req_data['message_type'])) {
2511
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2512 2512
 			$success = FALSE;
2513 2513
 		}
2514 2514
 
2515 2515
 
2516 2516
 		//do a nonce check here since we're not arriving via a normal route
2517
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2518
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2517
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2518
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2519 2519
 
2520
-		$this->_verify_nonce( $nonce, $nonce_ref );
2520
+		$this->_verify_nonce($nonce, $nonce_ref);
2521 2521
 
2522 2522
 
2523
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2524
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2523
+		if ( ! isset($this->_req_data['messenger'])) {
2524
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2525 2525
 			$success = FALSE;
2526 2526
 		}
2527 2527
 
2528
-		if ( !isset( $this->_req_data[ 'status' ])) {
2529
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2528
+		if ( ! isset($this->_req_data['status'])) {
2529
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2530 2530
 			$success = FALSE;
2531 2531
 		}
2532 2532
 
@@ -2534,16 +2534,16 @@  discard block
 block discarded – undo
2534 2534
 		//do check to verify we have a valid status.
2535 2535
 		$status = $this->_req_data['status'];
2536 2536
 
2537
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2538
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2537
+		if ($status != 'activate' && $status != 'deactivate') {
2538
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2539 2539
 			$success = FALSE;
2540 2540
 		}
2541 2541
 
2542 2542
 
2543
-		if ( $success ) {
2543
+		if ($success) {
2544 2544
 			//made it here? um, what are you waiting for then?
2545 2545
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2546
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2546
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2547 2547
 		}
2548 2548
 
2549 2549
 		$this->_template_args['success'] = $success;
@@ -2570,28 +2570,28 @@  discard block
 block discarded – undo
2570 2570
 		$templates = TRUE;
2571 2571
 		$this->_set_m_mt_settings();
2572 2572
 
2573
-		if ( !$deactivate ) {
2573
+		if ( ! $deactivate) {
2574 2574
 
2575 2575
 
2576 2576
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2577
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2577
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2578 2578
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2579 2579
 
2580 2580
 			//get has_active so we can sure its kept up to date.
2581
-			$has_activated = get_option( 'ee_has_activated_messages' );
2581
+			$has_activated = get_option('ee_has_activated_messages');
2582 2582
 
2583
-			if ( empty( $has_activated[$messenger] ) ) {
2583
+			if (empty($has_activated[$messenger])) {
2584 2584
 				$has_activated[$messenger] = array();
2585 2585
 			}
2586 2586
 
2587 2587
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2588 2588
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2589 2589
 
2590
-			foreach ( $default_types as $type ) {
2590
+			foreach ($default_types as $type) {
2591 2591
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2592
-				if ( !empty( $settings_fields ) ) {
2592
+				if ( ! empty($settings_fields)) {
2593 2593
 					//we have fields for this message type so let's get the defaults for saving.
2594
-					foreach ( $settings_fields as $field => $values ) {
2594
+					foreach ($settings_fields as $field => $values) {
2595 2595
 						$settings[$field] = $values['default'];
2596 2596
 					}
2597 2597
 					//let's set the data for reloading this message type form in ajax
@@ -2599,9 +2599,9 @@  discard block
 block discarded – undo
2599 2599
 				} else {
2600 2600
 					$settings = array();
2601 2601
 				}
2602
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2602
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2603 2603
 
2604
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2604
+				if ( ! in_array($type, $has_activated[$messenger])) {
2605 2605
 					$has_activated[$messenger][] = $type;
2606 2606
 				}
2607 2607
 			}
@@ -2609,41 +2609,41 @@  discard block
 block discarded – undo
2609 2609
 			//any default settings for the messenger?
2610 2610
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2611 2611
 
2612
-			if ( !empty( $msgr_settings ) ) {
2613
-				foreach ( $msgr_settings as $field => $value ) {
2612
+			if ( ! empty($msgr_settings)) {
2613
+				foreach ($msgr_settings as $field => $value) {
2614 2614
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2615 2615
 				}
2616 2616
 			}
2617 2617
 
2618 2618
 			//update settings in database
2619
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2620
-			update_option( 'ee_has_activated_messages', $has_activated );
2619
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2620
+			update_option('ee_has_activated_messages', $has_activated);
2621 2621
 
2622 2622
 
2623 2623
 			//generate new templates (if necessary)
2624
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2624
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2625 2625
 
2626 2626
 			EE_Error::overwrite_success();
2627 2627
 
2628 2628
 			//if generation failed then we need to remove the active messenger.
2629
-			if ( !$templates ) {
2629
+			if ( ! $templates) {
2630 2630
 				unset($this->_active_messengers[$messenger]);
2631
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2631
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2632 2632
 			} else {
2633 2633
 				//all is good let's do a success message
2634
-				if ( $message_type ) {
2635
-					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2634
+				if ($message_type) {
2635
+					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2636 2636
 
2637 2637
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2638
-					if ( $message_type == 'invoice' ) {
2639
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2640
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2641
-						if ( $pm instanceof EE_Payment_Method ) {
2642
-							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
2638
+					if ($message_type == 'invoice') {
2639
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2640
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2641
+						if ($pm instanceof EE_Payment_Method) {
2642
+							EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
2643 2643
 						}
2644 2644
 					}
2645 2645
 				} else {
2646
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2646
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2647 2647
 				}
2648 2648
 			}
2649 2649
 
@@ -2659,36 +2659,36 @@  discard block
 block discarded – undo
2659 2659
 			$update_array = array(
2660 2660
 				'MTP_messenger' => $messenger);
2661 2661
 
2662
-			if ( $message_type ) {
2662
+			if ($message_type) {
2663 2663
 				$update_array['MTP_message_type'] = $message_type;
2664 2664
 			}
2665 2665
 
2666
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2666
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2667 2667
 
2668 2668
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2669 2669
 
2670 2670
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2671
-			if ( $message_type ) {
2672
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2671
+			if ($message_type) {
2672
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2673 2673
 			} else {
2674
-				unset( $this->_active_messengers[$messenger] );
2674
+				unset($this->_active_messengers[$messenger]);
2675 2675
 			}
2676 2676
 
2677
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2677
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2678 2678
 			EE_Error::overwrite_success();
2679
-			if ( $message_type ) {
2680
-				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) );
2679
+			if ($message_type) {
2680
+				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular'])));
2681 2681
 			} else {
2682
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2682
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2683 2683
 			}
2684 2684
 
2685 2685
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2686
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2687
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2688
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2689
-				if ( $count_updated > 0 ) {
2690
-					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
2691
-					EE_Error::add_attention( $msg );
2686
+			if ($messenger == 'html' || $message_type == 'invoice') {
2687
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2688
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2689
+				if ($count_updated > 0) {
2690
+					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
2691
+					EE_Error::add_attention($msg);
2692 2692
 				}
2693 2693
 			}
2694 2694
 
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
 	 * @return string html data
2706 2706
 	 */
2707 2707
 	public function update_mt_form() {
2708
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2709
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2708
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2709
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2710 2710
 			$this->_return_json();
2711 2711
 		}
2712 2712
 
@@ -2715,7 +2715,7 @@  discard block
 block discarded – undo
2715 2715
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2716 2716
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2717 2717
 
2718
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2718
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2719 2719
 		$this->_template_args['success'] = true;
2720 2720
 		$this->_template_args['content'] = $content;
2721 2721
 		$this->_return_json();
@@ -2729,36 +2729,36 @@  discard block
 block discarded – undo
2729 2729
 	 * @return json success or fail message
2730 2730
 	 */
2731 2731
 	public function save_settings() {
2732
-		if ( !isset( $this->_req_data['type'] ) ) {
2733
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2732
+		if ( ! isset($this->_req_data['type'])) {
2733
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2734 2734
 			$this->_template_args['error'] = TRUE;
2735 2735
 			$this->_return_json();
2736 2736
 		}
2737 2737
 
2738 2738
 
2739
-		if ( $this->_req_data['type'] == 'messenger' ) {
2739
+		if ($this->_req_data['type'] == 'messenger') {
2740 2740
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2741 2741
 			$messenger = $settings['messenger'];
2742 2742
 			//let's setup the settings data
2743
-			foreach ( $settings as $key => $value ) {
2744
-				switch ( $key ) {
2743
+			foreach ($settings as $key => $value) {
2744
+				switch ($key) {
2745 2745
 					case 'messenger' :
2746
-						unset( $settings['messenger'] );
2746
+						unset($settings['messenger']);
2747 2747
 						break;
2748 2748
 					case 'message_types' :
2749
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2750
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2751
-								if ( isset( $settings['message_types'][$mt] ) )
2752
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2749
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2750
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2751
+								if (isset($settings['message_types'][$mt]))
2752
+									$settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array();
2753 2753
 							}
2754 2754
 						} else {
2755
-							foreach ( $value as $mt => $v ) {
2755
+							foreach ($value as $mt => $v) {
2756 2756
 								//let's see if this message type is already present and has settings.
2757
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2757
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2758 2758
 							}
2759 2759
 						}
2760 2760
 						//k settings are set let's get rid of the message types index
2761
-						unset( $settings['message_types'] );
2761
+						unset($settings['message_types']);
2762 2762
 						break;
2763 2763
 					default :
2764 2764
 						$settings[$key] = $value;
@@ -2768,36 +2768,36 @@  discard block
 block discarded – undo
2768 2768
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2769 2769
 		}
2770 2770
 
2771
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2771
+		else if ($this->_req_data['type'] == 'message_type') {
2772 2772
 			$settings = $this->_req_data['message_type_settings'];
2773 2773
 			$messenger = $settings['messenger'];
2774 2774
 			$message_type = $settings['message_type'];
2775 2775
 
2776
-			foreach ( $settings as $key => $value ) {
2777
-				switch ( $key ) {
2776
+			foreach ($settings as $key => $value) {
2777
+				switch ($key) {
2778 2778
 					case 'messenger' :
2779
-						unset( $settings['messenger'] );
2779
+						unset($settings['messenger']);
2780 2780
 						break;
2781 2781
 					case 'message_type' :
2782
-						unset( $settings['message_type'] );
2782
+						unset($settings['message_type']);
2783 2783
 						break;
2784 2784
 					default :
2785 2785
 						$settings['settings'][$key] = $value;
2786
-						unset( $settings[$key] );
2786
+						unset($settings[$key]);
2787 2787
 						break;
2788 2788
 				}
2789 2789
 			}
2790 2790
 
2791
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2791
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2792 2792
 		}
2793 2793
 
2794 2794
 		//okay we should have the data all setup.  Now we just update!
2795
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2795
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2796 2796
 
2797
-		if ( $success ) {
2798
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2797
+		if ($success) {
2798
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2799 2799
 		} else {
2800
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2800
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2801 2801
 		}
2802 2802
 
2803 2803
 		$this->_template_args['success'] = $success;
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.
Indentation   +4 added lines, -4 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',
@@ -747,9 +747,9 @@  discard block
 block discarded – undo
747 747
 
748 748
 	/**
749 749
 	 * 		_update_payment_settings
750
-	*		@access protected
751
-	*		@return array
752
-	*/
750
+	 *		@access protected
751
+	 *		@return array
752
+	 */
753 753
 	protected function _update_payment_settings() {
754 754
 		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
755 755
 		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
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.
Spacing   +168 added lines, -168 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
 
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 	protected function _set_page_config() {
131 131
 		$payment_method_list_config = array(
132 132
 			'nav'           => array(
133
-				'label' => __( 'Payment Methods', 'event_espresso' ),
133
+				'label' => __('Payment Methods', 'event_espresso'),
134 134
 				'order' => 10
135 135
 			),
136 136
 			'metaboxes'     => $this->_default_espresso_metaboxes,
137 137
 			'help_tabs'     => array_merge(
138 138
 				array(
139 139
 					'payment_methods_overview_help_tab' => array(
140
-						'title'    => __( 'Payment Methods Overview', 'event_espresso' ),
140
+						'title'    => __('Payment Methods Overview', 'event_espresso'),
141 141
 						'filename' => 'payment_methods_overview'
142 142
 					)
143 143
 				),
144 144
 				$this->_add_payment_method_help_tabs() ),
145
-			'help_tour'     => array( 'Payment_Methods_Selection_Help_Tour' ),
145
+			'help_tour'     => array('Payment_Methods_Selection_Help_Tour'),
146 146
 			'require_nonce' => false
147 147
 		);
148 148
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 					)
161 161
 				),
162 162
 				//'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),
163
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
163
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164 164
 				'require_nonce' => FALSE
165 165
 			),
166 166
 			'payment_log'=>array(
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _add_payment_method_help_tabs(){
182
+	protected function _add_payment_method_help_tabs() {
183 183
 		EE_Registry::instance()->load_lib('Payment_Method_Manager');
184 184
 		$payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();
185 185
 		$all_pmt_help_tabs_config = array();
186
-		foreach( $payment_method_types as $payment_method_type ){
187
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) {
186
+		foreach ($payment_method_types as $payment_method_type) {
187
+			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) {
188 188
 				continue;
189 189
 			}
190
-			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){
191
-				$template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array();
192
-				$template_args[ 'admin_page_obj' ] = $this;
190
+			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) {
191
+				$template_args = isset($config['template_args']) ? $config['template_args'] : array();
192
+				$template_args['admin_page_obj'] = $this;
193 193
 				$all_pmt_help_tabs_config[$help_tab_name] = array(
194 194
 					'title'=>$config['title'],
195 195
 					'content'=>EEH_Template::display_template( 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
 	public function load_scripts_styles() {
219
-		wp_enqueue_script( 'ee_admin_js' );
220
-		wp_enqueue_script( 'ee-text-links' );
221
-		wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
219
+		wp_enqueue_script('ee_admin_js');
220
+		wp_enqueue_script('ee-text-links');
221
+		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
222 222
 	}
223 223
 
224 224
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 	public function load_scripts_styles_default() {
229 229
 		//styles
230
-		wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );
231
-		wp_enqueue_style( 'espresso_payments' );
232
-		wp_enqueue_style( 'ee-text-links' );
230
+		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION);
231
+		wp_enqueue_style('espresso_payments');
232
+		wp_enqueue_style('ee-text-links');
233 233
 		//scripts
234 234
 	}
235 235
 
@@ -243,46 +243,46 @@  discard block
 block discarded – undo
243 243
 		 * to the loading process.  However, people MUST setup the details for the payment method so its safe to do a
244 244
 		 * recheck here.
245 245
 		 */
246
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
246
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
247 247
 		EEM_Payment_Method::instance()->verify_button_urls();
248
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
249
-		EE_Registry::instance()->load_helper( 'HTML' );
248
+		EE_Registry::instance()->load_helper('Tabbed_Content');
249
+		EE_Registry::instance()->load_helper('HTML');
250 250
 		//setup tabs, one for each payment method type
251 251
 		$tabs = array();
252 252
 		$payment_methods = array();
253
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
253
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
254 254
 			// we don't want to show admin-only PMTs for now
255
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
255
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
256 256
 				continue;
257 257
 			}
258 258
 			//check access
259
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
259
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
260 260
 				continue;
261 261
 			}
262 262
 			//check for any active pms of that type
263
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
264
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
263
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
264
+			if ( ! $payment_method instanceof EE_Payment_Method) {
265 265
 				$payment_method = EE_Payment_Method::new_instance(
266 266
 					array(
267
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
267
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
268 268
 						'PMD_type'					=>$pmt_obj->system_name(),
269 269
 						'PMD_name'				=>$pmt_obj->pretty_name(),
270 270
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
271 271
 					)
272 272
 				);
273 273
 			}
274
-			$payment_methods[ $payment_method->slug() ] = $payment_method;
274
+			$payment_methods[$payment_method->slug()] = $payment_method;
275 275
 		}
276
-		$payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods );
277
-		foreach( $payment_methods as $payment_method ) {
278
-			if ( $payment_method instanceof EE_Payment_Method ) {
276
+		$payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods);
277
+		foreach ($payment_methods as $payment_method) {
278
+			if ($payment_method instanceof EE_Payment_Method) {
279 279
 				add_meta_box(
280 280
 					//html id
281
-					'espresso_' . $payment_method->slug() . '_payment_settings',
281
+					'espresso_'.$payment_method->slug().'_payment_settings',
282 282
 					//title
283
-					sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ),
283
+					sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
284 284
 					//callback
285
-					array( $this, 'payment_method_settings_meta_box' ),
285
+					array($this, 'payment_method_settings_meta_box'),
286 286
 					//post type
287 287
 					null,
288 288
 					//context
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
 					//priority
291 291
 					'default',
292 292
 					//callback args
293
-					array( 'payment_method' => $payment_method )
293
+					array('payment_method' => $payment_method)
294 294
 				);
295 295
 				//setup for tabbed content
296
-				$tabs[ $payment_method->slug() ] = array(
296
+				$tabs[$payment_method->slug()] = array(
297 297
 					'label' => $payment_method->admin_name(),
298 298
 					'class' => $payment_method->active() ? 'gateway-active' : '',
299
-					'href'  => 'espresso_' . $payment_method->slug() . '_payment_settings',
300
-					'title' => __( 'Modify this Payment Method', 'event_espresso' ),
299
+					'href'  => 'espresso_'.$payment_method->slug().'_payment_settings',
300
+					'title' => __('Modify this Payment Method', 'event_espresso'),
301 301
 					'slug'  => $payment_method->slug()
302 302
 				);
303 303
 			}
304 304
 		}
305
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
305
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
306 306
 		$this->display_admin_page_with_sidebar();
307 307
 
308 308
 	}
@@ -313,20 +313,20 @@  discard block
 block discarded – undo
313 313
 	 *   _get_active_payment_method_slug
314 314
 	 * 	@return string
315 315
 	 */
316
-	protected function _get_active_payment_method_slug(){
316
+	protected function _get_active_payment_method_slug() {
317 317
 		$payment_method_slug = FALSE;
318 318
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
319
-		if ( isset( $this->_req_data['payment_method'] )) {
319
+		if (isset($this->_req_data['payment_method'])) {
320 320
 			// if they provided the current payment method, use it
321
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
321
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
322 322
 		}
323
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
323
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
324 324
 		// if that didn't work or wasn't provided, find another way to select the current pm
325
-		if ( ! $this->_verify_payment_method( $payment_method )) {
325
+		if ( ! $this->_verify_payment_method($payment_method)) {
326 326
 			// like, looking for an active one
327
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
327
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
328 328
 			// test that one as well
329
-			if ( $this->_verify_payment_method( $payment_method )) {
329
+			if ($this->_verify_payment_method($payment_method)) {
330 330
 				$payment_method_slug = $payment_method->slug();
331 331
 			} else {
332 332
 				$payment_method_slug = 'paypal_standard';
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 	 * @param \EE_Payment_Method $payment_method
345 345
 	 * @return boolean
346 346
 	 */
347
-	protected function _verify_payment_method( $payment_method ){
347
+	protected function _verify_payment_method($payment_method) {
348 348
 		if (
349 349
 			$payment_method instanceof EE_Payment_Method &&
350 350
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
351
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
351
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
352 352
 		) {
353 353
 			return TRUE;
354 354
 		}
@@ -365,21 +365,21 @@  discard block
 block discarded – undo
365 365
 	 * @return string
366 366
 	 * @throws EE_Error
367 367
 	 */
368
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
369
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
370
-		if ( ! $payment_method instanceof EE_Payment_Method ){
371
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
368
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
369
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
370
+		if ( ! $payment_method instanceof EE_Payment_Method) {
371
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
372 372
 		}
373 373
 		$payment_method_scopes = $payment_method->active();
374 374
 		// if the payment method really exists show its form, otherwise the activation template
375
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
376
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
377
-				if ( $form->form_data_present_in( $this->_req_data )) {
378
-					$form->receive_form_submission( $this->_req_data );
375
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
376
+				$form = $this->_generate_payment_method_settings_form($payment_method);
377
+				if ($form->form_data_present_in($this->_req_data)) {
378
+					$form->receive_form_submission($this->_req_data);
379 379
 				}
380
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
380
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
381 381
 		} else {
382
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
382
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
383 383
 		}
384 384
 	}
385 385
 
@@ -392,14 +392,14 @@  discard block
 block discarded – undo
392 392
 	 * @param \EE_Payment_Method $payment_method
393 393
 	 * @return \EE_Form_Section_Proper
394 394
 	 */
395
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
396
-		if ( ! $payment_method instanceof EE_Payment_Method ){
395
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
396
+		if ( ! $payment_method instanceof EE_Payment_Method) {
397 397
 			return new EE_Form_Section_Proper();
398 398
 		}
399 399
 		return new EE_Form_Section_Proper(
400 400
 			array(
401
-				'name' 	=> $payment_method->slug() . '_settings_form',
402
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
401
+				'name' 	=> $payment_method->slug().'_settings_form',
402
+				'html_id' 	=> $payment_method->slug().'_settings_form',
403 403
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
404 404
 					array(
405 405
 						'action' 						=> 'update_payment_method',
@@ -411,12 +411,12 @@  discard block
 block discarded – undo
411 411
 				'subsections' 			=> apply_filters(
412 412
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
413 413
 					array(
414
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
415
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
416
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
417
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
418
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
419
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
414
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
415
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
416
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
417
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
418
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
419
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
420 420
 					),
421 421
 					$payment_method
422 422
 				)
@@ -433,19 +433,19 @@  discard block
 block discarded – undo
433 433
 	 * @param \EE_Payment_Method $payment_method
434 434
 	 * @return \EE_Form_Section_Proper
435 435
 	 */
436
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
437
-		if ( $payment_method->type_obj()->requires_https() ) {
436
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
437
+		if ($payment_method->type_obj()->requires_https()) {
438 438
 			return new EE_Form_Section_HTML(
439 439
 				EEH_HTML::tr(
440 440
 					EEH_HTML::th(
441 441
 						EEH_HTML::label(
442
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
442
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
443 443
 						)
444
-					) .
444
+					).
445 445
 					EEH_HTML::td(
446
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
447
-						EEH_HTML::br() .
448
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
446
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
447
+						EEH_HTML::br().
448
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
449 449
 					)
450 450
 				)
451 451
 			);
@@ -463,19 +463,19 @@  discard block
 block discarded – undo
463 463
 	 * @param \EE_Payment_Method $payment_method
464 464
 	 * @return \EE_Form_Section_Proper
465 465
 	 */
466
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
467
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
466
+	protected function _currency_support(EE_Payment_Method $payment_method) {
467
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
468 468
 			return new EE_Form_Section_HTML(
469 469
 				EEH_HTML::tr(
470 470
 					EEH_HTML::th(
471 471
 						EEH_HTML::label(
472
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
472
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
473 473
 						)
474
-					) .
474
+					).
475 475
 					EEH_HTML::td(
476 476
 						EEH_HTML::strong(
477 477
 							sprintf(
478
-								__( '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'),
478
+								__('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'),
479 479
 								EE_Config::instance()->currency->code
480 480
 							)
481 481
 						)
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
 	 * @param \EE_Payment_Method $payment_method
496 496
 	 * @return \EE_Form_Section_HTML
497 497
 	 */
498
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
498
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
499 499
 		//modify the form so we only have/show fields that will be implemented for this version
500
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
500
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
501 501
 	}
502 502
 
503 503
 
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
 	 * @return \EE_Payment_Method_Form
511 511
 	 * @throws \EE_Error
512 512
 	 */
513
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
514
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
513
+	protected function _simplify_form($form_section, $payment_method_name = '') {
514
+		if ($form_section instanceof EE_Payment_Method_Form) {
515 515
 			$form_section->exclude(
516 516
 				array(
517 517
 					'PMD_type', //dont want them changing the type
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 			);
523 523
 			return $form_section;
524 524
 		} else {
525
-			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 ));
525
+			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));
526 526
 		}
527 527
 	}
528 528
 
@@ -535,18 +535,18 @@  discard block
 block discarded – undo
535 535
 	 * @param \EE_Payment_Method $payment_method
536 536
 	 * @return \EE_Form_Section_HTML
537 537
 	 */
538
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
538
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
539 539
 		$update_button = new EE_Submit_Input(
540 540
 			array(
541
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
542
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
541
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
542
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
543 543
 				'html_label' => EEH_HTML::nbsp()
544 544
 			)
545 545
 		);
546 546
 		return new EE_Form_Section_HTML(
547
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
547
+			EEH_HTML::no_row(EEH_HTML::br(2)).
548 548
 			EEH_HTML::tr(
549
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
549
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
550 550
 				EEH_HTML::td(
551 551
 					$update_button->get_html_for_input()
552 552
 				)
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
 	 * @param \EE_Payment_Method $payment_method
564 564
 	 * @return \EE_Form_Section_Proper
565 565
 	 */
566
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
567
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
566
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
567
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
568 568
 		return new EE_Form_Section_HTML(
569 569
 			EEH_HTML::tr(
570
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
570
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
571 571
 				EEH_HTML::td(
572 572
 					EEH_HTML::link(
573 573
 						EE_Admin_Page::add_query_args_and_nonce(
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 						),
580 580
 						$link_text_and_title,
581 581
 						$link_text_and_title,
582
-						'deactivate_' . $payment_method->slug(),
582
+						'deactivate_'.$payment_method->slug(),
583 583
 						'espresso-button button-secondary'
584 584
 					)
585 585
 				)
@@ -595,12 +595,12 @@  discard block
 block discarded – undo
595 595
 	 * @param \EE_Payment_Method $payment_method
596 596
 	 * @return \EE_Form_Section_Proper
597 597
 	 */
598
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
599
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
598
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
599
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
600 600
 		return new EE_Form_Section_Proper(
601 601
 			array(
602
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
603
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
602
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
603
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
604 604
 				'action' 	=> '#',
605 605
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
606 606
 				'subsections' 			=> apply_filters(
@@ -609,8 +609,8 @@  discard block
 block discarded – undo
609 609
 						new EE_Form_Section_HTML(
610 610
 							EEH_HTML::tr(
611 611
 								EEH_HTML::th(
612
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
613
-								) .
612
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
613
+								).
614 614
 								EEH_HTML::td(
615 615
 									EEH_HTML::link(
616 616
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 										),
623 623
 										$link_text_and_title,
624 624
 										$link_text_and_title,
625
-										'activate_' . $payment_method->slug(),
625
+										'activate_'.$payment_method->slug(),
626 626
 										'espresso-button-green button-primary'
627 627
 									)
628 628
 								)
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
 	protected function _fine_print() {
645 645
 		return new EE_Form_Section_HTML(
646 646
 			EEH_HTML::tr(
647
-				EEH_HTML::th() .
647
+				EEH_HTML::th().
648 648
 				EEH_HTML::td(
649
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
649
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
650 650
 				)
651 651
 			)
652 652
 		);
@@ -658,15 +658,15 @@  discard block
 block discarded – undo
658 658
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
659 659
 	 * @global WP_User $current_user
660 660
 	 */
661
-	protected function _activate_payment_method(){
662
-		if(isset($this->_req_data['payment_method_type'])){
661
+	protected function _activate_payment_method() {
662
+		if (isset($this->_req_data['payment_method_type'])) {
663 663
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
664 664
 			//see if one exists
665
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
666
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
665
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
666
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
667 667
 
668
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
669
-		}else{
668
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
669
+		} else {
670 670
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
671 671
 		}
672 672
 	}
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 	/**
675 675
 	 * Deactivates the payment method with the specified slug, and redirects.
676 676
 	 */
677
-	protected function _deactivate_payment_method(){
678
-		if(isset($this->_req_data['payment_method'])){
677
+	protected function _deactivate_payment_method() {
678
+		if (isset($this->_req_data['payment_method'])) {
679 679
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
680 680
 			//deactivate it
681 681
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
682
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
683
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
684
-		}else{
682
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
683
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
684
+		} else {
685 685
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
686 686
 		}
687 687
 	}
@@ -695,39 +695,39 @@  discard block
 block discarded – undo
695 695
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
696 696
 	 * @return void
697 697
 	 */
698
-	protected function _update_payment_method(){
699
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
698
+	protected function _update_payment_method() {
699
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
700 700
 			//ok let's find which gateway form to use based on the form input
701 701
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
702 702
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
703 703
 			$correct_pmt_form_to_use = NULL;
704 704
 			$pmt_obj = NULL;
705
-			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){
705
+			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
706 706
 				/** @var $pmt_obj EE_PMT_Base */
707 707
 				//get the form and simplify it, like what we do when we display it
708 708
 				$pmt_form = $pmt_obj->settings_form();
709 709
 				$this->_simplify_form($pmt_form);
710
-				if($pmt_form->form_data_present_in($this->_req_data)){
710
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
711 711
 					$correct_pmt_form_to_use = $pmt_form;
712 712
 					break;
713 713
 				}
714 714
 			}
715 715
 			//if we couldn't find the correct payment method type...
716
-			if( ! $correct_pmt_form_to_use ){
716
+			if ( ! $correct_pmt_form_to_use) {
717 717
 				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__);
718 718
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
719 719
 			}
720 720
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
721
-			if($correct_pmt_form_to_use->is_valid()){
721
+			if ($correct_pmt_form_to_use->is_valid()) {
722 722
 				$correct_pmt_form_to_use->save();
723 723
 				$pm = $correct_pmt_form_to_use->get_model_object();
724 724
 				/** @var $pm EE_Payment_Method */
725
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
726
-			}else{
725
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug()));
726
+			} else {
727 727
 				EE_Error::add_error(
728 728
 					sprintf(
729 729
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
730
-						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )
730
+						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso')
731 731
 					),
732 732
 					__FILE__,
733 733
 					__FUNCTION__,
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
 	protected function _payment_settings() {
745 745
 
746 746
 		$this->_template_args['values'] = $this->_yes_no_values;
747
-		$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;
747
+		$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;
748 748
 
749
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
750
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
751
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
749
+		$this->_set_add_edit_form_tags('update_payment_settings');
750
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
751
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
752 752
 		$this->display_admin_page_with_sidebar();
753 753
 
754 754
 	}
@@ -762,13 +762,13 @@  discard block
 block discarded – undo
762 762
 	*		@return array
763 763
 	*/
764 764
 	protected function _update_payment_settings() {
765
-		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;
766
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
765
+		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;
766
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
767 767
 
768 768
 
769
-		$what = __('Payment Settings','event_espresso');
770
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
771
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
769
+		$what = __('Payment Settings', 'event_espresso');
770
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
771
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
772 772
 
773 773
 	}
774 774
 	protected function _payment_log_overview_list_table() {
@@ -794,18 +794,18 @@  discard block
 block discarded – undo
794 794
 	 * @param bool $count
795 795
 	 * @return array
796 796
 	 */
797
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
798
-		EE_Registry::instance()->load_model( 'Change_Log' );
797
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
798
+		EE_Registry::instance()->load_model('Change_Log');
799 799
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
800
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
800
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
801 801
 		//check if they've selected a specific payment method
802
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
802
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
803 803
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
804 804
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
805 805
 		}
806 806
 		//take into account search
807
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
808
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
807
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
808
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
809 809
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
810 810
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
811 811
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -820,48 +820,48 @@  discard block
 block discarded – undo
820 820
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
821 821
 
822 822
 		}
823
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
823
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
824 824
 			//add date
825
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
826
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
825
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
826
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
827 827
 			//make sure our timestamps start and end right at the boundaries for each day
828
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
829
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
828
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
829
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
830 830
 
831 831
 			//convert to timestamps
832
-			$start_date = strtotime( $start_date );
833
-			$end_date = strtotime( $end_date );
832
+			$start_date = strtotime($start_date);
833
+			$end_date = strtotime($end_date);
834 834
 
835 835
 			//makes sure start date is the lowest value and vice versa
836
-			$start_date = min( $start_date, $end_date );
837
-			$end_date = max( $start_date, $end_date );
836
+			$start_date = min($start_date, $end_date);
837
+			$end_date = max($start_date, $end_date);
838 838
 
839 839
 			//convert for query
840
-			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
841
-			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
840
+			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
841
+			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
842 842
 
843
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
843
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
844 844
 
845 845
 		}
846
-		if($count){
846
+		if ($count) {
847 847
 			return EEM_Change_Log::instance()->count($query_params);
848 848
 		}
849
-		if(isset($this->_req_data['order'])){
850
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
849
+		if (isset($this->_req_data['order'])) {
850
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
851 851
 			$query_params['order_by'] = array('LOG_time' => $sort);
852
-		}else{
852
+		} else {
853 853
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
854 854
 		}
855
-		$offset = ($current_page-1)*$per_page;
855
+		$offset = ($current_page - 1) * $per_page;
856 856
 
857
-		if( ! isset($this->_req_data['download_results'])){
858
-			$query_params['limit'] = array( $offset, $per_page );
857
+		if ( ! isset($this->_req_data['download_results'])) {
858
+			$query_params['limit'] = array($offset, $per_page);
859 859
 		}
860 860
 
861 861
 
862 862
 
863 863
 		//now they've requested to instead just download the file instead of viewing it.
864
-		if(isset($this->_req_data['download_results'])){
864
+		if (isset($this->_req_data['download_results'])) {
865 865
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
866 866
 			header('Content-Disposition: attachment');
867 867
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -883,36 +883,36 @@  discard block
 block discarded – undo
883 883
 	 * @param EE_Change_Log $logB
884 884
 	 * @return int
885 885
 	 */
886
-	protected function _sort_logs_again($logA,$logB){
886
+	protected function _sort_logs_again($logA, $logB) {
887 887
 		$timeA = $logA->get_raw('LOG_time');
888 888
 		$timeB = $logB->get_raw('LOG_time');
889
-		if($timeA == $timeB){
889
+		if ($timeA == $timeB) {
890 890
 			return 0;
891 891
 		}
892 892
 		$comparison = $timeA < $timeB ? -1 : 1;
893
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
893
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
894 894
 			return $comparison * -1;
895
-		}else{
895
+		} else {
896 896
 			return $comparison;
897 897
 		}
898 898
 	}
899 899
 
900 900
 	protected function _payment_log_details() {
901
-		EE_Registry::instance()->load_model( 'Change_Log' );
901
+		EE_Registry::instance()->load_model('Change_Log');
902 902
 		/** @var $payment_log EE_Change_Log */
903 903
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
904 904
 		$payment_method = NULL;
905 905
 		$transaction = NULL;
906
-		if( $payment_log instanceof EE_Change_Log ){
907
-			if( $payment_log->object() instanceof EE_Payment ){
906
+		if ($payment_log instanceof EE_Change_Log) {
907
+			if ($payment_log->object() instanceof EE_Payment) {
908 908
 				$payment_method = $payment_log->object()->payment_method();
909 909
 				$transaction = $payment_log->object()->transaction();
910
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
910
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
911 911
 				$payment_method = $payment_log->object();
912 912
 			}
913 913
 		}
914 914
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
915
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
915
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
916 916
 			array(
917 917
 				'payment_log'=>$payment_log,
918 918
 				'payment_method'=>$payment_method,
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   +84 added lines, -84 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
 
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 		$this->_columns = array(
68
-			'TXN_ID' => __( 'ID', 'event_espresso' ),
69
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
70
-			'TXN_total' => __( 'Total', 'event_espresso' ),
71
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
72
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
73
-			'event_name' => __( 'Event', 'event_espresso' ),
74
-			'actions' => __( 'Actions', 'event_espresso' )
68
+			'TXN_ID' => __('ID', 'event_espresso'),
69
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
70
+			'TXN_total' => __('Total', 'event_espresso'),
71
+			'TXN_paid' => __('Paid', 'event_espresso'),
72
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
73
+			'event_name' => __('Event', 'event_espresso'),
74
+			'actions' => __('Actions', 'event_espresso')
75 75
 		);
76 76
 
77 77
 		$this->_sortable_columns = array(
78
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
79
-			'event_name' => array( 'event_name'=> FALSE ),
80
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
81
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
78
+			'TXN_ID' => array('TXN_ID' => FALSE),
79
+			'event_name' => array('event_name'=> FALSE),
80
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
81
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
82 82
 		);
83 83
 
84 84
 		$this->_primary_column = 'TXN_ID';
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 
90 90
 
91
-	protected function _get_row_class( $item ) {
92
-		$class = parent::_get_row_class( $item );
91
+	protected function _get_row_class($item) {
92
+		$class = parent::_get_row_class($item);
93 93
 		//add status class
94
-		$class .= ' ee-status-strip txn-status-' . $item->status_ID();
95
-		if ( $this->_has_checkbox_column ) {
94
+		$class .= ' ee-status-strip txn-status-'.$item->status_ID();
95
+		if ($this->_has_checkbox_column) {
96 96
 			$class .= ' has-checkbox-column';
97 97
 		}
98 98
 		return $class;
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	protected function _get_table_filters() {
111 111
 		$filters = array();
112
-		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
113
-		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
112
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
113
+		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
114 114
 		ob_start();
115 115
 		?>
116 116
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 
130 130
 	protected function _add_view_counts() {
131
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
132
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
133
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
131
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
132
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
133
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
134 134
 	}
135 135
 
136 136
 
@@ -139,29 +139,29 @@  discard block
 block discarded – undo
139 139
 	 * @param \EE_Transaction $item
140 140
 	 * @return string
141 141
 	 */
142
-   function column_TXN_ID( EE_Transaction $item ){
143
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
144
-	   $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
142
+   function column_TXN_ID(EE_Transaction $item) {
143
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
144
+	   $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
145 145
 
146 146
 	   //txn timestamp
147
-	   $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>';
147
+	   $content .= '  <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';
148 148
 	   return $content;
149 149
 	}
150 150
 
151 151
 
152 152
 
153
-	protected function _get_txn_timestamp( EE_Transaction $item ) {
153
+	protected function _get_txn_timestamp(EE_Transaction $item) {
154 154
 		//txn timestamp
155 155
 		// is TXN less than 2 hours old ?
156 156
 		if (
157
-			( ( time() - EE_Registry::instance()->SSN->lifespan() )
158
-			< $item->datetime( false, true )
157
+			((time() - EE_Registry::instance()->SSN->lifespan())
158
+			< $item->datetime(false, true)
159 159
 			)
160
-		&& ( $item->failed() || $item->is_abandoned() )
160
+		&& ($item->failed() || $item->is_abandoned())
161 161
 		) {
162
-			$timestamp = __( 'TXN in progress...', 'event_espresso' );
162
+			$timestamp = __('TXN in progress...', 'event_espresso');
163 163
 	   } else {
164
-			$timestamp = $item->get_i18n_datetime( 'TXN_timestamp' );
164
+			$timestamp = $item->get_i18n_datetime('TXN_timestamp');
165 165
 		}
166 166
 		return $timestamp;
167 167
 	}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param \EE_Transaction $item
174 174
 	 * @return string
175 175
 	 */
176
-	function column_cb($item ){
177
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
176
+	function column_cb($item) {
177
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
178 178
 	}
179 179
 
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 * @param \EE_Transaction $item
186 186
 	 * @return string
187 187
 	 */
188
-	function column_TXN_timestamp( EE_Transaction $item ){
189
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
190
-		$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>';
188
+	function column_TXN_timestamp(EE_Transaction $item) {
189
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
190
+		$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>';
191 191
 		//status
192
-		$txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
192
+		$txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
193 193
 		return $txn_date;
194 194
 	}
195 195
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @param \EE_Transaction $item
200 200
 	 * @return string
201 201
 	 */
202
-	function column_TXN_total( EE_Transaction $item ){
203
-		if ( $item->get('TXN_total') > 0 ) {
204
-			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>';
202
+	function column_TXN_total(EE_Transaction $item) {
203
+		if ($item->get('TXN_total') > 0) {
204
+			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>';
205 205
 		} else {
206
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
206
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
207 207
 		}
208 208
 	}
209 209
 
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 	 * @param \EE_Transaction $item
214 214
 	 * @return mixed|string
215 215
 	 */
216
-	function column_TXN_paid( EE_Transaction $item ){
216
+	function column_TXN_paid(EE_Transaction $item) {
217 217
 		$transaction_total = $item->get('TXN_total');
218 218
 		$transaction_paid = $item->get('TXN_paid');
219 219
 
220
-		if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) {
220
+		if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) {
221 221
 			// paid in full
222 222
 			$span_class = 'txn-overview-full-payment-spn';
223 223
 
224
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) {
224
+		} elseif (($transaction_total > 0) && ($transaction_paid > 0)) {
225 225
 			// monies owing
226 226
 			$span_class = 'txn-overview-part-payment-spn';
227 227
 
228
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) {
228
+		} elseif (($transaction_total > 0) && ($transaction_paid == 0)) {
229 229
 			// no payments made
230 230
 			$span_class = 'txn-overview-no-payment-spn';
231 231
 
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 		}
236 236
 
237 237
 		$payment_method = $item->payment_method();
238
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
238
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
239 239
 
240
-		$content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
241
-		if ( $transaction_paid > 0 ) {
242
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
240
+		$content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
241
+		if ($transaction_paid > 0) {
242
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
243 243
 		}
244 244
 		return $content;
245 245
 	}
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 	 * @param \EE_Transaction $item
251 251
 	 * @return string|void
252 252
 	 */
253
-	function column_ATT_fname( EE_Transaction $item ){
253
+	function column_ATT_fname(EE_Transaction $item) {
254 254
 		$primary_reg = $item->primary_registration();
255 255
 		$attendee = $primary_reg->get_first_related('Attendee');
256
-		if ( $attendee instanceof EE_Attendee ) {
257
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
258
-			$content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
259
-			$content .= '<br>' . $attendee->email();
256
+		if ($attendee instanceof EE_Attendee) {
257
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
258
+			$content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
259
+			$content .= '<br>'.$attendee->email();
260 260
 			return $content;
261 261
 		}
262 262
 		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 * @param \EE_Transaction $item
269 269
 	 * @return string|void
270 270
 	 */
271
-	function column_ATT_email( EE_Transaction $item ){
271
+	function column_ATT_email(EE_Transaction $item) {
272 272
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
273
-		if ( !empty( $attendee ) )
274
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
273
+		if ( ! empty($attendee))
274
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
275 275
 		else
276 276
 			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
277 277
 		;
@@ -283,20 +283,20 @@  discard block
 block discarded – undo
283 283
 	 * @param \EE_Transaction $item
284 284
 	 * @return string|void
285 285
 	 */
286
-    function column_event_name( EE_Transaction $item ){
286
+    function column_event_name(EE_Transaction $item) {
287 287
     	$actions = array();
288 288
 		$event = $item->primary_registration()->get_first_related('Event');
289
-		if ( !empty( $event ) ) {
290
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
289
+		if ( ! empty($event)) {
290
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
291 291
 			$event_name = $event->get('EVT_name');
292 292
 
293 293
 			//filter this view by transactions for this event
294
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
295
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
296
-				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
294
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
295
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
296
+				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
297 297
 			}
298 298
 
299
-			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) );
299
+			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
300 300
 		} else {
301 301
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
302 302
 		}
@@ -308,33 +308,33 @@  discard block
 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 313
     	$registration = $item->primary_registration();
314 314
     	$attendee = $registration->attendee();
315
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
315
+		EE_Registry::instance()->load_helper('MSG_Template');
316 316
 
317 317
         //Build row actions
318
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
318
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
319 319
 		$dl_invoice_lnk_url = $registration->invoice_url();
320 320
 		$dl_receipt_lnk_url = $registration->receipt_url();
321
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
322
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
321
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
322
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
323 323
 
324 324
 		//Build row actions
325 325
 		$view_lnk = '
326 326
 			<li>
327
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
327
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
328 328
 					<span class="dashicons dashicons-cart"></span>
329 329
 				</a>
330 330
 			</li>';
331 331
 
332 332
 
333 333
 	//only show invoice link if message type is active.
334
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
334
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
335 335
 		$dl_invoice_lnk = '
336 336
 		<li>
337
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
337
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
338 338
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
339 339
 			</a>
340 340
 		</li>';
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 	}
344 344
 
345 345
 	//only show receipt link if message type is active.
346
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
346
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
347 347
 		$dl_receipt_lnk = '
348 348
 		<li>
349
-			<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
349
+			<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
350 350
 				<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
351 351
 			</a>
352 352
 		</li>';
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
 	}
356 356
 
357 357
       		//only show payment reminder link if the message type is active.
358
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
359
-		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
358
+      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
359
+		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? '
360 360
 			<li>
361
-				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
361
+				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
362 362
 					<span class="dashicons dashicons-email-alt"></span>
363 363
 				</a>
364 364
 			</li>' : '';
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 			$send_pay_lnk = '';
368 368
 		}
369 369
 
370
-		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
370
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
371 371
 			<li>
372
-				<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
372
+				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
373 373
 					<span class="dashicons dashicons-clipboard"></span>
374 374
 				</a>
375 375
 			</li>' : '';
376 376
 
377
-	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
377
+	return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul');
378 378
     }
379 379
 
380 380
 
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   +41 added lines, -41 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,39 +140,39 @@  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 172
 
173
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
174
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
175
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
173
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
174
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
175
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
176 176
 
177 177
 	}
178 178
 
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function create_new_custom() {
188 188
 
189
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
190
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
189
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
190
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
191 191
 		}
192 192
 
193 193
 		//let's clean up the _POST global a bit for downstream usage of name and description.
194
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
195
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
194
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
195
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
196 196
 
197 197
 
198 198
 		//set EE_Admin_Page object (see method details in EE_Admin_Hooks parent
199 199
 		$this->_set_page_object();
200 200
 
201 201
 		//is this a template switch if so EE_Admin_Page child needs this object
202
-		$this->_page_object->set_hook_object( $this );
202
+		$this->_page_object->set_hook_object($this);
203 203
 
204
-		$this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] );
204
+		$this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']);
205 205
 	}
206 206
 
207 207
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @return string (admin_footer contents)
217 217
 	 */
218 218
 	public function edit_admin_footer() {
219
-		$template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php';
219
+		$template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php';
220 220
 		EEH_Template::display_template($template_path, array());
221 221
 	}
222 222
 
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.
caffeinated/brewing_regular.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 	/**
57 57
 	 * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths
58 58
 	 * @param array  $paths original helper paths array
59
-	 * @return array             new array of paths
59
+	 * @return string[]             new array of paths
60 60
 	 */
61 61
 	public function caf_helper_paths( $paths ) {
62 62
 		$paths[] = EE_CAF_CORE . 'helpers' . DS;
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -25,30 +25,30 @@  discard block
 block discarded – undo
25 25
  * ------------------------------------------------------------------------
26 26
  */
27 27
 // defined some new constants related to caffeinated folder
28
-define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' );
29
-define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS);
30
-define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS);
31
-define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS );
28
+define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/');
29
+define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS);
30
+define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS);
31
+define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS);
32 32
 class EE_Brewing_Regular extends EE_Base {
33 33
 
34 34
 	public function __construct() {
35
-		if ( defined( 'EE_CAFF_PATH' )) {
35
+		if (defined('EE_CAFF_PATH')) {
36 36
 			// activation
37
-			add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ));
37
+			add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content'));
38 38
 			// load caff init
39
-			add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ));
39
+			add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init'));
40 40
 			// make it so the PDF receipt doesn't show our shameless plug
41
-			add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' );
41
+			add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false');
42 42
 			// add caffeinated modules
43
-			add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' ));
43
+			add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register'));
44 44
 			// load caff scripts
45
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 );
45
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10);
46 46
 
47
-			add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 );
47
+			add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10);
48 48
 
49
-			add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) );
49
+			add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods'));
50 50
 			// caffeinated constructed
51
-			do_action( 'AHEE__EE_Brewing_Regular__construct__complete' );
51
+			do_action('AHEE__EE_Brewing_Regular__construct__complete');
52 52
 		}
53 53
 	}
54 54
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @param array  $paths original helper paths array
59 59
 	 * @return array             new array of paths
60 60
 	 */
61
-	public function caf_helper_paths( $paths ) {
62
-		$paths[] = EE_CAF_CORE . 'helpers' . DS;
61
+	public function caf_helper_paths($paths) {
62
+		$paths[] = EE_CAF_CORE.'helpers'.DS;
63 63
 		return $paths;
64 64
 	}
65 65
 
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 	 * Right now, we ASSUME the only price types in the system are default ones
76 76
 	 * @global type $wpdb
77 77
 	 */
78
-	function initialize_caf_db_content(){
78
+	function initialize_caf_db_content() {
79 79
 //		echo "initialize caf db content!";
80 80
 		global $wpdb;
81 81
 
82 82
 		//use same method of getting creator id as the version introducing the change
83
-		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id());
83
+		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id());
84 84
 
85 85
 		$price_type_table = $wpdb->prefix."esp_price_type";
86 86
 		$price_table = $wpdb->prefix."esp_price";
87 87
 
88 88
 		if ($wpdb->get_var("SHOW TABLES LIKE '$price_type_table'") == $price_type_table) {
89 89
 
90
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types
91
-			$tax_price_type_count = $wpdb->get_var( $SQL );
90
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types
91
+			$tax_price_type_count = $wpdb->get_var($SQL);
92 92
 
93
-			if ( $tax_price_type_count <= 1) {
93
+			if ($tax_price_type_count <= 1) {
94 94
 				$result = $wpdb->insert($price_type_table,
95 95
 						array(
96 96
 							'PRT_name'=>  __("Regional Tax", "event_espresso"),
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 							'PRT_wp_user' => $default_creator_id
102 102
 						),
103 103
 						array(
104
-							'%s',//PRT_name
105
-							'%d',//PBT_id
106
-							'%d',//PRT_is_percent
107
-							'%d',//PRT_order
108
-							'%d',//PRT_deleted
104
+							'%s', //PRT_name
105
+							'%d', //PBT_id
106
+							'%d', //PRT_is_percent
107
+							'%d', //PRT_order
108
+							'%d', //PRT_deleted
109 109
 							'%d', //PRT_wp_user
110 110
 						));
111 111
 				//federal tax
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 							'PRT_wp_user' => $default_creator_id,
120 120
 						),
121 121
 						array(
122
-							'%s',//PRT_name
123
-							'%d',//PBT_id
124
-							'%d',//PRT_is_percent
125
-							'%d',//PRT_order
126
-							'%d',//PRT_deleted
122
+							'%s', //PRT_name
123
+							'%d', //PBT_id
124
+							'%d', //PRT_is_percent
125
+							'%d', //PRT_order
126
+							'%d', //PRT_deleted
127 127
 							'%d' //PRT_wp_user
128 128
 						));
129
-				if( $result){
129
+				if ($result) {
130 130
 					$wpdb->insert($price_table,
131 131
 							array(
132 132
 								'PRT_ID'=>$wpdb->insert_id,
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 								'PRC_wp_user' => $default_creator_id
142 142
 							),
143 143
 							array(
144
-								'%d',//PRT_id
145
-								'%f',//PRC_amount
146
-								'%s',//PRC_name
147
-								'%s',//PRC_desc
148
-								'%d',//PRC_is_default
149
-								'%d',//PRC_overrides
150
-								'%d',//PRC_deleted
151
-								'%d',//PRC_order
152
-								'%d',//PRC_parent
144
+								'%d', //PRT_id
145
+								'%f', //PRC_amount
146
+								'%s', //PRC_name
147
+								'%s', //PRC_desc
148
+								'%d', //PRC_is_default
149
+								'%d', //PRC_overrides
150
+								'%d', //PRC_deleted
151
+								'%d', //PRC_order
152
+								'%d', //PRC_parent
153 153
 								'%d' //PRC_wp_user
154 154
 							));
155 155
 				}
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 	 *  	@param array $modules_to_register
170 170
 	 *  	@return array
171 171
 	 */
172
-	public function caffeinated_modules_to_register( $modules_to_register = array() ){
173
-		if ( is_readable( EE_CAFF_PATH . 'modules' )) {
174
-			$caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR );
175
-			if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) {
176
-				$modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register );
172
+	public function caffeinated_modules_to_register($modules_to_register = array()) {
173
+		if (is_readable(EE_CAFF_PATH.'modules')) {
174
+			$caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR);
175
+			if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
176
+				$modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
177 177
 			}
178 178
 		}
179 179
 		return $modules_to_register;
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 
182 182
 
183 183
 
184
-	public function caffeinated_init(){
184
+	public function caffeinated_init() {
185 185
 		// EE_Register_CPTs hooks
186
-		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 );
187
-		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 );
188
-		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 );
189
-		EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE );
186
+		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10);
187
+		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10);
188
+		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10);
189
+		EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE);
190 190
 		// caffeinated_init__complete hook
191
-		do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' );
191
+		do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
192 192
 	}
193 193
 
194 194
 
195 195
 
196
-	public function enqueue_caffeinated_scripts(){
196
+	public function enqueue_caffeinated_scripts() {
197 197
 		// sound of crickets...
198 198
 	}
199 199
 
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
 	 * callbacks below here
203 203
 	 */
204 204
 
205
-	public function filter_taxonomies( $taxonomy_array ) {
205
+	public function filter_taxonomies($taxonomy_array) {
206 206
 		$taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE;
207 207
 		return $taxonomy_array;
208 208
 	}
209 209
 
210 210
 
211 211
 
212
-	public function filter_cpts( $cpt_array ) {
212
+	public function filter_cpts($cpt_array) {
213 213
 		$cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE;
214 214
 		return $cpt_array;
215 215
 	}
216 216
 
217 217
 
218
-	public function nav_metabox_items( $menuitems ) {
218
+	public function nav_metabox_items($menuitems) {
219 219
 		$menuitems[] = array(
220 220
 			'title' => __('Venue List', 'event_espresso'),
221
-			'url' => get_post_type_archive_link( 'espresso_venues' ),
221
+			'url' => get_post_type_archive_link('espresso_venues'),
222 222
 			'description' => __('Archive page for all venues.', 'event_espresso')
223 223
 			);
224 224
 		return $menuitems;
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 * @param array $payment_method_paths
230 230
 	 * @return array values are folder paths to payment method folders
231 231
 	 */
232
-	public function caf_payment_methods( $payment_method_paths ) {
233
-		$caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
234
-		$payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths );
232
+	public function caf_payment_methods($payment_method_paths) {
233
+		$caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
234
+		$payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths);
235 235
 		return $payment_method_paths;
236 236
 	}
237 237
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  *
Please login to merge, or discard this patch.
caffeinated/EE_Caf_Messages.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	/**
73 73
 	 * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the messages system.
74 74
 	 * @param  array  $dir_ref original array of paths
75
-	 * @return array           appended paths
75
+	 * @return string[]           appended paths
76 76
 	 */
77 77
 	public function messages_autoload_paths( $dir_ref ) {
78 78
 		$dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/';
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @since            4.3.2
16 16
  * @author          Darren Ethier
17 17
  */
18
-class EE_Caf_Messages  {
18
+class EE_Caf_Messages {
19 19
 
20 20
 
21 21
 	/**
@@ -34,36 +34,36 @@  discard block
 block discarded – undo
34 34
 	 * @return void
35 35
 	 */
36 36
 	private function _caf_hooks() {
37
-		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 );
38
-		add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 );
39
-		add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 );
40
-		add_filter( 'FHEE__EE_Html_messenger__get_template_fields', array( $this, 'html_messenger_template_fields' ), 5, 2 );
41
-		add_filter( 'FHEE__EE_Html_messenger__get_validator_config', array( $this, 'html_messenger_validator_config' ), 5, 2 );
42
-		add_filter( 'FHEE__EE_Pdf_messenger__get_template_fields', array( $this, 'pdf_messenger_template_fields' ), 5, 2 );
43
-		add_filter( 'FHEE__EE_Pdf_messenger__get_validator_config', array( $this, 'pdf_messenger_validator_config' ), 5, 2 );
44
-		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 );
45
-		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 );
37
+		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5);
38
+		add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2);
39
+		add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2);
40
+		add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, 2);
41
+		add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, 2);
42
+		add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2);
43
+		add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, 2);
44
+		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7);
45
+		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2);
46 46
 
47 47
 		//shortcode parsers
48
-		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 );
49
-		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 );
50
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 );
51
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 );
52
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 );
53
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 );
48
+		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2);
49
+		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5);
50
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2);
51
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5);
52
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2);
53
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5);
54 54
 
55 55
 		/**
56 56
 		 * @since 4.2.0
57 57
 		 */
58
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 );
59
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 );
58
+		add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2);
59
+		add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5);
60 60
 
61 61
 		/**
62 62
 		 * @since 4.3.0
63 63
 		 */
64 64
 		//eat our own dog food!
65
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) );
66
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) );
65
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types'));
66
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes'));
67 67
 		do_action('EE_Brewing_Regular___messages_caf');
68 68
 	}
69 69
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 * @param  array  $dir_ref original array of paths
75 75
 	 * @return array           appended paths
76 76
 	 */
77
-	public function messages_autoload_paths( $dir_ref ) {
78
-		$dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/';
77
+	public function messages_autoload_paths($dir_ref) {
78
+		$dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/';
79 79
 		return $dir_ref;
80 80
 	}
81 81
 
82 82
 
83 83
 
84
-	public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) {
84
+	public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) {
85 85
 		$validator_config['attendee_list'] = array(
86 86
 				'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
87 87
 				'required' => array('[ATTENDEE_LIST]')
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
 
98
-	public function html_messenger_validator_config( $validator_config, EE_Html_messenger $messenger ) {
98
+	public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) {
99 99
 		$validator_config['attendee_list'] = array(
100 100
 			'shortcodes' => array('attendee', 'question_list'),
101 101
 			'required' => array('[ATTENDEE_LIST]')
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 
111 111
 
112
-	public function pdf_messenger_validator_config( $validator_config, EE_Pdf_messenger $messenger ) {
112
+	public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) {
113 113
 		$validator_config['attendee_list'] = array(
114 114
 			'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
115 115
 			'required' => array('[ATTENDEE_LIST]')
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 
127
-	public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) {
127
+	public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) {
128 128
 		$template_fields['extra']['content']['question_list'] = array(
129 129
 						'input' => 'textarea',
130 130
 						'label' => '[QUESTION_LIST]',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 
143
-	public function html_messenger_template_fields( $template_fields, EE_Html_messenger $messenger ) {
143
+	public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) {
144 144
 		$template_fields['extra']['content']['question_list'] = array(
145 145
 			'input' => 'textarea',
146 146
 			'label' => '[QUESTION_LIST]',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 
159 159
 
160
-	public function pdf_messenger_template_fields( $template_fields, EE_Pdf_messenger $messenger ) {
160
+	public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) {
161 161
 		$template_fields['extra']['content']['question_list'] = array(
162 162
 			'input' => 'textarea',
163 163
 			'label' => '[QUESTION_LIST]',
@@ -174,39 +174,39 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 
177
-	public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack  ) {
177
+	public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) {
178 178
 
179 179
 		//we're only modifying templates for the default template pack
180
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) {
180
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) {
181 181
 			return $contents;
182 182
 		}
183 183
 
184 184
 		//the template file name we're replacing contents for.
185
-		$template_file_prefix = $field . '_' . $context;
186
-		$msg_prefix = $messenger->name . '_' . $message_type->name . '_' ;
185
+		$template_file_prefix = $field.'_'.$context;
186
+		$msg_prefix = $messenger->name.'_'.$message_type->name.'_';
187 187
 
188
-		$base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/';
188
+		$base_path = EE_CAF_LIBRARIES.'messages/defaults/default/';
189 189
 
190
-		if ( $messenger->name == 'email' && $message_type->name == 'registration' ) {
190
+		if ($messenger->name == 'email' && $message_type->name == 'registration') {
191 191
 
192
-			switch ( $template_file_prefix ) {
192
+			switch ($template_file_prefix) {
193 193
 
194 194
 				case 'question_list_admin' :
195 195
 				case 'question_list_attendee' :
196 196
 				case 'question_list_primary_attendee' :
197
-					$path = $base_path . $msg_prefix . 'question_list.template.php';
198
-					$contents = EEH_Template::display_template( $path, array(), true );
197
+					$path = $base_path.$msg_prefix.'question_list.template.php';
198
+					$contents = EEH_Template::display_template($path, array(), true);
199 199
 					break;
200 200
 
201 201
 				case 'attendee_list_primary_attendee' :
202
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
203
-					$contents = EEH_Template::display_template( $path, array(), true );
202
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
203
+					$contents = EEH_Template::display_template($path, array(), true);
204 204
 					break;
205 205
 
206 206
 				case 'attendee_list_admin' :
207
-					$path = $base_path . $msg_prefix . 'attendee_list_admin.template.php';
208
-					$contents = EEH_Template::display_template( $path,
209
-						array(), true );
207
+					$path = $base_path.$msg_prefix.'attendee_list_admin.template.php';
208
+					$contents = EEH_Template::display_template($path,
209
+						array(), true);
210 210
 					break;
211 211
 
212 212
 				case 'attendee_list_attendee' :
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
 					break;
215 215
 
216 216
 				case 'event_list_attendee' :
217
-					$path = $base_path . $msg_prefix . 'event_list_attendee.template.php';
218
-					$contents = EEH_Template::display_template( $path, array(), true );
217
+					$path = $base_path.$msg_prefix.'event_list_attendee.template.php';
218
+					$contents = EEH_Template::display_template($path, array(), true);
219 219
 					break;
220 220
 			}
221
-		} elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) {
222
-			switch( $template_file_prefix ) {
221
+		} elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') {
222
+			switch ($template_file_prefix) {
223 223
 
224 224
 				case 'content_attendee' :
225
-					$path = $base_path . $msg_prefix . 'content.template.php';
226
-					$contents = EEH_Template::display_template( $path, array(), true );
225
+					$path = $base_path.$msg_prefix.'content.template.php';
226
+					$contents = EEH_Template::display_template($path, array(), true);
227 227
 					break;
228 228
 
229 229
 				case 'newsletter_content_attendee' :
230
-					$path = $base_path . $msg_prefix . 'newsletter_content.template.php';
231
-					$contents = EEH_Template::display_template( $path, array(), true );
230
+					$path = $base_path.$msg_prefix.'newsletter_content.template.php';
231
+					$contents = EEH_Template::display_template($path, array(), true);
232 232
 					break;
233 233
 
234 234
 				case 'newsletter_subject_attendee' :
235
-					$path = $base_path . $msg_prefix . 'subject.template.php';
236
-					$contents = EEH_Template::display_template( $path, array(), true );
235
+					$path = $base_path.$msg_prefix.'subject.template.php';
236
+					$contents = EEH_Template::display_template($path, array(), true);
237 237
 					break;
238 238
 			}
239
-		} elseif ( $messenger->name == 'html' && $message_type->name == 'receipt' ) {
240
-			switch  ( $template_file_prefix ) {
239
+		} elseif ($messenger->name == 'html' && $message_type->name == 'receipt') {
240
+			switch ($template_file_prefix) {
241 241
 				case 'attendee_list_purchaser' :
242
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
243
-					$contents = EEH_Template::display_template( $path, array(), true );
242
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
243
+					$contents = EEH_Template::display_template($path, array(), true);
244 244
 					break;
245 245
 			}
246 246
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 
253 253
 
254
-	public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) {
254
+	public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) {
255 255
 		//make sure question_list and question are ONLY added for the core message types.  Any other message types will have to explicitly set question_list as a valid shortcode.
256 256
 		$include_with = array(
257 257
 			'registration',
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 			'invoice',
269 269
 			'receipt'
270 270
 			);
271
-		if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) {
271
+		if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) {
272 272
 			$contexts = array_keys($msg->get_contexts());
273
-				foreach ( $contexts as $context ) {
273
+				foreach ($contexts as $context) {
274 274
 					$valid_shortcodes[$context][] = 'question_list';
275 275
 					$valid_shortcodes[$context][] = 'question';
276 276
 				}
@@ -282,35 +282,35 @@  discard block
 block discarded – undo
282 282
 
283 283
 
284 284
 
285
-	public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) {
285
+	public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) {
286 286
 		$shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', 'event_espresso');
287 287
 		return $shortcodes;
288 288
 	}
289 289
 
290 290
 
291 291
 
292
-	public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
292
+	public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
293 293
 
294
-		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) )
294
+		if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations))
295 295
 			return $parsed;
296 296
 
297 297
 		//let's get the question from the code.
298 298
 		$shortcode = str_replace('[ANSWER_*', '', $shortcode);
299
-		$shortcode = trim( str_replace(']', '', $shortcode) );
299
+		$shortcode = trim(str_replace(']', '', $shortcode));
300 300
 
301 301
 		$registration = $data instanceof EE_Registration ? $data : null;
302
-		$registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
302
+		$registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
303 303
 
304 304
 		$aee = $data instanceof EE_Messages_Addressee ? $data : null;
305
-		$aee = ! $aee instanceof EE_Messages_Addressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee;
305
+		$aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee;
306 306
 
307
-		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) {
307
+		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) {
308 308
 			return $parsed;
309 309
 		}
310 310
 
311 311
 		//now let's figure out which question has this text.
312
-		foreach ( $aee->questions as $ansid => $question ) {
313
-			if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) {
312
+		foreach ($aee->questions as $ansid => $question) {
313
+			if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])) {
314 314
 				return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
315 315
 			}
316 316
 		}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return array                   						array of shortcodes and
333 333
 	 *                                             			descriptions
334 334
 	 */
335
-	public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) {
335
+	public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) {
336 336
 		$shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso');
337 337
 		$shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso');
338 338
 		$shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', 'event_espresso');
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
 	 * @param  EE_Datetime_Shortcodes $shortcode_parser
355 355
 	 * @return string                   The new parsed string.
356 356
 	 */
357
-	public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
357
+	public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
358 358
 
359
-		if ( ! $data instanceof EE_Datetime ) {
359
+		if ( ! $data instanceof EE_Datetime) {
360 360
 			return ''; //get out because we can only parse with the datetime object.
361 361
 		}
362 362
 
363
-		switch ( $shortcode ) {
363
+		switch ($shortcode) {
364 364
 			case '[DTT_NAME]' :
365 365
 				return $data->name();
366 366
 				break;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 				return $data->description();
369 369
 				break;
370 370
 			case '[DTT_NAME_OR_DATES]' :
371
-				return $data->get_dtt_display_name( TRUE );
371
+				return $data->get_dtt_display_name(TRUE);
372 372
 				break;
373 373
 			default :
374 374
 				return $parsed;
@@ -380,40 +380,40 @@  discard block
 block discarded – undo
380 380
 
381 381
 
382 382
 
383
-	public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) {
383
+	public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) {
384 384
 		$shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', 'event_espresso');
385 385
 		return $shortcodes;
386 386
 	}
387 387
 
388 388
 
389
-	public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
389
+	public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
390 390
 
391
-		if ( array($data) && ! isset( $data['data'] ) )
391
+		if (array($data) && ! isset($data['data']))
392 392
 			return $parsed;
393 393
 
394 394
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
395
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
395
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
396 396
 
397
-		if ( ! $recipient instanceof EE_Messages_Addressee )
397
+		if ( ! $recipient instanceof EE_Messages_Addressee)
398 398
 			return $parsed;
399 399
 
400
-		switch ( $shortcode ) {
400
+		switch ($shortcode) {
401 401
 			case '[RECIPIENT_QUESTION_LIST]' :
402 402
 				$att = $recipient->att_obj;
403 403
 				$registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array();
404
-				$registrations_on_attendee = empty( $registrations_on_attendee ) && $recipient->reg_obj instanceof EE_Registration ? array( $recipient->reg_obj ) : $registrations_on_attendee;
404
+				$registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee;
405 405
 				$answers = array();
406 406
 
407
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
407
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
408 408
 				$valid_shortcodes = array('question');
409 409
 
410 410
 				//if the context is main_content then get all answers for all registrations on this attendee
411
-				if ( $data['data'] instanceof EE_Messages_Addressee ) {
412
-					foreach ( $registrations_on_attendee as $reg ) {
413
-						if ( $reg instanceof EE_Registration ) {
414
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
415
-							foreach( $anss as $ans ) {
416
-								if ( $ans instanceof EE_Answer ) {
411
+				if ($data['data'] instanceof EE_Messages_Addressee) {
412
+					foreach ($registrations_on_attendee as $reg) {
413
+						if ($reg instanceof EE_Registration) {
414
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
415
+							foreach ($anss as $ans) {
416
+								if ($ans instanceof EE_Answer) {
417 417
 									$answers[$ans->ID()] = $ans;
418 418
 								}
419 419
 							}
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 				}
423 423
 
424 424
 				//if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event.
425
-				if ( $data['data'] instanceof EE_Event ) {
425
+				if ($data['data'] instanceof EE_Event) {
426 426
 					$event = $data['data'];
427
-					foreach( $registrations_on_attendee as $reg ) {
428
-						if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) {
429
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
430
-							foreach( $anss as $ans ) {
431
-								if ( $ans instanceof EE_Answer ) {
427
+					foreach ($registrations_on_attendee as $reg) {
428
+						if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
429
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
430
+							foreach ($anss as $ans) {
431
+								if ($ans instanceof EE_Answer) {
432 432
 									$answers[$ans->ID()] = $ans;
433 433
 								}
434 434
 							}
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 
439 439
 				$question_list = '';
440 440
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
441
-				foreach ( $answers as $answer ) {
442
-					if ( $answer instanceof EE_Answer ) {
441
+				foreach ($answers as $answer) {
442
+					if ($answer instanceof EE_Answer) {
443 443
 						$question = $answer->question();
444
-						if ( ! $question instanceof EE_Question || ( $question instanceof EE_Question && $question->admin_only() ) ) {
444
+						if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) {
445 445
 							continue;
446 446
 						}
447
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $extra_data);
447
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $extra_data);
448 448
 					}
449 449
 				}
450 450
 				return $question_list;
@@ -457,41 +457,41 @@  discard block
 block discarded – undo
457 457
 	}
458 458
 
459 459
 
460
-	public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) {
460
+	public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) {
461 461
 		$shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', 'event_espresso');
462 462
 		return $shortcodes;
463 463
 	}
464 464
 
465 465
 
466
-	public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
467
-		if ( array($data) && ! isset( $data['data'] ) )
466
+	public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
467
+		if (array($data) && ! isset($data['data']))
468 468
 			return $parsed;
469 469
 
470 470
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
471
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
471
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
472 472
 
473
-		if ( ! $recipient instanceof EE_Messages_Addressee )
473
+		if ( ! $recipient instanceof EE_Messages_Addressee)
474 474
 			return $parsed;
475 475
 
476 476
 		$send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data;
477 477
 
478
-		switch ( $shortcode ) {
478
+		switch ($shortcode) {
479 479
 			case '[RECIPIENT_QUESTION_LIST]' :
480
-				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration )
480
+				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration)
481 481
 					return '';
482 482
 				$registration = $recipient->primary_reg_obj;
483
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
483
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
484 484
 				$valid_shortcodes = array('question');
485 485
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
486 486
 				$answers = $recipient->registrations[$registration->ID()]['ans_objs'];
487 487
 				$question_list = '';
488
-				foreach ( $answers as $answer ) {
489
-					if ( $answer instanceof EE_Answer ) {
488
+				foreach ($answers as $answer) {
489
+					if ($answer instanceof EE_Answer) {
490 490
 						$question = $answer->question();
491
-						if ( $question instanceof EE_Question and $question->admin_only() ) {
491
+						if ($question instanceof EE_Question and $question->admin_only()) {
492 492
 							continue;
493 493
 						}
494
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data);
494
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data);
495 495
 					}
496 496
 				}
497 497
 				return $question_list;
@@ -517,67 +517,67 @@  discard block
 block discarded – undo
517 517
 		$setup_args = array(
518 518
 			'mtfilename' => 'EE_Newsletter_message_type.class.php',
519 519
 			'autoloadpaths' => array(
520
-				EE_CAF_LIBRARIES . 'messages/message_type/newsletter/'
520
+				EE_CAF_LIBRARIES.'messages/message_type/newsletter/'
521 521
 				),
522
-			'messengers_to_activate_with' => array( 'email' ),
523
-			'messengers_to_validate_with' => array( 'email' )
522
+			'messengers_to_activate_with' => array('email'),
523
+			'messengers_to_validate_with' => array('email')
524 524
 			);
525
-		EE_Register_Message_Type::register( 'newsletter', $setup_args );
525
+		EE_Register_Message_Type::register('newsletter', $setup_args);
526 526
 
527 527
 		//register payment reminder message type
528 528
 		$setup_args = array(
529 529
 			'mtfilename' => 'EE_Payment_Reminder_message_type.class.php',
530
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ),
531
-			'messengers_to_activate_with' => array( 'email' ),
532
-			'messengers_to_validate_with' => array( 'email' )
530
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'),
531
+			'messengers_to_activate_with' => array('email'),
532
+			'messengers_to_validate_with' => array('email')
533 533
 			);
534
-		EE_Register_Message_Type::register( 'payment_reminder', $setup_args );
534
+		EE_Register_Message_Type::register('payment_reminder', $setup_args);
535 535
 
536 536
 		//register payment declined message type
537 537
 		$setup_args = array(
538 538
 			'mtfilename' => 'EE_Payment_Declined_message_type.class.php',
539
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ),
540
-			'messengers_to_activate_with' => array( 'email' ),
541
-			'messengers_to_validate_with' => array( 'email' )
539
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'),
540
+			'messengers_to_activate_with' => array('email'),
541
+			'messengers_to_validate_with' => array('email')
542 542
 			);
543
-		EE_Register_Message_Type::register( 'payment_declined', $setup_args );
543
+		EE_Register_Message_Type::register('payment_declined', $setup_args);
544 544
 
545 545
 		//register registration declined message type
546 546
 		$setup_args = array(
547 547
 			'mtfilename' => 'EE_Declined_Registration_message_type.class.php',
548
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ),
549
-			'messengers_to_activate_with' => array( 'email' ),
550
-			'messengers_to_validate_with' => array( 'email' )
548
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'),
549
+			'messengers_to_activate_with' => array('email'),
550
+			'messengers_to_validate_with' => array('email')
551 551
 			);
552
-		EE_Register_Message_Type::register( 'declined_registration', $setup_args );
552
+		EE_Register_Message_Type::register('declined_registration', $setup_args);
553 553
 
554 554
 		//register registration cancelled message type
555 555
 		$setup_args = array(
556 556
 			'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php',
557
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ),
558
-			'messengers_to_activate_with' => array( 'email' ),
559
-			'messengers_to_validate_with' => array( 'email' )
557
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'),
558
+			'messengers_to_activate_with' => array('email'),
559
+			'messengers_to_validate_with' => array('email')
560 560
 			);
561
-		EE_Register_Message_Type::register( 'cancelled_registration', $setup_args );
561
+		EE_Register_Message_Type::register('cancelled_registration', $setup_args);
562 562
 
563 563
 
564 564
 		//register payment failed message type
565 565
 		$setup_args = array(
566 566
 			'mtfilename' => 'EE_Payment_Failed_message_type.class.php',
567
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ),
568
-			'messengers_to_activate_with' => array( 'email' ),
569
-			'messengers_to_validate_with' => array( 'email' )
567
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'),
568
+			'messengers_to_activate_with' => array('email'),
569
+			'messengers_to_validate_with' => array('email')
570 570
 			);
571
-		EE_Register_Message_Type::register( 'payment_failed', $setup_args );
571
+		EE_Register_Message_Type::register('payment_failed', $setup_args);
572 572
 
573 573
 		//register payment declined message type
574 574
 		$setup_args = array(
575 575
 			'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php',
576
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ),
577
-			'messengers_to_activate_with' => array( 'email' ),
578
-			'messengers_to_validate_with' => array( 'email' )
576
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'),
577
+			'messengers_to_activate_with' => array('email'),
578
+			'messengers_to_validate_with' => array('email')
579 579
 			);
580
-		EE_Register_Message_Type::register( 'payment_cancelled', $setup_args );
580
+		EE_Register_Message_Type::register('payment_cancelled', $setup_args);
581 581
 	}
582 582
 
583 583
 
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	public function register_caf_shortcodes() {
594 594
 		$setup_args = array(
595 595
 			'autoloadpaths' => array(
596
-				EE_CAF_LIBRARIES . 'shortcodes/'
596
+				EE_CAF_LIBRARIES.'shortcodes/'
597 597
 				),
598
-			'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ),
599
-			'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ),
600
-			'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' )
598
+			'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'),
599
+			'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'),
600
+			'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]')
601 601
 			);
602
-		EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args );
602
+		EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args);
603 603
 	}
604 604
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.3.2
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Used to initialize all EE messages caffeinated functionality.
@@ -291,8 +293,9 @@  discard block
 block discarded – undo
291 293
 
292 294
 	public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
293 295
 
294
-		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) )
295
-			return $parsed;
296
+		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) {
297
+					return $parsed;
298
+		}
296 299
 
297 300
 		//let's get the question from the code.
298 301
 		$shortcode = str_replace('[ANSWER_*', '', $shortcode);
@@ -388,14 +391,16 @@  discard block
 block discarded – undo
388 391
 
389 392
 	public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
390 393
 
391
-		if ( array($data) && ! isset( $data['data'] ) )
392
-			return $parsed;
394
+		if ( array($data) && ! isset( $data['data'] ) ) {
395
+					return $parsed;
396
+		}
393 397
 
394 398
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
395 399
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
396 400
 
397
-		if ( ! $recipient instanceof EE_Messages_Addressee )
398
-			return $parsed;
401
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
402
+					return $parsed;
403
+		}
399 404
 
400 405
 		switch ( $shortcode ) {
401 406
 			case '[RECIPIENT_QUESTION_LIST]' :
@@ -464,21 +469,24 @@  discard block
 block discarded – undo
464 469
 
465 470
 
466 471
 	public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
467
-		if ( array($data) && ! isset( $data['data'] ) )
468
-			return $parsed;
472
+		if ( array($data) && ! isset( $data['data'] ) ) {
473
+					return $parsed;
474
+		}
469 475
 
470 476
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
471 477
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
472 478
 
473
-		if ( ! $recipient instanceof EE_Messages_Addressee )
474
-			return $parsed;
479
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
480
+					return $parsed;
481
+		}
475 482
 
476 483
 		$send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data;
477 484
 
478 485
 		switch ( $shortcode ) {
479 486
 			case '[RECIPIENT_QUESTION_LIST]' :
480
-				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration )
481
-					return '';
487
+				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) {
488
+									return '';
489
+				}
482 490
 				$registration = $recipient->primary_reg_obj;
483 491
 				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
484 492
 				$valid_shortcodes = array('question');
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/EED_Recaptcha.module.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * 	process_recaptcha
288 288
 	 *
289 289
 	 * 	@access private
290
-	 * 	@return 	boolean
290
+	 * 	@return 	boolean|null
291 291
 	 */
292 292
 	private static function _get_recaptcha_response() {
293 293
 		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @access public
576 576
 	 * @param EE_Registration_Config $EE_Registration_Config
577
-	 * @return array
577
+	 * @return EE_Registration_Config
578 578
 	 */
579 579
 	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
580 580
 		try {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  *
Please login to merge, or discard this patch.
Spacing   +133 added lines, -134 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Recaptcha
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -59,32 +59,32 @@  discard block
 block discarded – undo
59 59
 		if (
60 60
 			EE_Registry::instance()->CFG->registration->use_captcha
61 61
 			&& ! (
62
-				EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options'
63
-				&& (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true
62
+				EE_Registry::instance()->REQ->get('step', '') === 'payment_options'
63
+				&& (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true
64 64
 			)
65 65
 		) {
66 66
 			EED_Recaptcha::set_definitions();
67 67
 			EED_Recaptcha::enqueue_styles_and_scripts();
68
-			add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 );
68
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
69 69
 			add_action(
70 70
 				'AHEE__before_spco_whats_next_buttons',
71
-				array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0
71
+				array('EED_Recaptcha', 'display_recaptcha'), 10, 0
72 72
 			);
73 73
 			add_filter(
74 74
 				'FHEE__EED_Single_Page_Checkout__init___continue_reg',
75
-				array( 'EED_Recaptcha', 'not_a_robot' ), 10
75
+				array('EED_Recaptcha', 'not_a_robot'), 10
76 76
 			);
77 77
 			add_filter(
78 78
 				'FHEE__EE_SPCO_Reg_Step__set_completed___completed',
79
-				array( 'EED_Recaptcha', 'not_a_robot' ), 10
79
+				array('EED_Recaptcha', 'not_a_robot'), 10
80 80
 			);
81 81
 			add_filter(
82 82
 				'FHEE__EE_SPCO_JSON_Response___toString__JSON_response',
83
-				array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1
83
+				array('EED_Recaptcha', 'recaptcha_response'), 10, 1
84 84
 			);
85 85
 			add_filter(
86 86
 				'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
87
-				array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1
87
+				array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1
88 88
 			);
89 89
 		}
90 90
 	}
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
 		if (
104 104
 			EE_Registry::instance()->CFG->registration->use_captcha
105 105
 			&& ! (
106
-				EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options'
107
-				&& (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true
106
+				EE_Registry::instance()->REQ->get('step', '') === 'payment_options'
107
+				&& (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true
108 108
 			)
109 109
 		) {
110 110
 			EED_Recaptcha::enqueue_styles_and_scripts();
111
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
112
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
113
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
111
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
112
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
113
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
114 114
 		}
115 115
 		// admin settings
116
-		add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 );
117
-		add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 );
116
+		add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1);
117
+		add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1);
118 118
 	}
119 119
 
120 120
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 	 *  @return 	void
127 127
 	 */
128 128
 	public static function set_definitions() {
129
-		if ( is_user_logged_in() ) {
129
+		if (is_user_logged_in()) {
130 130
 			EED_Recaptcha::$_not_a_robot = true;
131 131
 		}
132
-		define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
133
-		define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ ));
132
+		define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
133
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
134 134
 	}
135 135
 
136 136
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	public static function set_late_hooks() {
145 145
 		add_filter(
146 146
 			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
147
-			array( 'EED_Recaptcha', 'not_a_robot' )
147
+			array('EED_Recaptcha', 'not_a_robot')
148 148
 		);
149 149
 	}
150 150
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 *  @return 	void
158 158
 	 */
159 159
 	public static function enqueue_styles_and_scripts() {
160
-		wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE );
161
-		wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE );
162
-		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' );
163
-		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' );
164
-		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' );
160
+		wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE);
161
+		wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE);
162
+		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso');
163
+		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso');
164
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso');
165 165
 	}
166 166
 
167 167
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @access    public
173 173
 	 * @param \WP $WP
174 174
 	 */
175
-	public function run( $WP ) {
175
+	public function run($WP) {
176 176
 	}
177 177
 
178 178
 
@@ -182,8 +182,7 @@  discard block
 block discarded – undo
182 182
 	 *  @return boolean
183 183
 	 */
184 184
 	public static function not_a_robot() {
185
-		$not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot :
186
-			EED_Recaptcha::recaptcha_passed();
185
+		$not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed();
187 186
 		return $not_a_robot;
188 187
 	}
189 188
 
@@ -199,23 +198,23 @@  discard block
 block discarded – undo
199 198
 	 */
200 199
 	public static function display_recaptcha() {
201 200
 		// logged in means you have already passed a turing test of sorts
202
-		if ( is_user_logged_in() ) {
201
+		if (is_user_logged_in()) {
203 202
 			return;
204 203
 		}
205 204
 		// don't display if not using recaptcha or user is logged in
206
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
205
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
207 206
 			// only display if they have NOT passed the test yet
208
-			if ( ! EED_Recaptcha::$_not_a_robot ) {
209
-				EE_Registry::instance()->load_helper( 'Template' );
207
+			if ( ! EED_Recaptcha::$_not_a_robot) {
208
+				EE_Registry::instance()->load_helper('Template');
210 209
 				EEH_Template::display_template(
211
-					RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php',
210
+					RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php',
212 211
 					array(
213 212
 						'recaptcha_publickey' 	=> EE_Registry::instance()->CFG->registration->recaptcha_publickey,
214 213
 						'recaptcha_theme' 		=> EE_Registry::instance()->CFG->registration->recaptcha_theme,
215 214
 						'recaptcha_type' 			=> EE_Registry::instance()->CFG->registration->recaptcha_type
216 215
 					)
217 216
 				);
218
-				wp_enqueue_script( 'google_recaptcha' );
217
+				wp_enqueue_script('google_recaptcha');
219 218
 			}
220 219
 		}
221 220
 	}
@@ -246,17 +245,17 @@  discard block
 block discarded – undo
246 245
 	 */
247 246
 	public static function recaptcha_passed() {
248 247
 		// logged in means you have already passed a turing test of sorts
249
-		if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) {
248
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
250 249
 			return TRUE;
251 250
 		}
252 251
 		// was test already passed?
253
-		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' );
254
-		$recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN );
252
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
253
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
255 254
 		// verify recaptcha
256 255
 		EED_Recaptcha::_get_recaptcha_response();
257
-		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) {
256
+		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
258 257
 			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
259
-			EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed ));
258
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
260 259
 			EE_Registry::instance()->SSN->update();
261 260
 		}
262 261
 		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
@@ -272,8 +271,8 @@  discard block
 block discarded – undo
272 271
 	 * @param array $recaptcha_response
273 272
 	 * @return boolean
274 273
 	 */
275
-	public static function recaptcha_response( $recaptcha_response = array() ) {
276
-		if ( EED_Recaptcha::_bypass_recaptcha() ) {
274
+	public static function recaptcha_response($recaptcha_response = array()) {
275
+		if (EED_Recaptcha::_bypass_recaptcha()) {
277 276
 			$recaptcha_response['bypass_recaptcha'] = TRUE;
278 277
 			$recaptcha_response['recaptcha_passed'] = TRUE;
279 278
 		} else {
@@ -293,16 +292,16 @@  discard block
 block discarded – undo
293 292
 	 */
294 293
 	private static function _bypass_recaptcha() {
295 294
 		// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY
296
-		$bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() );
295
+		$bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array());
297 296
 		// does $bypass_request_params_array have any values ?
298
-		if ( empty( $bypass_request_params_array )) {
297
+		if (empty($bypass_request_params_array)) {
299 298
 			return FALSE;
300 299
 		}
301 300
 		// initially set bypass to TRUE
302 301
 		$bypass_recaptcha = TRUE;
303
-		foreach ( $bypass_request_params_array as $key => $value ) {
302
+		foreach ($bypass_request_params_array as $key => $value) {
304 303
 			// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass
305
-			$bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE;
304
+			$bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE;
306 305
 		}
307 306
 		return $bypass_recaptcha;
308 307
 	}
@@ -317,7 +316,7 @@  discard block
 block discarded – undo
317 316
 	 * 	@return 	boolean
318 317
 	 */
319 318
 	private static function _get_recaptcha_response() {
320
-		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
319
+		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false);
321 320
 	}
322 321
 
323 322
 
@@ -331,26 +330,26 @@  discard block
 block discarded – undo
331 330
 	 */
332 331
 	private static function _process_recaptcha_response() {
333 332
 		// verify library is loaded
334
-		if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) {
335
-			require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' );
333
+		if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) {
334
+			require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php');
336 335
 		}
337 336
 		// The response from reCAPTCHA
338 337
 		EED_Recaptcha::_get_recaptcha_response();
339 338
 		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
340 339
 		// Was there a reCAPTCHA response?
341
-		if ( $recaptcha_response ) {
340
+		if ($recaptcha_response) {
342 341
 			// if allow_url_fopen is Off, then set a different request method
343
-			$request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null;
342
+			$request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null;
344 343
 			$recaptcha = new \ReCaptcha\ReCaptcha(
345 344
 				EE_Registry::instance()->CFG->registration->recaptcha_privatekey,
346 345
 				$request_method
347 346
 			);
348 347
 			$recaptcha_response = $recaptcha->verify(
349 348
 				EED_Recaptcha::$_recaptcha_response,
350
-				$_SERVER[ 'REMOTE_ADDR' ]
349
+				$_SERVER['REMOTE_ADDR']
351 350
 			);
352 351
 		}
353
-		if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) {
352
+		if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) {
354 353
 			return TRUE;
355 354
 		}
356 355
 		// sorry... it appears you can't don't know what soup or hamburgers are !!!
@@ -385,8 +384,8 @@  discard block
 block discarded – undo
385 384
 	 */
386 385
 	protected static function _recaptcha_settings_form() {
387 386
 
388
-		EE_Registry::instance()->load_helper( 'HTML' );
389
-		EE_Registry::instance()->load_helper( 'Template' );
387
+		EE_Registry::instance()->load_helper('HTML');
388
+		EE_Registry::instance()->load_helper('Template');
390 389
 
391 390
 		return new EE_Form_Section_Proper(
392 391
 			array(
@@ -396,12 +395,12 @@  discard block
 block discarded – undo
396 395
 				'subsections' 			=> apply_filters(
397 396
 					'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections',
398 397
 					array(
399
-						'main_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))),
398
+						'main_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))),
400 399
 						'main_settings' 						=> EED_Recaptcha::_recaptcha_main_settings(),
401
-						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )),
400
+						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))),
402 401
 						'appearance_settings' 			=> EED_Recaptcha::_recaptcha_appearance_settings(),
403 402
 						// 'recaptcha_example' 				=> new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ),
404
-						'required_fields_note' 			=> new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ))
403
+						'required_fields_note' 			=> new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))
405 404
 					)
406 405
 				)
407 406
 			)
@@ -428,28 +427,28 @@  discard block
 block discarded – undo
428 427
 					array(
429 428
 						'use_captcha' 				=> new EE_Yes_No_Input(
430 429
 							array(
431
-								'html_label_text'	 	=> __( 'Use reCAPTCHA', 'event_espresso' ),
430
+								'html_label_text'	 	=> __('Use reCAPTCHA', 'event_espresso'),
432 431
 								'html_help_text' 		=> sprintf(
433
-									__( 'reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ),
432
+									__('reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'),
434 433
 									'<a href="https://www.google.com/recaptcha/intro/index.html">',
435 434
 									'</a>'
436 435
 								),
437
-								'default' 								=> isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
436
+								'default' 								=> isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
438 437
 								'display_html_label_text' 	=> FALSE
439 438
 							)
440 439
 						),
441 440
 						'recaptcha_publickey' 		=> new EE_Text_Input(
442 441
 							array(
443
-								'html_label_text'	 	=> __( 'Site Key', 'event_espresso' ),
444
-								'html_help_text' 		=> __( 'The site key is used to display the widget on your site.', 'event_espresso' ),
445
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''
442
+								'html_label_text'	 	=> __('Site Key', 'event_espresso'),
443
+								'html_help_text' 		=> __('The site key is used to display the widget on your site.', 'event_espresso'),
444
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''
446 445
 							)
447 446
 						),
448 447
 						'recaptcha_privatekey' 		=> new EE_Text_Input(
449 448
 							array(
450
-								'html_label_text'	 	=> __( 'Secret Key', 'event_espresso' ),
451
-								'html_help_text' 		=> __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ),
452
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''
449
+								'html_label_text'	 	=> __('Secret Key', 'event_espresso'),
450
+								'html_help_text' 		=> __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'),
451
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''
453 452
 							)
454 453
 						)
455 454
 					)
@@ -481,81 +480,81 @@  discard block
 block discarded – undo
481 480
 					array(
482 481
 						'recaptcha_theme' 		=> new EE_Radio_Button_Input(
483 482
 							array(
484
-								'light' => __( 'Light', 'event_espresso' ),
485
-								'dark' => __( 'Dark', 'event_espresso' )
483
+								'light' => __('Light', 'event_espresso'),
484
+								'dark' => __('Dark', 'event_espresso')
486 485
 							),
487 486
 							array(
488
-								'html_label_text'	 	=> __( 'Theme', 'event_espresso' ),
489
-								'html_help_text' 		=> __( 'The color theme of the widget.', 'event_espresso' ),
490
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
487
+								'html_label_text'	 	=> __('Theme', 'event_espresso'),
488
+								'html_help_text' 		=> __('The color theme of the widget.', 'event_espresso'),
489
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
491 490
 								'display_html_label_text' => FALSE
492 491
 							)
493 492
 						),
494 493
 						'recaptcha_type' 		=> new EE_Radio_Button_Input(
495 494
 							array(
496
-								'image' => __( 'Image', 'event_espresso' ),
497
-								'audio' => __( 'Audio', 'event_espresso' )
495
+								'image' => __('Image', 'event_espresso'),
496
+								'audio' => __('Audio', 'event_espresso')
498 497
 							),
499 498
 							array(
500
-								'html_label_text'	 	=> __( 'Type', 'event_espresso' ),
501
-								'html_help_text' 		=> __( 'The type of CAPTCHA to serve.', 'event_espresso' ),
502
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
499
+								'html_label_text'	 	=> __('Type', 'event_espresso'),
500
+								'html_help_text' 		=> __('The type of CAPTCHA to serve.', 'event_espresso'),
501
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
503 502
 								'display_html_label_text' =>FALSE
504 503
 							)
505 504
 						),
506 505
 						'recaptcha_language' 		=> new EE_Select_Input(
507 506
 							array(
508
-								 'ar' 			=> __( 'Arabic', 'event_espresso' ),
509
-								 'bg' 		=> __( 'Bulgarian', 'event_espresso' ),
510
-								 'ca' 			=> __( 'Catalan', 'event_espresso' ),
511
-								 'zh-CN' 	=>  __( 'Chinese (Simplified)', 'event_espresso' ),
512
-								 'zh-TW' 	=>  __( 'Chinese (Traditional)	', 'event_espresso' ),
513
-								 'hr' 			=> __( 'Croatian', 'event_espresso' ),
514
-								 'cs' 			=> __( 'Czech', 'event_espresso' ),
515
-								 'da' 			=> __( 'Danish', 'event_espresso' ),
516
-								 'nl' 			=> __( 'Dutch', 'event_espresso' ),
517
-								 'en-GB' 	=>  __( 'English (UK)', 'event_espresso' ),
518
-								 'en' 			=> __( 'English (US)', 'event_espresso' ),
519
-								 'fil' 			=> __( 'Filipino', 'event_espresso' ),
520
-								 'fi' 			=> __( 'Finnish', 'event_espresso' ),
521
-								 'fr' 			=> __( 'French', 'event_espresso' ),
522
-								 'fr-CA' 	=>  __( 'French (Canadian)', 'event_espresso' ),
523
-								 'de' 			=> __( 'German', 'event_espresso' ),
524
-								 'de-AT' 	=>  __( 'German (Austria)', 'event_espresso' ),
525
-								 'de-CH' 	=>  __( 'German (Switzerland)', 'event_espresso' ),
526
-								 'el' 			=> __( 'Greek', 'event_espresso' ),
527
-								 'iw' 			=> __( 'Hebrew', 'event_espresso' ),
528
-								 'hi' 			=> __( 'Hindi', 'event_espresso' ),
529
-								 'hu' 		=> __( 'Hungarian', 'event_espresso' ),
530
-								 'id' 			=> __( 'Indonesian', 'event_espresso' ),
531
-								 'it' 			=> __( 'Italian', 'event_espresso' ),
532
-								 'ja' 			=> __( 'Japanese', 'event_espresso' ),
533
-								 'ko' 			=> __( 'Korean', 'event_espresso' ),
534
-								 'lv' 			=> __( 'Latvian', 'event_espresso' ),
535
-								 'lt' 			=> __( 'Lithuanian', 'event_espresso' ),
536
-								 'no' 		=> __( 'Norwegian', 'event_espresso' ),
537
-								 'fa' 			=> __( 'Persian', 'event_espresso' ),
538
-								 'pl' 			=> __( 'Polish', 'event_espresso' ),
539
-								 'pt' 			=> __( 'Portuguese', 'event_espresso' ),
540
-								 'pt-BR' 	=>  __( 'Portuguese (Brazil)', 'event_espresso' ),
541
-								 'pt-PT' 	=>  __( 'Portuguese (Portugal)', 'event_espresso' ),
542
-								 'ro' 			=> __( 'Romanian', 'event_espresso' ),
543
-								 'ru' 			=> __( 'Russian', 'event_espresso' ),
544
-								 'sr' 			=> __( 'Serbian', 'event_espresso' ),
545
-								 'sk' 			=> __( 'Slovak', 'event_espresso' ),
546
-								 'sl' 			=> __( 'Slovenian', 'event_espresso' ),
547
-								 'es' 			=> __( 'Spanish', 'event_espresso' ),
548
-								 'es-419' 	=>  __( 'Spanish (Latin America)', 'event_espresso' ),
549
-								 'sv' 			=> __( 'Swedish', 'event_espresso' ),
550
-								 'th' 			=> __( 'Thai', 'event_espresso' ),
551
-								 'tr' 			=> __( 'Turkish', 'event_espresso' ),
552
-								 'uk' 			=> __( 'Ukrainian', 'event_espresso' ),
553
-								 'vi' 			=> __( 'Vietnamese', 'event_espresso')
507
+								 'ar' 			=> __('Arabic', 'event_espresso'),
508
+								 'bg' 		=> __('Bulgarian', 'event_espresso'),
509
+								 'ca' 			=> __('Catalan', 'event_espresso'),
510
+								 'zh-CN' 	=>  __('Chinese (Simplified)', 'event_espresso'),
511
+								 'zh-TW' 	=>  __('Chinese (Traditional)	', 'event_espresso'),
512
+								 'hr' 			=> __('Croatian', 'event_espresso'),
513
+								 'cs' 			=> __('Czech', 'event_espresso'),
514
+								 'da' 			=> __('Danish', 'event_espresso'),
515
+								 'nl' 			=> __('Dutch', 'event_espresso'),
516
+								 'en-GB' 	=>  __('English (UK)', 'event_espresso'),
517
+								 'en' 			=> __('English (US)', 'event_espresso'),
518
+								 'fil' 			=> __('Filipino', 'event_espresso'),
519
+								 'fi' 			=> __('Finnish', 'event_espresso'),
520
+								 'fr' 			=> __('French', 'event_espresso'),
521
+								 'fr-CA' 	=>  __('French (Canadian)', 'event_espresso'),
522
+								 'de' 			=> __('German', 'event_espresso'),
523
+								 'de-AT' 	=>  __('German (Austria)', 'event_espresso'),
524
+								 'de-CH' 	=>  __('German (Switzerland)', 'event_espresso'),
525
+								 'el' 			=> __('Greek', 'event_espresso'),
526
+								 'iw' 			=> __('Hebrew', 'event_espresso'),
527
+								 'hi' 			=> __('Hindi', 'event_espresso'),
528
+								 'hu' 		=> __('Hungarian', 'event_espresso'),
529
+								 'id' 			=> __('Indonesian', 'event_espresso'),
530
+								 'it' 			=> __('Italian', 'event_espresso'),
531
+								 'ja' 			=> __('Japanese', 'event_espresso'),
532
+								 'ko' 			=> __('Korean', 'event_espresso'),
533
+								 'lv' 			=> __('Latvian', 'event_espresso'),
534
+								 'lt' 			=> __('Lithuanian', 'event_espresso'),
535
+								 'no' 		=> __('Norwegian', 'event_espresso'),
536
+								 'fa' 			=> __('Persian', 'event_espresso'),
537
+								 'pl' 			=> __('Polish', 'event_espresso'),
538
+								 'pt' 			=> __('Portuguese', 'event_espresso'),
539
+								 'pt-BR' 	=>  __('Portuguese (Brazil)', 'event_espresso'),
540
+								 'pt-PT' 	=>  __('Portuguese (Portugal)', 'event_espresso'),
541
+								 'ro' 			=> __('Romanian', 'event_espresso'),
542
+								 'ru' 			=> __('Russian', 'event_espresso'),
543
+								 'sr' 			=> __('Serbian', 'event_espresso'),
544
+								 'sk' 			=> __('Slovak', 'event_espresso'),
545
+								 'sl' 			=> __('Slovenian', 'event_espresso'),
546
+								 'es' 			=> __('Spanish', 'event_espresso'),
547
+								 'es-419' 	=>  __('Spanish (Latin America)', 'event_espresso'),
548
+								 'sv' 			=> __('Swedish', 'event_espresso'),
549
+								 'th' 			=> __('Thai', 'event_espresso'),
550
+								 'tr' 			=> __('Turkish', 'event_espresso'),
551
+								 'uk' 			=> __('Ukrainian', 'event_espresso'),
552
+								 'vi' 			=> __('Vietnamese', 'event_espresso')
554 553
 							),
555 554
 							array(
556
-								'html_label_text'	 	=> __( 'Language', 'event_espresso' ),
557
-								'html_help_text' 		=> __( 'Forces the widget to render in a specific language.', 'event_espresso' ),
558
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
555
+								'html_label_text'	 	=> __('Language', 'event_espresso'),
556
+								'html_help_text' 		=> __('Forces the widget to render in a specific language.', 'event_espresso'),
557
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
559 558
 							)
560 559
 						)
561 560
 					)
@@ -603,25 +602,25 @@  discard block
 block discarded – undo
603 602
 	 * @param EE_Registration_Config $EE_Registration_Config
604 603
 	 * @return array
605 604
 	 */
606
-	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
605
+	public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) {
607 606
 		try {
608 607
 			$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form();
609 608
 			// if not displaying a form, then check for form submission
610
-			if ( $recaptcha_settings_form->was_submitted() ) {
609
+			if ($recaptcha_settings_form->was_submitted()) {
611 610
 				// capture form data
612 611
 				$recaptcha_settings_form->receive_form_submission();
613 612
 				// validate form data
614
-				if ( $recaptcha_settings_form->is_valid() ) {
613
+				if ($recaptcha_settings_form->is_valid()) {
615 614
 					// grab validated data from form
616 615
 					$valid_data = $recaptcha_settings_form->valid_data();
617 616
 					// user proofing recaptcha:  If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message.
618 617
 					if (
619
-						apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config )
618
+						apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config)
620 619
 						&& $valid_data['main_settings']['use_captcha']
621
-						&& ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] )))
620
+						&& ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))
622 621
 					) {
623 622
 						$valid_data['main_settings']['use_captcha'] = FALSE;
624
-						EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
623
+						EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
625 624
 					}
626 625
 					$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha'];
627 626
 					$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey'];
@@ -630,12 +629,12 @@  discard block
 block discarded – undo
630 629
 					$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme'];
631 630
 					$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language'];
632 631
 				} else {
633
-					if ( $recaptcha_settings_form->submission_error_message() != '' ) {
634
-						EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
632
+					if ($recaptcha_settings_form->submission_error_message() != '') {
633
+						EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
635 634
 					}
636 635
 				}
637 636
 			}
638
-		} catch( EE_Error $e ) {
637
+		} catch (EE_Error $e) {
639 638
 			$e->get_error();
640 639
 		}
641 640
 
Please login to merge, or discard this patch.
modules/ticket_selector_caff/EED_Ticket_Selector_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 	 * @param EE_Template_Config $CFG
151 151
 	 * @param array             $REQ incoming request
152 152
 	 *
153
-	 * @return void
153
+	 * @return EE_Template_Config
154 154
 	 */
155 155
 	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
156 156
 		if ( ! isset( $CFG->EED_Ticket_Selector ) ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  *
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Ticket_Selector_Caff
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks_admin() {
40
-		define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
41
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 );
42
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 );
40
+		define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
41
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10);
42
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2);
43 43
 	}
44 44
 
45 45
 
46 46
 	//just required because of abstract declaration
47
-	public function run( $WP ) {
47
+	public function run($WP) {
48 48
 		$this->set_config();
49 49
 	}
50 50
 
51 51
 
52 52
 
53 53
 
54
-	protected function set_config(){
55
-		$this->set_config_section( 'template_settings' );
56
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
57
-		$this->set_config_name( 'EED_Ticket_Selector' );
54
+	protected function set_config() {
55
+		$this->set_config_section('template_settings');
56
+		$this->set_config_class('EE_Ticket_Selector_Config');
57
+		$this->set_config_name('EED_Ticket_Selector');
58 58
 	}
59 59
 
60 60
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections',
90 90
 					array(
91 91
 						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(
92
-							EEH_HTML::br(2) .
93
-							EEH_HTML::h2( __( 'Ticket Selector Template Settings', 'event_espresso' ))
92
+							EEH_HTML::br(2).
93
+							EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso'))
94 94
 						),
95 95
 						'appearance_settings' 			=> EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings()
96 96
 					)
@@ -114,25 +114,25 @@  discard block
 block discarded – undo
114 114
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array(
115 115
 						'show_ticket_details' => new EE_Yes_No_Input(
116 116
 							array(
117
-								'html_label_text' => __('Show Ticket Details?', 'event_espresso' ),
118
-								'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
119
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true,
117
+								'html_label_text' => __('Show Ticket Details?', 'event_espresso'),
118
+								'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
119
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true,
120 120
 								'display_html_label_text' => false
121 121
 								)
122 122
 							),
123 123
 						'show_ticket_sale_columns' => new EE_Yes_No_Input(
124 124
 							array(
125
-								'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ),
126
-								'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
127
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true,
125
+								'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'),
126
+								'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
127
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true,
128 128
 								'display_html_label_text' => false
129 129
 								)
130 130
 							),
131 131
 						'show_expired_tickets' => new EE_Yes_No_Input(
132 132
 							array(
133
-								'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ),
134
-								'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ),
135
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true,
133
+								'html_label_text' => __('Show Expired Tickets?', 'event_espresso'),
134
+								'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'),
135
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true,
136 136
 								'display_html_label_text' => false
137 137
 							)
138 138
 						)
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return void
157 157
 	 */
158
-	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
159
-		if ( ! isset( $CFG->EED_Ticket_Selector ) ) {
158
+	public static function update_template_settings(EE_Template_Config $CFG, $REQ) {
159
+		if ( ! isset($CFG->EED_Ticket_Selector)) {
160 160
 			$CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
161 161
 		}
162 162
 		try {
163 163
 			$ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
164 164
 
165 165
 			//check for form submission
166
-			if ( $ticket_selector_form->was_submitted() ) {
166
+			if ($ticket_selector_form->was_submitted()) {
167 167
 
168 168
 				//capture form data
169 169
 				$ticket_selector_form->receive_form_submission();
170 170
 
171 171
 				//validate form data
172
-				if ( $ticket_selector_form->is_valid() ) {
172
+				if ($ticket_selector_form->is_valid()) {
173 173
 
174 174
 					//grab validated data from form
175 175
 					$valid_data = $ticket_selector_form->valid_data();
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 					$CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details'];
180 180
 					$CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets'];
181 181
 				} else {
182
-					if ( $ticket_selector_form->submission_error_message() != '' ) {
183
-						EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
182
+					if ($ticket_selector_form->submission_error_message() != '') {
183
+						EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
184 184
 					}
185 185
 				}
186 186
 
187 187
 			}
188
-		} catch( EE_Error $e ) {
188
+		} catch (EE_Error $e) {
189 189
 			$e->get_error();
190 190
 		}
191 191
 
Please login to merge, or discard this patch.