Completed
Branch BUG-9548-transaction-completio... (b1c41e)
by
unknown
519:42 queued 503:28
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   +280 added lines, -281 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
 
@@ -270,31 +270,31 @@  discard block
 block discarded – undo
270 270
 		$this->_transient_garbage_collection();
271 271
 		$this->_template_args['values'] = $this->_yes_no_values;
272 272
 
273
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
-		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;
273
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;
275 275
 
276
-		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
277
-		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;
276
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL;
277
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;
278 278
 
279
-		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
280
-		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;
279
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
280
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;
281 281
 
282
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
-		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;
282
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;
284 284
 
285
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
286
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
287
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
285
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
286
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
287
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
288 288
 		$this->display_admin_page_with_sidebar();
289 289
 
290 290
 	}
291 291
 
292 292
 	protected function _update_espresso_page_settings() {
293 293
 		// capture incoming request data
294
-		$reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;
295
-		$txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;
296
-		$thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;
297
-		$cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;
294
+		$reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
295
+		$txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
296
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
297
+		$cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
298 298
 		// pack critical_pages into an array
299 299
 		$critical_pages = array(
300 300
 			'reg_page_id' 				=> $reg_page_id,
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
 			'thank_you_page_id' 	=> $thank_you_page_id,
303 303
 			'cancel_page_id' 		=> $cancel_page_id
304 304
 		);
305
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
305
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
306 306
 			// has the page changed ?
307
-			if ( EE_Registry::instance()->CFG->core->{$critical_page_name} != $critical_page_id ) {
307
+			if (EE_Registry::instance()->CFG->core->{$critical_page_name} != $critical_page_id) {
308 308
 				// grab post object for old page
309
-				$post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} );
309
+				$post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} );
310 310
 				// update post shortcodes for old page
311
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
311
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
312 312
 				// grab post object for new page
313
-				$post = get_post( $critical_page_id );
313
+				$post = get_post($critical_page_id);
314 314
 				// update post shortcodes for new page
315
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
315
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
316 316
 			}
317 317
 		}
318 318
 		// set page IDs
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
322 322
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
323 323
 
324
-		EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );
324
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
325 325
 
326 326
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
327
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
327
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
328 328
 		$query_args = array(
329 329
 			'action' => 'critical_pages'
330 330
 			);
331
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
331
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
332 332
 
333 333
 	}
334 334
 
@@ -343,34 +343,34 @@  discard block
 block discarded – undo
343 343
 
344 344
 	protected function _your_organization_settings() {
345 345
 
346
-		$this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';
347
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
348
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
349
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
350
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
351
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
352
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
353
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
354
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
355
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
356
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
357
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
358
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
359
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
360
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
361
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
362
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
346
+		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
347
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
348
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
349
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
350
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
351
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
352
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
353
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
354
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
355
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
356
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
357
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
358
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
359
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
360
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
361
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
362
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
363 363
 		//UXIP settings
364
-		$this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;
364
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE;
365 365
 
366
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
366
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
367 367
 		$this->_template_args['states'] = new EE_Question_Form_Input(
368
-				EE_Question::new_instance ( array(
368
+				EE_Question::new_instance(array(
369 369
 					'QST_ID'=> 0,
370 370
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
371 371
 					'QST_system'=>'admin-state'
372 372
 				)),
373
-				EE_Answer::new_instance ( array(
373
+				EE_Answer::new_instance(array(
374 374
 					'ANS_ID' => 0,
375 375
 					'ANS_value' => $STA_ID
376 376
 				)),
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
 				)
383 383
 			);
384 384
 
385
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
385
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
386 386
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
387
-				EE_Question::new_instance ( array(
387
+				EE_Question::new_instance(array(
388 388
 					'QST_ID'=> 0,
389 389
 					'QST_display_text'=> __('Country', 'event_espresso'),
390 390
 					'QST_system'=>'admin-country'
391 391
 				)),
392
-				EE_Answer::new_instance ( array(
392
+				EE_Answer::new_instance(array(
393 393
 					'ANS_ID' => 0,
394 394
 					'ANS_value' => $CNT_ISO
395 395
 				)),
@@ -401,51 +401,51 @@  discard block
 block discarded – undo
401 401
 				)
402 402
 			);
403 403
 
404
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
405
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
404
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
405
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
406 406
 
407 407
 		//PUE verification stuff
408
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
409
-		$verify_fail = get_option( $ver_option_key );
410
-		$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>';
408
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
409
+		$verify_fail = get_option($ver_option_key);
410
+		$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>';
411 411
 
412
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
413
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
414
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
412
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
413
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
414
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
415 415
 
416 416
 		$this->display_admin_page_with_sidebar();
417 417
 	}
418 418
 
419 419
 	protected function _update_your_organization_settings() {
420
-		if ( is_main_site() )
421
-			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;
422
-		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;
423
-		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;
424
-		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;
425
-		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;
426
-		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;
427
-		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;
428
-		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;
429
-		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;
430
-		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;
431
-		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;
432
-		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;
433
-		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;
434
-		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;
435
-		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;
436
-		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;
437
-		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;
438
-		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;
439
-		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;
440
-
441
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
442
-
443
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
420
+		if (is_main_site())
421
+			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;
422
+		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;
423
+		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;
424
+		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;
425
+		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;
426
+		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;
427
+		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;
428
+		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;
429
+		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;
430
+		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;
431
+		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;
432
+		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;
433
+		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;
434
+		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;
435
+		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;
436
+		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;
437
+		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;
438
+		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;
439
+		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;
440
+
441
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
442
+
443
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
444 444
 
445 445
 		$what = 'Your Organization Settings';
446
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
446
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
447 447
 
448
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
448
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
449 449
 
450 450
 	}
451 451
 
@@ -456,36 +456,36 @@  discard block
 block discarded – undo
456 456
 	protected function _admin_option_settings() {
457 457
 
458 458
 		$this->_template_args['values'] = $this->_yes_no_values;
459
-		$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;
460
-		$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;
461
-		$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;
462
-		$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;
463
-		$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;
464
-		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
465
-		$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;
466
-
467
-		$this->_set_add_edit_form_tags( 'update_admin_option_settings' );
468
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
459
+		$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;
460
+		$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;
461
+		$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;
462
+		$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;
463
+		$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;
464
+		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
465
+		$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;
466
+
467
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
468
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
469 469
 		$this->_template_args['template_args'] = $this->_template_args;
470
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );
470
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);
471 471
 		$this->display_admin_page_with_sidebar();
472 472
 	}
473 473
 
474 474
 	protected function _update_admin_option_settings() {
475
-		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;
476
-		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;
477
-		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;
478
-		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;
479
-		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;
480
-		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;
481
-		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;
475
+		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;
476
+		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;
477
+		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;
478
+		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;
479
+		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;
480
+		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;
481
+		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;
482 482
 
483
-		EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );
483
+		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin);
484 484
 
485 485
 		$what = 'Admin Options';
486
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );
487
-		$success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );
488
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );
486
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);
487
+		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success);
488
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings'));
489 489
 
490 490
 	}
491 491
 
@@ -498,20 +498,20 @@  discard block
 block discarded – undo
498 498
 
499 499
 	protected function _country_settings() {
500 500
 
501
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
502
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
501
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
502
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
503 503
 
504 504
 		//load field generator helper
505 505
 
506 506
 		$this->_template_args['values'] = $this->_yes_no_values;
507 507
 
508 508
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
509
-				EE_Question::new_instance ( array(
509
+				EE_Question::new_instance(array(
510 510
 					'QST_ID'=> 0,
511 511
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
512 512
 					'QST_system'=>'admin-country'
513 513
 				)),
514
-				EE_Answer::new_instance ( array(
514
+				EE_Answer::new_instance(array(
515 515
 					'ANS_ID' => 0,
516 516
 					'ANS_value' => $CNT_ISO
517 517
 				)),
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
 			);
525 525
 //		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' );
526 526
 
527
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
528
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
527
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
528
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
529 529
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
530 530
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
531 531
 
532
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
533
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
534
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
532
+		$this->_set_add_edit_form_tags('update_country_settings');
533
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
534
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
535 535
 		$this->display_admin_page_with_no_sidebar();
536 536
 	}
537 537
 
@@ -544,43 +544,43 @@  discard block
 block discarded – undo
544 544
 	 * 		@param 	string 		$CNT_ISO
545 545
 	 * 		@return 		mixed		string | array
546 546
 	 */
547
-	public function display_country_settings( $CNT_ISO = '' ) {
547
+	public function display_country_settings($CNT_ISO = '') {
548 548
 
549
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
550
-		if ( ! $CNT_ISO ) {
549
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
550
+		if ( ! $CNT_ISO) {
551 551
 			return '';
552 552
 		}
553 553
 
554 554
 		// for ajax
555
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
556
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
557
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
558
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
559
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
555
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
556
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
557
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
558
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
559
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
560 560
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
561 561
 		$country_input_types = array(
562
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
563
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
564
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
565
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
566
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
567
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
568
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
569
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
570
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
571
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
572
-			'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' => '' ))),
573
-			'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 ),
574
-			'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 ),
575
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
576
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
562
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
563
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
564
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
565
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
566
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
567
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
568
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
569
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
570
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
571
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
572
+			'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' => ''))),
573
+			'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),
574
+			'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),
575
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
576
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
577 577
 		);
578
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
579
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
578
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
579
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
580 580
 
581
-		if ( defined( 'DOING_AJAX' )) {
582
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
583
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
581
+		if (defined('DOING_AJAX')) {
582
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
583
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
584 584
 			die();
585 585
 		} else {
586 586
 			return $country_details_settings;
@@ -598,49 +598,49 @@  discard block
 block discarded – undo
598 598
 	 * 		@param 	string 		$CNT_ISO
599 599
 	 * 		@return 		string
600 600
 	 */
601
-	public function display_country_states( $CNT_ISO = '' ) {
601
+	public function display_country_states($CNT_ISO = '') {
602 602
 
603
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
603
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
604 604
 
605
-		if ( ! $CNT_ISO ) {
605
+		if ( ! $CNT_ISO) {
606 606
 			return '';
607 607
 		}
608 608
 		// for ajax
609
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
610
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
611
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
612
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
613
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
609
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
610
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
611
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
612
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
613
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
614 614
 
615 615
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
616 616
 //			global $wpdb;
617 617
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
618 618
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
619
-		if ( $states ) {
620
-			foreach ( $states as $STA_ID => $state ) {
621
-				if ( $state instanceof EE_State ) {
619
+		if ($states) {
620
+			foreach ($states as $STA_ID => $state) {
621
+				if ($state instanceof EE_State) {
622 622
 					//STA_abbrev 	STA_name 	STA_active
623 623
 					$state_input_types = array(
624
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
625
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
626
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
624
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
625
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
626
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
627 627
 					);
628
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
629
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
630
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
628
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
629
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
630
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
631 631
 				}
632 632
 			}
633 633
 		} else {
634 634
 			$this->_template_args['states'] = FALSE;
635 635
 		}
636 636
 //		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' );
637
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
637
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
638 638
 
639
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
639
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
640 640
 
641
-		if ( defined( 'DOING_AJAX' )) {
642
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
643
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
641
+		if (defined('DOING_AJAX')) {
642
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
643
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
644 644
 			die();
645 645
 		} else {
646 646
 			return $state_details_settings;
@@ -661,40 +661,39 @@  discard block
 block discarded – undo
661 661
 
662 662
 		$success = TRUE;
663 663
 
664
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
665
-		if ( ! $CNT_ISO ) {
666
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
664
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
665
+		if ( ! $CNT_ISO) {
666
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
667 667
 			$success = FALSE;
668 668
 		}
669
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
670
-		if ( ! $STA_abbrev ) {
671
-			EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
669
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
670
+		if ( ! $STA_abbrev) {
671
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
672 672
 			$success = FALSE;
673 673
 		}
674
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
675
-			FALSE;
676
-		if ( ! $STA_name ) {
677
-			EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
674
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE;
675
+		if ( ! $STA_name) {
676
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
678 677
 			$success = FALSE;
679 678
 		}
680 679
 
681
-		if ( $success ) {
680
+		if ($success) {
682 681
 			$cols_n_values = array(
683 682
 				'CNT_ISO' => $CNT_ISO,
684 683
 				'STA_abbrev' => $STA_abbrev,
685 684
 				'STA_name' => $STA_name,
686 685
 				'STA_active' => TRUE
687 686
 			);
688
-			$success = EEM_State::instance()->insert ( $cols_n_values );
689
-			EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) );
687
+			$success = EEM_State::instance()->insert($cols_n_values);
688
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
690 689
 		}
691 690
 
692
-		if ( defined( 'DOING_AJAX' )) {
693
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
694
-			echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) );
691
+		if (defined('DOING_AJAX')) {
692
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
693
+			echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
695 694
 			die();
696 695
 		} else {
697
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
696
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
698 697
 		}
699 698
 	}
700 699
 
@@ -707,25 +706,25 @@  discard block
 block discarded – undo
707 706
 	 * 		@return 		boolean | void
708 707
 	 */
709 708
 	public function delete_state() {
710
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
711
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
712
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
713
-		if ( ! $STA_ID ) {
714
-			EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
709
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
710
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
711
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
712
+		if ( ! $STA_ID) {
713
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
715 714
 			return FALSE;
716 715
 		}
717
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
718
-		if ( $success !== FALSE ) {
719
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
720
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
716
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
717
+		if ($success !== FALSE) {
718
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
719
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
721 720
 		}
722
-		if ( defined( 'DOING_AJAX' )) {
723
-			$notices = EE_Error::get_notices( FALSE, FALSE );
721
+		if (defined('DOING_AJAX')) {
722
+			$notices = EE_Error::get_notices(FALSE, FALSE);
724 723
 			$notices['return_data'] = TRUE;
725
-			echo json_encode( $notices );
724
+			echo json_encode($notices);
726 725
 			die();
727 726
 		} else {
728
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
727
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
729 728
 		}
730 729
 	}
731 730
 
@@ -741,63 +740,63 @@  discard block
 block discarded – undo
741 740
 	protected function _update_country_settings() {
742 741
 //		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' );
743 742
 		// grab the country ISO code
744
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
745
-		if ( ! $CNT_ISO ) {
746
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
743
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
744
+		if ( ! $CNT_ISO) {
745
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
747 746
 			return;
748 747
 		}
749 748
 		$cols_n_values = array();
750
-		$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;
751
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
752
-		$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;
753
-		$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';
754
-		$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';
755
-		$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';
756
-		$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'] ) : '$';
757
-		$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;
758
-		$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;
759
-		$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'] ) : '.';
760
-		$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'] ) : ',';
761
-		$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;
762
-		$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;
763
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
749
+		$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;
750
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
751
+		$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;
752
+		$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';
753
+		$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';
754
+		$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';
755
+		$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']) : '$';
756
+		$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;
757
+		$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;
758
+		$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']) : '.';
759
+		$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']) : ',';
760
+		$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;
761
+		$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;
762
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
764 763
 		// allow filtering of country data
765
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
764
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
766 765
 		//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' );
767 766
 		// where values
768
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
767
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
769 768
 		// run the update
770
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
769
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
771 770
 //		global $wpdb;
772 771
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
773 772
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
774
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
773
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
775 774
 			// allow filtering of states data
776
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
775
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
777 776
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
778 777
 			// loop thru state data ( looks like : states[75][STA_name] )
779
-			foreach( $states as $STA_ID => $state ) {
778
+			foreach ($states as $STA_ID => $state) {
780 779
 				$cols_n_values = array(
781 780
 					'CNT_ISO' 		=> $CNT_ISO,
782
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
783
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
784
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
781
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
782
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
783
+					'STA_active' 	=> (bool) absint($state['STA_active'])
785 784
 				);
786 785
 				// where values
787
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
786
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
788 787
 				// run the update
789
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
790
-				if ( $success !== FALSE ) {
791
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
788
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
789
+				if ($success !== FALSE) {
790
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
792 791
 				}
793 792
 			}
794 793
 		}
795 794
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
796
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
797
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
795
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
796
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
798 797
 			EE_Registry::instance()->CFG->update_espresso_config();
799 798
 		}
800
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
799
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
801 800
 	}
802 801
 
803 802
 
@@ -811,11 +810,11 @@  discard block
 block discarded – undo
811 810
 	 * 		@param 		string 		$label
812 811
 	 * 		@return 		string
813 812
 	 */
814
-	public function country_form_field_label_wrap( $label, $required_text ) {
813
+	public function country_form_field_label_wrap($label, $required_text) {
815 814
 		return '
816 815
 			<tr>
817 816
 				<th>
818
-					' . $label  . '
817
+					' . $label.'
819 818
 				</th>';
820 819
 	}
821 820
 
@@ -829,10 +828,10 @@  discard block
 block discarded – undo
829 828
 	 * 		@param 		string 		$label
830 829
 	 * 		@return 		string
831 830
 	 */
832
-	public function country_form_field_input__wrap( $input, $label ) {
831
+	public function country_form_field_input__wrap($input, $label) {
833 832
 		return '
834 833
 				<td class="general-settings-country-input-td">
835
-					' . $input . '
834
+					' . $input.'
836 835
 				</td>
837 836
 			</tr>';
838 837
 	}
@@ -848,7 +847,7 @@  discard block
 block discarded – undo
848 847
 	 * 		@param 		string 		$required_text
849 848
 	 * 		@return 		string
850 849
 	 */
851
-	public function state_form_field_label_wrap( $label, $required_text  ) {
850
+	public function state_form_field_label_wrap($label, $required_text) {
852 851
 		return $required_text;
853 852
 	}
854 853
 
@@ -862,10 +861,10 @@  discard block
 block discarded – undo
862 861
 	 * 		@param 		string 		$label
863 862
 	 * 		@return 		string
864 863
 	 */
865
-	public function state_form_field_input__wrap( $input, $label ) {
864
+	public function state_form_field_input__wrap($input, $label) {
866 865
 		return '
867 866
 				<td class="general-settings-country-state-input-td">
868
-					' . $input . '
867
+					' . $input.'
869 868
 				</td>';
870 869
 
871 870
 	}
@@ -888,10 +887,10 @@  discard block
 block discarded – undo
888 887
 	 * @param int $ee_page_id
889 888
 	 * @return string
890 889
 	 */
891
-	public static function edit_view_links( $ee_page_id ) {
892
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
890
+	public static function edit_view_links($ee_page_id) {
891
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
893 892
 		$links .= ' &nbsp;|&nbsp; ';
894
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
893
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
895 894
 		return $links;
896 895
 	}
897 896
 
@@ -904,27 +903,27 @@  discard block
 block discarded – undo
904 903
 	 * @param WP page object $ee_page
905 904
 	 * @return string
906 905
 	 */
907
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
906
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
908 907
 
909 908
 		// page status
910
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
909
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
911 910
 			$pg_colour = 'green';
912
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
911
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
913 912
 		 } else {
914 913
 			$pg_colour = 'red';
915
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
914
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
916 915
 		}
917 916
 
918 917
 		// shortcode status
919
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
918
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
920 919
 			$sc_colour = 'green';
921
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
920
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
922 921
 		 } else {
923 922
 			$sc_colour = 'red';
924
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
923
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
925 924
 		}
926 925
 
927
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
926
+		return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
928 927
 
929 928
 	}
930 929
 
@@ -939,20 +938,20 @@  discard block
 block discarded – undo
939 938
 	 * @param unknown_type $level
940 939
 	 * @return unknown
941 940
 	 */
942
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
941
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
943 942
 		global $wpdb;
944
-		$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) );
943
+		$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));
945 944
 
946
-		if ( $items ) {
947
-			foreach ( $items as $item ) {
948
-				$pad = str_repeat( '&nbsp;', $level * 3 );
949
-				if ( $item->ID == $default)
945
+		if ($items) {
946
+			foreach ($items as $item) {
947
+				$pad = str_repeat('&nbsp;', $level * 3);
948
+				if ($item->ID == $default)
950 949
 					$current = ' selected="selected"';
951 950
 				else
952 951
 					$current = '';
953 952
 
954
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
955
-				parent_dropdown( $default, $item->ID, $level +1 );
953
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
954
+				parent_dropdown($default, $item->ID, $level + 1);
956 955
 			}
957 956
 		} else {
958 957
 			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   +503 added lines, -503 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
 		//make sure messages autoloader is running
79 79
 		EED_Messages::set_autoloaders();
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 
94 94
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
95 95
 
96
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;
96
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;
97 97
 
98
-		EE_Registry::instance()->load_lib( 'messages' );
98
+		EE_Registry::instance()->load_lib('messages');
99 99
 		//we're also going to set the active messengers and active message types in here.
100 100
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
101
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
102
-		$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();
101
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
102
+		$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();
103 103
 
104 104
 
105 105
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	 * @return void
118 118
 	 */
119 119
 	protected function _load_active_messenger_objects() {
120
-		foreach ( $this->_active_messengers as $messenger => $values ) {
121
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
122
-			$ref = str_replace( ' ', '_', $ref );
123
-			$classname = 'EE_' . $ref . '_messenger';
124
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
125
-			if ( !class_exists($classname) )
126
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
127
-
128
-			$a = new ReflectionClass( $classname );
120
+		foreach ($this->_active_messengers as $messenger => $values) {
121
+			$ref = ucwords(str_replace('_', ' ', $messenger));
122
+			$ref = str_replace(' ', '_', $ref);
123
+			$classname = 'EE_'.$ref.'_messenger';
124
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
125
+			if ( ! class_exists($classname))
126
+				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname));
127
+
128
+			$a = new ReflectionClass($classname);
129 129
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
130 130
 		}
131 131
 	}
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
 	 * @return void
141 141
 	 */
142 142
 	protected function _load_active_message_type_objects() {
143
-		if ( empty($this->_active_message_types) ) return;
144
-		foreach ( $this->_active_message_types as $message_type ) {
145
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
146
-			$ref = str_replace( ' ', '_', $ref );
147
-			$classname = 'EE_' . $ref . '_message_type';
143
+		if (empty($this->_active_message_types)) return;
144
+		foreach ($this->_active_message_types as $message_type) {
145
+			$ref = ucwords(str_replace('_', ' ', $message_type));
146
+			$ref = str_replace(' ', '_', $ref);
147
+			$classname = 'EE_'.$ref.'_message_type';
148 148
 
149
-			if ( !class_exists($classname) )
150
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
149
+			if ( ! class_exists($classname))
150
+				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname));
151 151
 
152
-			$a = new ReflectionClass( $classname );
152
+			$a = new ReflectionClass($classname);
153 153
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
154 154
 		}
155 155
 	}
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 
158 158
 
159 159
 	protected function _ajax_hooks() {
160
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
161
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
162
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
163
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
164
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
160
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
161
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
162
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
163
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
164
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
165 165
 	}
166 166
 
167 167
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	*		@return void
194 194
 	*/
195 195
 	protected function _set_page_routes() {
196
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
197
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
196
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
197
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
198 198
 
199 199
 		$this->_page_routes = array(
200 200
 				'default'=> array(
@@ -230,35 +230,35 @@  discard block
 block discarded – undo
230 230
 				'insert_message_template' => array(
231 231
 					'func' => '_insert_or_update_message_template',
232 232
 					'capability' => 'ee_edit_messages',
233
-					'args' => array( 'new_template' => TRUE ),
233
+					'args' => array('new_template' => TRUE),
234 234
 					'noheader' => TRUE
235 235
 					 ),
236 236
 				'update_message_template' => array(
237 237
 					'func' => '_insert_or_update_message_template',
238 238
 					'capability' => 'ee_edit_message',
239 239
 					'obj_id' => $grp_id,
240
-					'args' => array( 'new_template' => FALSE ),
240
+					'args' => array('new_template' => FALSE),
241 241
 					'noheader' => TRUE
242 242
 					),
243 243
 				'trash_message_template' => array(
244 244
 					'func' => '_trash_or_restore_message_template',
245 245
 					'capability' => 'ee_delete_message',
246 246
 					'obj_id' => $grp_id,
247
-					'args' => array( 'trash' => TRUE, 'all' => TRUE ),
247
+					'args' => array('trash' => TRUE, 'all' => TRUE),
248 248
 					'noheader' => TRUE
249 249
 					),
250 250
 				'trash_message_template_context' => array(
251 251
 					'func' => '_trash_or_restore_message_template',
252 252
 					'capability' => 'ee_delete_message',
253 253
 					'obj_id' => $grp_id,
254
-					'args' => array( 'trash' => TRUE ),
254
+					'args' => array('trash' => TRUE),
255 255
 					'noheader' => TRUE
256 256
 					),
257 257
 				'restore_message_template' => array(
258 258
 					'func' => '_trash_or_restore_message_template',
259 259
 					'capability' => 'ee_delete_message',
260 260
 					'obj_id' => $grp_id,
261
-					'args' => array( 'trash' => FALSE, 'all' => TRUE ),
261
+					'args' => array('trash' => FALSE, 'all' => TRUE),
262 262
 					'noheader' => TRUE
263 263
 					),
264 264
 				'restore_message_template_context' => array(
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 						'filename' => 'messages_overview_other',
338 338
 					),
339 339
 				),
340
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
340
+				'help_tour' => array('Messages_Overview_Help_Tour'),
341 341
 				'require_nonce' => FALSE
342 342
 				),
343 343
 			'custom_mtps' => array(
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 					),
373 373
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
374 374
 				'has_metaboxes' => TRUE,
375
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
375
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
376 376
 				'help_tabs' => array(
377 377
 						'edit_message_template' => array(
378 378
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 							'filename' => 'messages_settings_messengers'
429 429
 							),
430 430
                     ),
431
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
431
+				'help_tour' => array('Messages_Settings_Help_Tour'),
432 432
 				'require_nonce' => FALSE
433 433
 				)
434 434
 			/*'reports' => array(
@@ -478,43 +478,43 @@  discard block
 block discarded – undo
478 478
 
479 479
 
480 480
 	public function messages_help_tab() {
481
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
482
-		EEH_Template::display_template( $templatepath, array());
481
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
482
+		EEH_Template::display_template($templatepath, array());
483 483
 	}
484 484
 
485 485
 
486 486
 	public function messengers_help_tab() {
487
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
488
-		EEH_Template::display_template( $templatepath, array());
487
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
488
+		EEH_Template::display_template($templatepath, array());
489 489
 	}
490 490
 
491 491
 
492 492
 	public function message_types_help_tab() {
493
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
494
-		EEH_Template::display_template( $templatepath, array());
493
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
494
+		EEH_Template::display_template($templatepath, array());
495 495
 	}
496 496
 
497 497
 
498 498
 	public function messages_overview_help_tab() {
499
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
500
-		EEH_Template::display_template( $templatepath, array());
499
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
500
+		EEH_Template::display_template($templatepath, array());
501 501
 	}
502 502
 
503 503
 
504 504
 	public function message_templates_help_tab() {
505
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
506
-		EEH_Template::display_template( $templatepath, array());
505
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
506
+		EEH_Template::display_template($templatepath, array());
507 507
 	}
508 508
 
509 509
 
510 510
 	public function edit_message_template_help_tab() {
511
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
512
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
513
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
514
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
515
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
516
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
517
-		EEH_Template::display_template( $templatepath, $args);
511
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
512
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
513
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
514
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
515
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
516
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
517
+		EEH_Template::display_template($templatepath, $args);
518 518
 	}
519 519
 
520 520
 
@@ -522,25 +522,25 @@  discard block
 block discarded – undo
522 522
 	public function message_template_shortcodes_help_tab() {
523 523
 		$this->_set_shortcodes();
524 524
 		$args['shortcodes'] = $this->_shortcodes;
525
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
526
-		EEH_Template::display_template( $template_path, $args );
525
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
526
+		EEH_Template::display_template($template_path, $args);
527 527
 	}
528 528
 
529 529
 
530 530
 
531 531
 	public function preview_message_help_tab() {
532
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
533
-		EEH_Template::display_template( $templatepath, array());
532
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
533
+		EEH_Template::display_template($templatepath, array());
534 534
 	}
535 535
 
536 536
 
537 537
 	public function settings_help_tab() {
538
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
539
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
540
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
538
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
539
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
540
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
541 541
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
542 542
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
543
-		EEH_Template::display_template( $templatepath, $args);
543
+		EEH_Template::display_template($templatepath, $args);
544 544
 	}
545 545
 
546 546
 
@@ -548,24 +548,24 @@  discard block
 block discarded – undo
548 548
 
549 549
 
550 550
 	public function load_scripts_styles() {
551
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
551
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
552 552
 		wp_enqueue_style('espresso_ee_msg');
553 553
 
554
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE );
554
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
555 555
 	}
556 556
 
557 557
 
558 558
 
559 559
 
560 560
 
561
-	public function wp_editor_css( $mce_css ) {
561
+	public function wp_editor_css($mce_css) {
562 562
 		//if we're on the edit_message_template route
563
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
563
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
564 564
 			$message_type_name = $this->_active_message_type_name;
565 565
 
566 566
 			//we're going to REPLACE the existing mce css
567 567
 			//we need to get the css file location from the active messenger
568
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
568
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
569 569
 		}
570 570
 
571 571
 		return $mce_css;
@@ -583,37 +583,37 @@  discard block
 block discarded – undo
583 583
 			$this->_message_template_group->messenger_obj()->label['singular'],
584 584
 			$this->_message_template_group->message_type_obj()->label['singular']
585 585
 		);
586
-		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' );
586
+		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 587
 
588
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
588
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
589 589
 
590 590
 		wp_enqueue_script('ee_admin_js');
591 591
 		wp_enqueue_script('ee_msgs_edit_js');
592 592
 
593 593
 		//add in special css for tiny_mce
594
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
594
+		add_filter('mce_css', array($this, 'wp_editor_css'));
595 595
 	}
596 596
 
597 597
 
598 598
 
599 599
 	public function load_scripts_styles_display_preview_message() {
600 600
 		$this->_set_message_template_group();
601
-		if ( isset( $this->_req_data['messenger'] ) ) {
601
+		if (isset($this->_req_data['messenger'])) {
602 602
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
603 603
 		}
604 604
 
605
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
605
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
606 606
 
607 607
 
608
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
608
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
609 609
 	}
610 610
 
611 611
 
612 612
 
613 613
 	public function load_scripts_styles_settings() {
614
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
615
-		wp_enqueue_style( 'ee-text-links' );
616
-		wp_enqueue_style( 'ee-message-settings' );
614
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
615
+		wp_enqueue_style('ee-text-links');
616
+		wp_enqueue_style('ee-message-settings');
617 617
 
618 618
 		wp_enqueue_script('ee-messages-settings');
619 619
 	}
@@ -649,9 +649,9 @@  discard block
 block discarded – undo
649 649
 
650 650
 	protected function _custom_mtps_preview() {
651 651
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
652
-		$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' ) . '" />';
652
+		$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 653
 		$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>';
654
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
654
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
655 655
 	}
656 656
 
657 657
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	 * @param bool $global whether to return just global (true) or custom templates (false)
674 674
 	 * @return array|WP_Error object
675 675
 	 */
676
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
676
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
677 677
 		global $espresso_wp_user;
678 678
 		// start with an empty array
679 679
 		$message_templates = array();
@@ -683,24 +683,24 @@  discard block
 block discarded – undo
683 683
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
684 684
 		$orderby = $this->_req_data['orderby'];
685 685
 
686
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
686
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
687 687
 
688
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
689
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
688
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
689
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
690 690
 
691
-		$offset = ($current_page-1)*$per_page;
692
-		$limit = $all ? NULL : array( $offset, $per_page );
691
+		$offset = ($current_page - 1) * $per_page;
692
+		$limit = $all ? NULL : array($offset, $per_page);
693 693
 
694 694
 
695 695
 		//options will match what is in the _views array property
696
-		switch( $type ) {
696
+		switch ($type) {
697 697
 
698 698
 			case 'in_use':
699
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
699
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
700 700
 				break;
701 701
 
702 702
 			default:
703
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
703
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
704 704
 
705 705
 		}
706 706
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		$imts = $installed_objects['message_types'];
737 737
 		$installed = array();
738 738
 
739
-		foreach ( $imts as $message_type ) {
739
+		foreach ($imts as $message_type) {
740 740
 			$installed[$message_type->name]['obj'] = $message_type;
741 741
 		}
742 742
 
@@ -768,24 +768,24 @@  discard block
 block discarded – undo
768 768
 	 * @access  protected
769 769
 	 * @return void
770 770
 	 */
771
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
771
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
772 772
 		//set values override any request data
773
-		$message_type = !empty( $message_type ) ? $message_type : '';
774
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
773
+		$message_type = ! empty($message_type) ? $message_type : '';
774
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
775 775
 
776
-		$messenger = !empty( $messenger ) ? $messenger : '';
777
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
776
+		$messenger = ! empty($messenger) ? $messenger : '';
777
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
778 778
 
779
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
780
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
779
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
780
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
781 781
 
782 782
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
783
-		if ( empty( $message_type ) || empty( $messenger )  )
783
+		if (empty($message_type) || empty($messenger))
784 784
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
785 785
 
786 786
 		//we need the GRP_ID for the template being used as the base for the new template
787
-		if ( empty( $GRP_ID ) )
788
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
787
+		if (empty($GRP_ID))
788
+			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'));
789 789
 
790 790
 		//let's just make sure the template gets generated!
791 791
 
@@ -804,8 +804,8 @@  discard block
 block discarded – undo
804 804
 	 * @param string $messenger    messenger slug
805 805
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
806 806
 	 */
807
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
808
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
807
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
808
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
809 809
 	}
810 810
 
811 811
 
@@ -816,36 +816,36 @@  discard block
 block discarded – undo
816 816
 	 * @return void
817 817
 	 */
818 818
 	protected function _edit_message_template() {
819
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
819
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
820 820
 
821 821
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
822
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
822
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
823 823
 
824
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
824
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
825 825
 
826 826
 		$this->_set_shortcodes(); //this also sets the _message_template property.
827 827
 		$message_template_group = $this->_message_template_group;
828 828
 		$c_label = $message_template_group->context_label();
829 829
 		$c_config = $message_template_group->contexts_config();
830 830
 
831
-		reset( $c_config );
832
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
831
+		reset($c_config);
832
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
833 833
 
834 834
 
835
-		if ( empty($GRP_ID) ) {
835
+		if (empty($GRP_ID)) {
836 836
 			$action = 'insert_message_template';
837 837
 			$button_both = FALSE;
838
-			$button_text = array( __( 'Save','event_espresso') );
838
+			$button_text = array(__('Save', 'event_espresso'));
839 839
 			$button_actions = array('something_different');
840 840
 			$referrer = FALSE;
841
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
841
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
842 842
 		} else {
843 843
 			$action = 'update_message_template';
844 844
 			$button_both = TRUE;
845 845
 			$button_text = array();
846 846
 			$button_actions = array();
847 847
 			$referrer = $this->_admin_base_url;
848
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
848
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
849 849
 		}
850 850
 
851 851
 		//set active messenger for this view
@@ -855,13 +855,13 @@  discard block
 block discarded – undo
855 855
 
856 856
 		//Do we have any validation errors?
857 857
 		$validators = $this->_get_transient();
858
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
858
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
859 859
 
860 860
 
861 861
 		//we need to assemble the title from Various details
862
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
862
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
863 863
 
864
-		$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 );
864
+		$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 865
 
866 866
 		$this->_template_args['GRP_ID'] = $GRP_ID;
867 867
 		$this->_template_args['message_template'] = $message_template_group;
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 		$MSG = new EE_messages();
873 873
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
874 874
 
875
-		if ( !$template_field_structure ) {
875
+		if ( ! $template_field_structure) {
876 876
 			$template_field_structure = FALSE;
877 877
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
878 878
 		}
@@ -882,38 +882,38 @@  discard block
 block discarded – undo
882 882
 
883 883
 
884 884
 		//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.
885
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
886
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
887
-				unset( $template_field_structure[$context][$reference_field] );
885
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
886
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
887
+				unset($template_field_structure[$context][$reference_field]);
888 888
 			}
889 889
 		}
890 890
 
891 891
 		//let's loop through the template_field_structure and actually assemble the input fields!
892
-		if ( !empty($template_field_structure) ) {
893
-			$id_prefix= 'ee-msg-edit-template-fields-';
894
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
892
+		if ( ! empty($template_field_structure)) {
893
+			$id_prefix = 'ee-msg-edit-template-fields-';
894
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
895 895
 				//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.
896
-				if ( $template_field == 'extra' ) {
896
+				if ($template_field == 'extra') {
897 897
 					$this->_template_args['is_extra_fields'] = TRUE;
898
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
899
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
898
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
899
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
900 900
 							//let's verify if we need this extra field via the shortcodes parameter.
901 901
 							$continue = FALSE;
902
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
903
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
904
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
902
+							if (isset($extra_array['shortcodes_required'])) {
903
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
904
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
905 905
 										$continue = TRUE;
906 906
 								}
907
-								if ( $continue ) continue;
907
+								if ($continue) continue;
908 908
 							}
909 909
 
910
-							$field_id = $reference_field . '-' . $extra_field . '-content';
910
+							$field_id = $reference_field.'-'.$extra_field.'-content';
911 911
 							$template_form_fields[$field_id] = $extra_array;
912
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
913
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
914
-							$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;
912
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
913
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
914
+							$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;
915 915
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
916
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
916
+							$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 917
 
918 918
 							//do we have a validation error?  if we do then let's use that value instead
919 919
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -923,32 +923,32 @@  discard block
 block discarded – undo
923 923
 
924 924
 							//shortcode selector
925 925
 							$field_name_to_use = $extra_field == 'main' ? 'content' : $extra_field;
926
-							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $field_name_to_use, $field_id );
926
+							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($field_name_to_use, $field_id);
927 927
 
928
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
928
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
929 929
 								//we want to decode the entities
930
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
930
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
931 931
 
932 932
 							}/**/
933 933
 						}
934
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
935
-						$templatefield_templatename_id = $reference_field . '-name';
934
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
935
+						$templatefield_templatename_id = $reference_field.'-name';
936 936
 
937 937
 						$template_form_fields[$templatefield_MTP_id] = array(
938
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
938
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
939 939
 							'label' => NULL,
940 940
 							'input' => 'hidden',
941 941
 							'type' => 'int',
942 942
 							'required' => FALSE,
943 943
 							'validation' => FALSE,
944
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
944
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
945 945
 							'css_class' => '',
946 946
 							'format' => '%d',
947 947
 							'db-col' => 'MTP_ID'
948 948
 						);
949 949
 
950 950
 						$template_form_fields[$templatefield_templatename_id] = array(
951
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
951
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
952 952
 							'label' => NULL,
953 953
 							'input' => 'hidden',
954 954
 							'type' => 'string',
@@ -962,10 +962,10 @@  discard block
 block discarded – undo
962 962
 					}
963 963
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
964 964
 				} else {
965
-					$field_id = $template_field . '-content';
965
+					$field_id = $template_field.'-content';
966 966
 					$template_form_fields[$field_id] = $field_setup_array;
967
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
968
-					$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') : '';
967
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
968
+					$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') : '';
969 969
 
970 970
 					//do we have a validator error for this field?  if we do then we'll use that value instead
971 971
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -973,12 +973,12 @@  discard block
 block discarded – undo
973 973
 
974 974
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
975 975
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
976
-					$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;
976
+					$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 977
 
978 978
 					//shortcode selector
979
-					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $template_field, $field_id );
979
+					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($template_field, $field_id);
980 980
 
981
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
981
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
982 982
 						//we want to decode the entities
983 983
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
984 984
 					}/**/
@@ -986,25 +986,25 @@  discard block
 block discarded – undo
986 986
 
987 987
 				//k took care of content field(s) now let's take care of others.
988 988
 
989
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
990
-				$templatefield_field_templatename_id = $template_field . '-name';
989
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
990
+				$templatefield_field_templatename_id = $template_field.'-name';
991 991
 
992 992
 				//foreach template field there are actually two form fields created
993 993
 				$template_form_fields[$templatefield_MTP_id] = array(
994
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
994
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
995 995
 					'label' => NULL,
996 996
 					'input' => 'hidden',
997 997
 					'type' => 'int',
998 998
 					'required' => FALSE,
999 999
 					'validation' => TRUE,
1000
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1000
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1001 1001
 					'css_class' => '',
1002 1002
 					'format' => '%d',
1003 1003
 					'db-col' => 'MTP_ID'
1004 1004
 				);
1005 1005
 
1006 1006
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1007
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1007
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1008 1008
 					'label' => NULL,
1009 1009
 					'input' => 'hidden',
1010 1010
 					'type' => 'string',
@@ -1148,15 +1148,15 @@  discard block
 block discarded – undo
1148 1148
 				'value' => $GRP_ID
1149 1149
 				);
1150 1150
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1151
-				'name' => $action . '_nonce',
1151
+				'name' => $action.'_nonce',
1152 1152
 				'input' => 'hidden',
1153 1153
 				'type' => 'string',
1154
-				'value' => wp_create_nonce( $action . '_nonce')
1154
+				'value' => wp_create_nonce($action.'_nonce')
1155 1155
 				);
1156 1156
 
1157 1157
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1158 1158
 
1159
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1159
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1160 1160
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1161 1161
 					'name' => 'template_switch',
1162 1162
 					'input' => 'hidden',
@@ -1166,19 +1166,19 @@  discard block
 block discarded – undo
1166 1166
 			}
1167 1167
 
1168 1168
 
1169
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1170
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1169
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1170
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1171 1171
 
1172 1172
 
1173 1173
 		} //end if ( !empty($template_field_structure) )
1174 1174
 
1175 1175
 		//set extra content for publish box
1176 1176
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1177
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1177
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1178 1178
 
1179 1179
 		//add preview button
1180
-		$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 );
1181
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1180
+		$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);
1181
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1182 1182
 
1183 1183
 
1184 1184
 		//setup context switcher
@@ -1205,16 +1205,16 @@  discard block
 block discarded – undo
1205 1205
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1206 1206
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1207 1207
 
1208
-		$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';
1208
+		$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 1209
 
1210 1210
 		//send along EE_Message_Template_Group object for further template use.
1211 1211
 		$this->_template_args['MTP'] = $message_template_group;
1212 1212
 
1213
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1213
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1214 1214
 
1215 1215
 
1216 1216
 		//finally, let's set the admin_page title
1217
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1217
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1218 1218
 
1219 1219
 
1220 1220
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 	}
1228 1228
 
1229 1229
 
1230
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1230
+	public function filter_tinymce_init($mceInit, $editor_id) {
1231 1231
 		return $mceInit;
1232 1232
 	}
1233 1233
 
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	}
1239 1239
 
1240 1240
 	public function _add_form_element_before() {
1241
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1241
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1242 1242
 	}
1243 1243
 
1244 1244
 	public function _add_form_element_after() {
@@ -1256,32 +1256,32 @@  discard block
 block discarded – undo
1256 1256
 	 * @return json json object
1257 1257
 	 */
1258 1258
 	public function switch_template_pack() {
1259
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1260
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1259
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1260
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1261 1261
 
1262 1262
 		//verify we have needed values.
1263
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1263
+		if (empty($GRP_ID) || empty($template_pack)) {
1264 1264
 			$this->_template_args['error'] = TRUE;
1265
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1265
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1266 1266
 		} else {
1267 1267
 			//get template, set the new template_pack and then reset to default
1268
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1268
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1269 1269
 
1270
-			$mtpg->set_template_pack_name( $template_pack );
1270
+			$mtpg->set_template_pack_name($template_pack);
1271 1271
 			$this->_req_data['msgr'] = $mtpg->messenger();
1272 1272
 			$this->_req_data['mt'] = $mtpg->message_type();
1273 1273
 
1274 1274
 			$query_args = $this->_reset_to_default_template();
1275 1275
 
1276
-			if ( empty( $query_args['id'] ) ) {
1277
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1276
+			if (empty($query_args['id'])) {
1277
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1278 1278
 				$this->_template_args['error'] = TRUE;
1279 1279
 			} else {
1280
-				$template_label =$mtpg->get_template_pack()->label;
1280
+				$template_label = $mtpg->get_template_pack()->label;
1281 1281
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1282
-				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 ) );
1282
+				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 1283
 				//generate the redirect url for js.
1284
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1284
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1285 1285
 				$this->_template_args['data']['redirect_url'] = $url;
1286 1286
 				$this->_template_args['success'] = true;
1287 1287
 			}
@@ -1302,56 +1302,56 @@  discard block
 block discarded – undo
1302 1302
 	protected function _reset_to_default_template() {
1303 1303
 		$success = TRUE;
1304 1304
 		$templates = array();
1305
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1305
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1306 1306
 		//we need to make sure we've got the info we need.
1307
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1308
-			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__ );
1307
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1308
+			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__);
1309 1309
 			$success = FALSE;
1310 1310
 		}
1311 1311
 
1312 1312
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1313
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1313
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1314 1314
 
1315
-		if ( $success ) {
1315
+		if ($success) {
1316 1316
 
1317 1317
 			//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.
1318
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1318
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1319 1319
 
1320 1320
 
1321 1321
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1322
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1322
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1323 1323
 
1324
-			if ( $success ) {
1324
+			if ($success) {
1325 1325
 				//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.
1326
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1326
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1327 1327
 			}
1328 1328
 
1329 1329
 		}
1330 1330
 
1331 1331
 		//any error messages?
1332
-		if ( !$success ) {
1333
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1332
+		if ( ! $success) {
1333
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1334 1334
 		}
1335 1335
 
1336 1336
 		//all good, let's add a success message!
1337
-		if ( $success && ! empty( $templates ) ) {
1337
+		if ($success && ! empty($templates)) {
1338 1338
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1339 1339
 			EE_Error::overwrite_success();
1340
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1340
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1341 1341
 		}
1342 1342
 
1343 1343
 
1344 1344
 		$query_args = array(
1345
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1346
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1347
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1345
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1346
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1347
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1348 1348
 			);
1349 1349
 
1350 1350
 		//if called via ajax then we return query args otherwise redirect
1351
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1351
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1352 1352
 			return $query_args;
1353 1353
 		} else {
1354
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1354
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1355 1355
 		}
1356 1356
 
1357 1357
 	}
@@ -1364,20 +1364,20 @@  discard block
 block discarded – undo
1364 1364
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1365 1365
 	 * @return void
1366 1366
 	 */
1367
-	public function _preview_message( $send = FALSE ) {
1367
+	public function _preview_message($send = FALSE) {
1368 1368
 		//first make sure we've got the necessary parameters
1369
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1370
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1369
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1370
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1371 1371
 		}
1372 1372
 
1373
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1373
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1374 1374
 
1375 1375
 		$MSG = new EE_messages();
1376 1376
 
1377 1377
 		//get the preview!
1378
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1378
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1379 1379
 
1380
-		if ( $send ) {
1380
+		if ($send) {
1381 1381
 			return $preview;
1382 1382
 		}
1383 1383
 
@@ -1387,16 +1387,16 @@  discard block
 block discarded – undo
1387 1387
 			'context' => $this->_req_data['context'],
1388 1388
 			'action' => 'edit_message_template'
1389 1389
 			);
1390
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1391
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1390
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1391
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1392 1392
 
1393 1393
 		//let's provide a helpful title for context
1394
-		$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']) );
1394
+		$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 1395
 
1396 1396
 
1397 1397
 		//setup display of preview.
1398 1398
 		$this->_admin_page_title = $preview_title;
1399
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1399
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1400 1400
 		$this->_template_args['data']['force_json'] = TRUE;
1401 1401
 	}
1402 1402
 
@@ -1424,9 +1424,9 @@  discard block
 block discarded – undo
1424 1424
 	 * @return void
1425 1425
 	 */
1426 1426
 	protected function _register_edit_meta_boxes() {
1427
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1428
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1429
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1427
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1428
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1429
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1430 1430
 	}
1431 1431
 
1432 1432
 
@@ -1447,10 +1447,10 @@  discard block
 block discarded – undo
1447 1447
 
1448 1448
 		$tp_select_values = array();
1449 1449
 
1450
-		foreach ( $template_packs as $tp ) {
1450
+		foreach ($template_packs as $tp) {
1451 1451
 			//only include template packs that support this messenger and message type!
1452 1452
 			$supports = $tp->get_supports();
1453
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1453
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1454 1454
 				//not supported
1455 1455
 				continue;
1456 1456
 			}
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 		}
1463 1463
 
1464 1464
 		//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.
1465
-		if ( empty( $tp_select_values ) ) {
1465
+		if (empty($tp_select_values)) {
1466 1466
 			$tp_select_values[] = array(
1467 1467
 				'text' => __('Default', 'event_espresso'),
1468 1468
 				'id' => 'default'
@@ -1470,27 +1470,27 @@  discard block
 block discarded – undo
1470 1470
 		}
1471 1471
 
1472 1472
 		//setup variation select values for the currently selected template.
1473
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1473
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1474 1474
 		$variations_select_values = array();
1475
-		foreach ( $variations as $variation => $label ) {
1475
+		foreach ($variations as $variation => $label) {
1476 1476
 			$variations_select_values[] = array(
1477 1477
 				'text' => $label,
1478 1478
 				'id' => $variation
1479 1479
 				);
1480 1480
 		}
1481 1481
 
1482
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1482
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1483 1483
 
1484
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1485
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1484
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1485
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1486 1486
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1487 1487
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1488 1488
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1489 1489
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1490 1490
 
1491
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1491
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1492 1492
 
1493
-		EEH_Template::display_template( $template, $template_args );
1493
+		EEH_Template::display_template($template, $template_args);
1494 1494
 	}
1495 1495
 
1496 1496
 
@@ -1511,52 +1511,52 @@  discard block
 block discarded – undo
1511 1511
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1512 1512
 			);
1513 1513
 
1514
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1514
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1515 1515
 
1516 1516
 
1517 1517
 		//test button
1518 1518
 		//first we need to see if there are any fields
1519 1519
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1520 1520
 
1521
-		if ( !empty( $fields ) ) {
1521
+		if ( ! empty($fields)) {
1522 1522
 			//yup there be fields
1523
-			foreach ( $fields as $field => $config ) {
1524
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1523
+			foreach ($fields as $field => $config) {
1524
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1525 1525
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1526
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1527
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1526
+				$default = isset($config['default']) ? $config['default'] : '';
1527
+				$default = isset($config['value']) ? $config['value'] : $default;
1528 1528
 
1529 1529
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1530 1530
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1531
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1531
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1532 1532
 
1533 1533
 				$template_form_fields[$field_id] = array(
1534
-					'name' => 'test_settings_fld[' . $field . ']',
1534
+					'name' => 'test_settings_fld['.$field.']',
1535 1535
 					'label' => $config['label'],
1536 1536
 					'input' => $config['input'],
1537 1537
 					'type' => $config['type'],
1538 1538
 					'required' => $config['required'],
1539 1539
 					'validation' => $config['validation'],
1540
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1540
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1541 1541
 					'css_class' => $config['css_class'],
1542
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1542
+					'options' => isset($config['options']) ? $config['options'] : array(),
1543 1543
 					'default' => $default,
1544 1544
 					'format' => $config['format']
1545 1545
 					);
1546 1546
 			}
1547 1547
 		}
1548 1548
 
1549
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1549
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1550 1550
 
1551 1551
 		$test_settings_html = '';
1552 1552
 		//print out $test_settings_fields
1553
-		if ( !empty( $test_settings_fields ) ) {
1553
+		if ( ! empty($test_settings_fields)) {
1554 1554
 			echo $test_settings_fields;
1555
-			$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>';
1555
+			$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 1556
 		}
1557 1557
 
1558 1558
 		//and button
1559
-		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>';
1559
+		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 1560
 	}
1561 1561
 
1562 1562
 
@@ -1571,13 +1571,13 @@  discard block
 block discarded – undo
1571 1571
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1572 1572
      * @return string
1573 1573
     */
1574
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1574
+	protected function _get_shortcode_selector($field, $linked_input_id) {
1575 1575
 		$template_args = array(
1576
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
1576
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
1577 1577
 			'fieldname' => $field,
1578 1578
 			'linked_input_id' => $linked_input_id
1579 1579
 		);
1580
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
1580
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
1581 1581
 	}
1582 1582
 
1583 1583
 
@@ -1591,13 +1591,13 @@  discard block
 block discarded – undo
1591 1591
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1592 1592
 		$messenger = $this->_message_template_group->messenger_obj();
1593 1593
 		//now let's set the content depending on the status of the shortcodes array
1594
-		if ( empty( $shortcodes ) ) {
1595
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1594
+		if (empty($shortcodes)) {
1595
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1596 1596
 			echo $content;
1597 1597
 		} else {
1598 1598
 			$alt = 0;
1599 1599
 			?>
1600
-			<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>
1600
+			<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 1601
 			<?php
1602 1602
 		}
1603 1603
 
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 	protected function _set_shortcodes() {
1615 1615
 
1616 1616
 		//no need to run this if the property is already set
1617
-		if ( !empty($this->_shortcodes ) ) return;
1617
+		if ( ! empty($this->_shortcodes)) return;
1618 1618
 
1619 1619
 		$this->_shortcodes = $this->_get_shortcodes();
1620 1620
 	}
@@ -1631,14 +1631,14 @@  discard block
 block discarded – undo
1631 1631
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1632 1632
 	 * @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.
1633 1633
 	 */
1634
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1634
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1635 1635
 		$this->_set_message_template_group();
1636 1636
 
1637 1637
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1638
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1639
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1638
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1639
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1640 1640
 
1641
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1641
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1642 1642
 	}
1643 1643
 
1644 1644
 
@@ -1651,19 +1651,19 @@  discard block
 block discarded – undo
1651 1651
 	 */
1652 1652
 	protected function _set_message_template_group() {
1653 1653
 
1654
-		if ( !empty( $this->_message_template_group ) )
1654
+		if ( ! empty($this->_message_template_group))
1655 1655
 			return; //get out if this is already set.
1656 1656
 
1657
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1658
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1657
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1658
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1659 1659
 
1660 1660
 		//let's get the message templates
1661 1661
 		$MTP = EEM_Message_Template_Group::instance();
1662 1662
 
1663
-		if ( empty($GRP_ID) )
1663
+		if (empty($GRP_ID))
1664 1664
 			$this->_message_template_group = $MTP->create_default_object();
1665 1665
 		else
1666
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1666
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1667 1667
 
1668 1668
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1669 1669
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1689,26 +1689,26 @@  discard block
 block discarded – undo
1689 1689
 		<div class="ee-msg-switcher-container">
1690 1690
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1691 1691
 				<?php
1692
-					foreach ( $args as $name => $value ) {
1693
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1692
+					foreach ($args as $name => $value) {
1693
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1694 1694
 						?>
1695 1695
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1696 1696
 						<?php
1697 1697
 					}
1698 1698
 					//setup nonce_url
1699
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1699
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1700 1700
 				?>
1701 1701
 				<select name="context">
1702 1702
 					<?php
1703 1703
 					$context_templates = $template_group_object->context_templates();
1704
-					if ( is_array($context_templates) ) :
1705
-							foreach ( $context_templates as $context => $template_fields ) :
1704
+					if (is_array($context_templates)) :
1705
+							foreach ($context_templates as $context => $template_fields) :
1706 1706
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1707 1707
 					?>
1708 1708
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1709 1709
 					<?php endforeach; endif; ?>
1710 1710
 				</select>
1711
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1711
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1712 1712
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1713 1713
 			</form>
1714 1714
 			<?php echo $args['extra']; ?>
@@ -1732,8 +1732,8 @@  discard block
 block discarded – undo
1732 1732
 	 * @param int $index This helps us know which template field to select from the request array.
1733 1733
 	 */
1734 1734
 	protected function _set_message_template_column_values($index) {
1735
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1736
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1735
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1736
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1737 1737
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1738 1738
 			}
1739 1739
 		} else {
@@ -1765,27 +1765,27 @@  discard block
 block discarded – undo
1765 1765
 
1766 1766
 
1767 1767
 
1768
-	protected function _insert_or_update_message_template($new = FALSE ) {
1768
+	protected function _insert_or_update_message_template($new = FALSE) {
1769 1769
 
1770
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1770
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1771 1771
 		$success = 0;
1772 1772
 		$override = FALSE;
1773 1773
 
1774 1774
 		//setup notices description
1775
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1776
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1777
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1775
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1776
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1777
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1778 1778
 
1779
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1779
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1780 1780
 		$item_desc .= 'Message Template';
1781 1781
 		$query_args = array();
1782 1782
 		$validates = '';
1783 1783
 
1784 1784
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1785
-		if ( $new ) {
1786
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1787
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1788
-				if ( empty($edit_array) ) {
1785
+		if ($new) {
1786
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1787
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1788
+				if (empty($edit_array)) {
1789 1789
 					$success = 0;
1790 1790
 				} else {
1791 1791
 					$success = 1;
@@ -1804,34 +1804,34 @@  discard block
 block discarded – undo
1804 1804
 
1805 1805
 
1806 1806
 			//run update for each template field in displayed context
1807
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1808
-				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__ );
1807
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1808
+				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__);
1809 1809
 				$success = 0;
1810 1810
 				$action_desc = '';
1811 1811
 
1812 1812
 			} else {
1813 1813
 				//first validate all fields!
1814
-				$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']);
1814
+				$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 1815
 
1816 1816
 				//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.
1817
-				if ( is_array($validates) && !empty($validates) ) {
1817
+				if (is_array($validates) && ! empty($validates)) {
1818 1818
 					//add the transient so when the form loads we know which fields to highlight
1819
-					$this->_add_transient( 'edit_message_template', $validates );
1819
+					$this->_add_transient('edit_message_template', $validates);
1820 1820
 
1821 1821
 					$success = 0;
1822
-					$action_desc ='';
1822
+					$action_desc = '';
1823 1823
 
1824 1824
 					//setup notices
1825
-					foreach ( $validates as $field => $error ) {
1826
-						if ( isset($error['msg'] ) )
1827
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1825
+					foreach ($validates as $field => $error) {
1826
+						if (isset($error['msg']))
1827
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1828 1828
 					}
1829 1829
 
1830 1830
 				} else {
1831
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1831
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1832 1832
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1833 1833
 
1834
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1834
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1835 1835
 
1836 1836
 						$message_template_fields = array(
1837 1837
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1839,10 +1839,10 @@  discard block
 block discarded – undo
1839 1839
 							'MTP_context' => $set_column_values['MTP_context'],
1840 1840
 							'MTP_content' => $set_column_values['MTP_content']
1841 1841
 							);
1842
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1843
-							if ( $updated === FALSE ) {
1844
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1845
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1842
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1843
+							if ($updated === FALSE) {
1844
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1845
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1846 1846
 							} else {
1847 1847
 								$success = 1;
1848 1848
 							}
@@ -1859,24 +1859,24 @@  discard block
 block discarded – undo
1859 1859
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1860 1860
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1861 1861
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1862
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1863
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1862
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1863
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1864 1864
 						);
1865 1865
 
1866
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1867
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1866
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1867
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1868 1868
 
1869
-					if ( $updated === FALSE ) {
1870
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1871
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1869
+					if ($updated === FALSE) {
1870
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1871
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1872 1872
 					} else {
1873 1873
 						//k now we need to ensure the template_pack and template_variation fields are set.
1874
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1875
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1876
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1877
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1878
-							$mtpg_obj->set_template_pack_name( $template_pack );
1879
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1874
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1875
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1876
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1877
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1878
+							$mtpg_obj->set_template_pack_name($template_pack);
1879
+							$mtpg_obj->set_template_pack_variation($template_variation);
1880 1880
 						}
1881 1881
 						$success = 1;
1882 1882
 					}
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
 		}
1887 1887
 
1888 1888
 		//we return things differently if doing ajax
1889
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1889
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1890 1890
 			$this->_template_args['success'] = $success;
1891 1891
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1892 1892
 			$this->_template_args['content'] = '';
@@ -1894,9 +1894,9 @@  discard block
 block discarded – undo
1894 1894
 				'grpID' => $edit_array['GRP_ID'],
1895 1895
 				'templateName' => $edit_array['template_name']
1896 1896
 				);
1897
-			if ( $success ) {
1897
+			if ($success) {
1898 1898
 				EE_Error::overwrite_success();
1899
-				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') );
1899
+				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 1900
 			}
1901 1901
 
1902 1902
 			$this->_return_json();
@@ -1904,13 +1904,13 @@  discard block
 block discarded – undo
1904 1904
 
1905 1905
 
1906 1906
 		//was a test send triggered?
1907
-		if ( isset( $this->_req_data['test_button'] ) ) {
1907
+		if (isset($this->_req_data['test_button'])) {
1908 1908
 			EE_Error::overwrite_success();
1909
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1909
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1910 1910
 			$override = TRUE;
1911 1911
 		}
1912 1912
 
1913
-		if ( empty( $query_args ) ) {
1913
+		if (empty($query_args)) {
1914 1914
 			$query_args = array(
1915 1915
 				'id' => $this->_req_data['GRP_ID'],
1916 1916
 				'context' => $this->_req_data['MTP_context'],
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
 				);
1919 1919
 		}
1920 1920
 
1921
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1921
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1922 1922
 	}
1923 1923
 
1924 1924
 
@@ -1931,24 +1931,24 @@  discard block
 block discarded – undo
1931 1931
 	 * @param  string $message_type message type being tested
1932 1932
 	 * @return void
1933 1933
 	 */
1934
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1934
+	protected function _do_test_send($context, $messenger, $message_type) {
1935 1935
 		//set things up for preview
1936 1936
 		$this->_req_data['messenger'] = $messenger;
1937 1937
 		$this->_req_data['message_type'] = $message_type;
1938 1938
 		$this->_req_data['context'] = $context;
1939
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1939
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1940 1940
 
1941 1941
 		//let's save any existing fields that might be required by the messenger
1942
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1943
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1942
+		if (isset($this->_req_data['test_settings_fld'])) {
1943
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1944 1944
 		}
1945 1945
 
1946 1946
 		$success = $this->_preview_message(TRUE);
1947 1947
 
1948
-		if ( $success ) {
1949
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1948
+		if ($success) {
1949
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1950 1950
 		} else {
1951
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1951
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1952 1952
 		}
1953 1953
 	}
1954 1954
 
@@ -1970,11 +1970,11 @@  discard block
 block discarded – undo
1970 1970
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1971 1971
 
1972 1972
 		//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.
1973
-		if ( empty( $message_types ) )
1973
+		if (empty($message_types))
1974 1974
 			return true;
1975 1975
 
1976 1976
 
1977
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1977
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1978 1978
 
1979 1979
 	}
1980 1980
 
@@ -1990,33 +1990,33 @@  discard block
 block discarded – undo
1990 1990
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1991 1991
 	 * @return void
1992 1992
 	 */
1993
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1994
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1993
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1994
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1995 1995
 		$MTP = EEM_Message_Template_Group::instance();
1996 1996
 
1997 1997
 		$success = 1;
1998 1998
 
1999 1999
 		//incoming GRP_IDs
2000
-		if ( $all ) {
2000
+		if ($all) {
2001 2001
 			//Checkboxes
2002
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2002
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2003 2003
 				//if array has more than one element then success message should be plural.
2004 2004
 				//todo: what about nonce?
2005
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2005
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2006 2006
 
2007 2007
 				//cycle through checkboxes
2008
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2009
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2010
-					if ( ! $trashed_or_restored ) {
2008
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2009
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2010
+					if ( ! $trashed_or_restored) {
2011 2011
 						$success = 0;
2012 2012
 					}
2013 2013
 				}
2014 2014
 			} else {
2015 2015
 				//grab single GRP_ID and handle
2016
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2017
-				if ( ! empty( $GRP_ID ) ) {
2018
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2019
-					if ( ! $trashed_or_restored ) {
2016
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2017
+				if ( ! empty($GRP_ID)) {
2018
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2019
+					if ( ! $trashed_or_restored) {
2020 2020
 						$success = 0;
2021 2021
 					}
2022 2022
 				} else {
@@ -2028,13 +2028,13 @@  discard block
 block discarded – undo
2028 2028
 
2029 2029
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2030 2030
 
2031
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2031
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2032 2032
 
2033 2033
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2034 2034
 
2035
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2035
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2036 2036
 
2037
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2037
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2038 2038
 
2039 2039
 	}
2040 2040
 
@@ -2050,26 +2050,26 @@  discard block
 block discarded – undo
2050 2050
 	 * @return void
2051 2051
 	 */
2052 2052
 	protected function _delete_message_template() {
2053
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2053
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2054 2054
 
2055 2055
 		$success = 1;
2056 2056
 
2057 2057
 		//checkboxes
2058
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2058
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2059 2059
 			//if array has more than one element then success message should be plural
2060
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2060
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2061 2061
 
2062 2062
 			//cycle through bulk action checkboxes
2063
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2064
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2063
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2064
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2065 2065
 			}
2066 2066
 		} else {
2067 2067
 			//grab single grp_id and delete
2068
-			$GRP_ID = absint($this->_req_data['id'] );
2069
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2068
+			$GRP_ID = absint($this->_req_data['id']);
2069
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2070 2070
 		}
2071 2071
 
2072
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2072
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2073 2073
 
2074 2074
 	}
2075 2075
 
@@ -2082,20 +2082,20 @@  discard block
 block discarded – undo
2082 2082
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2083 2083
 	 * @return success        boolean to indicate the success of the deletes or not.
2084 2084
 	 */
2085
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2085
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2086 2086
 		$success = 1;
2087 2087
 		$MTPG = EEM_Message_Template_Group::instance();
2088 2088
 		//first let's GET this group
2089
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2089
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2090 2090
 		//then delete permanently all the related Message Templates
2091
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2091
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2092 2092
 
2093
-		if ( $deleted === 0 )
2093
+		if ($deleted === 0)
2094 2094
 			$success = 0;
2095 2095
 
2096 2096
 		//now delete permanently this particular group
2097 2097
 
2098
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2098
+		if ($include_group && ! $MTG->delete_permanently()) {
2099 2099
 			$success = 0;
2100 2100
 		}
2101 2101
 		return $success;
@@ -2113,7 +2113,7 @@  discard block
 block discarded – undo
2113 2113
 	*	@return string
2114 2114
 	*/
2115 2115
 	protected function _learn_more_about_message_templates_link() {
2116
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2116
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2117 2117
 	}
2118 2118
 
2119 2119
 
@@ -2130,10 +2130,10 @@  discard block
 block discarded – undo
2130 2130
 
2131 2131
 		$this->_set_m_mt_settings();
2132 2132
 
2133
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2133
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2134 2134
 
2135 2135
 		//let's setup the messenger tabs
2136
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2136
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2137 2137
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2138 2138
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2139 2139
 
@@ -2152,10 +2152,10 @@  discard block
 block discarded – undo
2152 2152
 	 */
2153 2153
 	protected function _set_m_mt_settings() {
2154 2154
 		//first if this is already set then lets get out no need to regenerate data.
2155
-		if ( !empty($this->_m_mt_settings) )
2155
+		if ( ! empty($this->_m_mt_settings))
2156 2156
 			return;
2157 2157
 
2158
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2158
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2159 2159
 
2160 2160
 		//get all installed messengers and message_types
2161 2161
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2165,10 +2165,10 @@  discard block
 block discarded – undo
2165 2165
 
2166 2166
 		//assemble the array for the _tab_text_links helper
2167 2167
 
2168
-		foreach ( $messengers as $messenger ) {
2168
+		foreach ($messengers as $messenger) {
2169 2169
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2170 2170
 				'label' => ucwords($messenger->label['singular']),
2171
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2171
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2172 2172
 				'href' => $messenger->name,
2173 2173
 				'title' => __('Modify this Messenger', 'event_espresso'),
2174 2174
 				'slug' => $messenger->name,
@@ -2178,23 +2178,23 @@  discard block
 block discarded – undo
2178 2178
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2179 2179
 
2180 2180
 			//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.
2181
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2182
-			foreach ( $message_types as $message_type ) {
2181
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2182
+			foreach ($message_types as $message_type) {
2183 2183
 				//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.
2184
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2184
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2185 2185
 					continue;
2186 2186
 				}
2187 2187
 
2188
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2188
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2189 2189
 
2190 2190
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2191 2191
 						'label' => ucwords($message_type->label['singular']),
2192
-						'class' => 'message-type-' . $a_or_i,
2193
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2194
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2195
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2192
+						'class' => 'message-type-'.$a_or_i,
2193
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2194
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2195
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2196 2196
 						'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'),
2197
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2197
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2198 2198
 						'slug' => $message_type->name,
2199 2199
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2200 2200
 						'obj' => $message_type
@@ -2211,34 +2211,34 @@  discard block
 block discarded – undo
2211 2211
 	 * @param  boolean $active       Whether the message type is active or not
2212 2212
 	 * @return string                html output for the content
2213 2213
 	 */
2214
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2214
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2215 2215
 		//get message type fields
2216 2216
 		$fields = $message_type->get_admin_settings_fields();
2217
-		$settings_template_args['template_form_fields']= '';
2217
+		$settings_template_args['template_form_fields'] = '';
2218 2218
 
2219
-		if ( !empty( $fields ) && $active ) {
2219
+		if ( ! empty($fields) && $active) {
2220 2220
 
2221
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2221
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2222 2222
 
2223
-			foreach( $fields as $fldname => $fldprops ) {
2224
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2223
+			foreach ($fields as $fldname => $fldprops) {
2224
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2225 2225
 				$template_form_field[$field_id] = array(
2226
-					'name' => 'message_type_settings[' . $fldname . ']',
2226
+					'name' => 'message_type_settings['.$fldname.']',
2227 2227
 					'label' => $fldprops['label'],
2228 2228
 					'input' => $fldprops['field_type'],
2229 2229
 					'type' => $fldprops['value_type'],
2230 2230
 					'required' => $fldprops['required'],
2231 2231
 					'validation' => $fldprops['validation'],
2232
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2233
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2234
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2232
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2233
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2234
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2235 2235
 					'css_class' => 'no-drag',
2236 2236
 					'format' => $fldprops['format']
2237 2237
 					);
2238 2238
 			}
2239 2239
 
2240 2240
 
2241
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2241
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2242 2242
 		}
2243 2243
 
2244 2244
 		$settings_template_args['description'] = $message_type->description;
@@ -2258,13 +2258,13 @@  discard block
 block discarded – undo
2258 2258
 					)
2259 2259
 				);
2260 2260
 
2261
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2262
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2261
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2262
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2263 2263
 
2264 2264
 
2265 2265
 
2266
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2267
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2266
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2267
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2268 2268
 		return $content;
2269 2269
 	}
2270 2270
 
@@ -2281,21 +2281,21 @@  discard block
 block discarded – undo
2281 2281
 		$m_boxes = $mt_boxes = array();
2282 2282
 		$m_template_args = $mt_template_args = array();
2283 2283
 
2284
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2284
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2285 2285
 
2286
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2286
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2287 2287
 
2288
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2289
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2288
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2289
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2290 2290
 
2291 2291
 			//messenger meta boxes
2292 2292
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2293
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2294
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2295
-			$m_template_args[$messenger . '_a_box'] = array(
2296
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2297
-					'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'] ) : '',
2298
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2293
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2294
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2295
+			$m_template_args[$messenger.'_a_box'] = array(
2296
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2297
+					'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']) : '',
2298
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2299 2299
 					'hidden' => $active ? '' : ' hidden',
2300 2300
 					'hide_on_message' => $hide_on_message,
2301 2301
 					'messenger' => $messenger,
@@ -2304,10 +2304,10 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 
2306 2306
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2307
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2308
-			$mt_template_args[$messenger . '_i_box'] = array(
2309
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2310
-				'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'] ) : '',
2307
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2308
+			$mt_template_args[$messenger.'_i_box'] = array(
2309
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2310
+				'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']) : '',
2311 2311
 				'hidden' => $active ? '' : ' hidden',
2312 2312
 				'hide_on_message' => $hide_on_message,
2313 2313
 				'hide_off_message' => $hide_off_message,
@@ -2317,19 +2317,19 @@  discard block
 block discarded – undo
2317 2317
 		}
2318 2318
 
2319 2319
 		//register messenger metaboxes
2320
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2321
-		foreach ( $m_boxes as $box => $label ) {
2322
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2323
-			$msgr = str_replace( '_a_box', '', $box );
2324
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2320
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2321
+		foreach ($m_boxes as $box => $label) {
2322
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2323
+			$msgr = str_replace('_a_box', '', $box);
2324
+			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);
2325 2325
 		}
2326 2326
 
2327 2327
 		//register message type metaboxes
2328
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2329
-		foreach ( $mt_boxes as $box => $label ) {
2330
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2331
-			$mt = str_replace( '_i_box', '', $box );
2332
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2328
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2329
+		foreach ($mt_boxes as $box => $label) {
2330
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2331
+			$mt = str_replace('_i_box', '', $box);
2332
+			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);
2333 2333
 		}
2334 2334
 
2335 2335
 	}
@@ -2340,13 +2340,13 @@  discard block
 block discarded – undo
2340 2340
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2341 2341
 	 * @return string            html formatted tabs
2342 2342
 	 */
2343
-	protected function _get_mt_tabs( $tab_array ) {
2343
+	protected function _get_mt_tabs($tab_array) {
2344 2344
 		$tab_array = (array) $tab_array;
2345
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2345
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2346 2346
 		$tabs = '';
2347 2347
 
2348
-		foreach ( $tab_array as $tab ) {
2349
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2348
+		foreach ($tab_array as $tab) {
2349
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2350 2350
 		}
2351 2351
 
2352 2352
 		return $tabs;
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
 	 * @param  object $messenger The messenger we're setting up content for
2361 2361
 	 * @return string            html formatted content
2362 2362
 	 */
2363
-	protected function _get_messenger_box_content( $messenger ) {
2363
+	protected function _get_messenger_box_content($messenger) {
2364 2364
 
2365 2365
 		$fields = $messenger->get_admin_settings_fields();
2366 2366
 		$settings_template_args['template_form_fields'] = '';
@@ -2369,27 +2369,27 @@  discard block
 block discarded – undo
2369 2369
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2370 2370
 
2371 2371
 
2372
-		if ( !empty( $fields ) ) {
2372
+		if ( ! empty($fields)) {
2373 2373
 
2374 2374
 			$existing_settings = $messenger->get_existing_admin_settings();
2375 2375
 
2376
-			foreach( $fields as $fldname => $fldprops ) {
2377
-				$field_id = $messenger->name . '-' . $fldname;
2376
+			foreach ($fields as $fldname => $fldprops) {
2377
+				$field_id = $messenger->name.'-'.$fldname;
2378 2378
 				$template_form_field[$field_id] = array(
2379
-					'name' => 'messenger_settings[' . $field_id . ']',
2379
+					'name' => 'messenger_settings['.$field_id.']',
2380 2380
 					'label' => $fldprops['label'],
2381 2381
 					'input' => $fldprops['field_type'],
2382 2382
 					'type' => $fldprops['value_type'],
2383 2383
 					'required' => $fldprops['required'],
2384 2384
 					'validation' => $fldprops['validation'],
2385
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2385
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2386 2386
 					'css_class' => '',
2387 2387
 					'format' => $fldprops['format']
2388 2388
 					);
2389 2389
 			}
2390 2390
 
2391 2391
 
2392
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2392
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2393 2393
 		}
2394 2394
 
2395 2395
 		//we also need some hidden fields
@@ -2405,8 +2405,8 @@  discard block
 block discarded – undo
2405 2405
 			);
2406 2406
 
2407 2407
 		//make sure any active message types that are existing are included in the hidden fields
2408
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2409
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2408
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2409
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2410 2410
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2411 2411
 						'type' => 'hidden',
2412 2412
 						'value' => $mt
@@ -2414,25 +2414,25 @@  discard block
 block discarded – undo
2414 2414
 			}
2415 2415
 		}
2416 2416
 
2417
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2417
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2418 2418
 
2419
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2419
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2420 2420
 
2421 2421
 		$settings_template_args['messenger'] = $messenger->name;
2422 2422
 		$settings_template_args['description'] = $messenger->description;
2423 2423
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2424 2424
 
2425 2425
 
2426
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2426
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2427 2427
 
2428
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2428
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2429 2429
 
2430 2430
 
2431 2431
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2432
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2432
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2433 2433
 		$settings_template_args['on_off_status'] = $active ? true : false;
2434
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2435
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2434
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2435
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2436 2436
 		return $content;
2437 2437
 	}
2438 2438
 
@@ -2446,39 +2446,39 @@  discard block
 block discarded – undo
2446 2446
 	public function activate_messenger_toggle() {
2447 2447
 		$success = TRUE;
2448 2448
 		//let's check that we have required data
2449
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2450
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2449
+		if ( ! isset($this->_req_data['messenger'])) {
2450
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2451 2451
 			$success = FALSE;
2452 2452
 		}
2453 2453
 
2454 2454
 		//do a nonce check here since we're not arriving via a normal route
2455
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2456
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2455
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2456
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2457 2457
 
2458
-		$this->_verify_nonce( $nonce, $nonce_ref );
2458
+		$this->_verify_nonce($nonce, $nonce_ref);
2459 2459
 
2460 2460
 
2461 2461
 
2462
-		if ( !isset( $this->_req_data[ 'status' ])) {
2463
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2462
+		if ( ! isset($this->_req_data['status'])) {
2463
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2464 2464
 			$success = FALSE;
2465 2465
 		}
2466 2466
 
2467 2467
 		//do check to verify we have a valid status.
2468 2468
 		$status = $this->_req_data['status'];
2469 2469
 
2470
-		if ( $status != 'off' && $status != 'on' ) {
2471
-			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__ );
2470
+		if ($status != 'off' && $status != 'on') {
2471
+			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__);
2472 2472
 			$success = FALSE;
2473 2473
 		}
2474 2474
 
2475
-		if ( $success ) {
2475
+		if ($success) {
2476 2476
 			//made it here?  Stop dawdling then!!
2477
-			if ( $status == 'off' ) {
2477
+			if ($status == 'off') {
2478 2478
 				//off = deactivate.  get it?
2479
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2479
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2480 2480
 			} else {
2481
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2481
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2482 2482
 			}
2483 2483
 		}
2484 2484
 
@@ -2504,26 +2504,26 @@  discard block
 block discarded – undo
2504 2504
 
2505 2505
 
2506 2506
 		//let's make sure we have the necessary data
2507
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2508
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2507
+		if ( ! isset($this->_req_data['message_type'])) {
2508
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2509 2509
 			$success = FALSE;
2510 2510
 		}
2511 2511
 
2512 2512
 
2513 2513
 		//do a nonce check here since we're not arriving via a normal route
2514
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2515
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2514
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2515
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2516 2516
 
2517
-		$this->_verify_nonce( $nonce, $nonce_ref );
2517
+		$this->_verify_nonce($nonce, $nonce_ref);
2518 2518
 
2519 2519
 
2520
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2521
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2520
+		if ( ! isset($this->_req_data['messenger'])) {
2521
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2522 2522
 			$success = FALSE;
2523 2523
 		}
2524 2524
 
2525
-		if ( !isset( $this->_req_data[ 'status' ])) {
2526
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2525
+		if ( ! isset($this->_req_data['status'])) {
2526
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2527 2527
 			$success = FALSE;
2528 2528
 		}
2529 2529
 
@@ -2531,16 +2531,16 @@  discard block
 block discarded – undo
2531 2531
 		//do check to verify we have a valid status.
2532 2532
 		$status = $this->_req_data['status'];
2533 2533
 
2534
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2535
-			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__ );
2534
+		if ($status != 'activate' && $status != 'deactivate') {
2535
+			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__);
2536 2536
 			$success = FALSE;
2537 2537
 		}
2538 2538
 
2539 2539
 
2540
-		if ( $success ) {
2540
+		if ($success) {
2541 2541
 			//made it here? um, what are you waiting for then?
2542 2542
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2543
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2543
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2544 2544
 		}
2545 2545
 
2546 2546
 		$this->_template_args['success'] = $success;
@@ -2567,28 +2567,28 @@  discard block
 block discarded – undo
2567 2567
 		$templates = TRUE;
2568 2568
 		$this->_set_m_mt_settings();
2569 2569
 
2570
-		if ( !$deactivate ) {
2570
+		if ( ! $deactivate) {
2571 2571
 
2572 2572
 
2573 2573
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2574
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2574
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2575 2575
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2576 2576
 
2577 2577
 			//get has_active so we can sure its kept up to date.
2578
-			$has_activated = get_option( 'ee_has_activated_messages' );
2578
+			$has_activated = get_option('ee_has_activated_messages');
2579 2579
 
2580
-			if ( empty( $has_activated[$messenger] ) ) {
2580
+			if (empty($has_activated[$messenger])) {
2581 2581
 				$has_activated[$messenger] = array();
2582 2582
 			}
2583 2583
 
2584 2584
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2585 2585
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2586 2586
 
2587
-			foreach ( $default_types as $type ) {
2587
+			foreach ($default_types as $type) {
2588 2588
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2589
-				if ( !empty( $settings_fields ) ) {
2589
+				if ( ! empty($settings_fields)) {
2590 2590
 					//we have fields for this message type so let's get the defaults for saving.
2591
-					foreach ( $settings_fields as $field => $values ) {
2591
+					foreach ($settings_fields as $field => $values) {
2592 2592
 						$settings[$field] = $values['default'];
2593 2593
 					}
2594 2594
 					//let's set the data for reloading this message type form in ajax
@@ -2596,9 +2596,9 @@  discard block
 block discarded – undo
2596 2596
 				} else {
2597 2597
 					$settings = array();
2598 2598
 				}
2599
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2599
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2600 2600
 
2601
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2601
+				if ( ! in_array($type, $has_activated[$messenger])) {
2602 2602
 					$has_activated[$messenger][] = $type;
2603 2603
 				}
2604 2604
 			}
@@ -2606,41 +2606,41 @@  discard block
 block discarded – undo
2606 2606
 			//any default settings for the messenger?
2607 2607
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2608 2608
 
2609
-			if ( !empty( $msgr_settings ) ) {
2610
-				foreach ( $msgr_settings as $field => $value ) {
2609
+			if ( ! empty($msgr_settings)) {
2610
+				foreach ($msgr_settings as $field => $value) {
2611 2611
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2612 2612
 				}
2613 2613
 			}
2614 2614
 
2615 2615
 			//update settings in database
2616
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2617
-			update_option( 'ee_has_activated_messages', $has_activated );
2616
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2617
+			update_option('ee_has_activated_messages', $has_activated);
2618 2618
 
2619 2619
 
2620 2620
 			//generate new templates (if necessary)
2621
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2621
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2622 2622
 
2623 2623
 			EE_Error::overwrite_success();
2624 2624
 
2625 2625
 			//if generation failed then we need to remove the active messenger.
2626
-			if ( !$templates ) {
2626
+			if ( ! $templates) {
2627 2627
 				unset($this->_active_messengers[$messenger]);
2628
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2628
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2629 2629
 			} else {
2630 2630
 				//all is good let's do a success message
2631
-				if ( $message_type ) {
2632
-					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'] ) ) );
2631
+				if ($message_type) {
2632
+					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'])));
2633 2633
 
2634 2634
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2635
-					if ( $message_type == 'invoice' ) {
2636
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2637
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2638
-						if ( $pm instanceof EE_Payment_Method ) {
2639
-							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
2635
+					if ($message_type == 'invoice') {
2636
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2637
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2638
+						if ($pm instanceof EE_Payment_Method) {
2639
+							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'));
2640 2640
 						}
2641 2641
 					}
2642 2642
 				} else {
2643
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2643
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2644 2644
 				}
2645 2645
 			}
2646 2646
 
@@ -2656,36 +2656,36 @@  discard block
 block discarded – undo
2656 2656
 			$update_array = array(
2657 2657
 				'MTP_messenger' => $messenger);
2658 2658
 
2659
-			if ( $message_type ) {
2659
+			if ($message_type) {
2660 2660
 				$update_array['MTP_message_type'] = $message_type;
2661 2661
 			}
2662 2662
 
2663
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2663
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2664 2664
 
2665 2665
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2666 2666
 
2667 2667
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2668
-			if ( $message_type ) {
2669
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2668
+			if ($message_type) {
2669
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2670 2670
 			} else {
2671
-				unset( $this->_active_messengers[$messenger] );
2671
+				unset($this->_active_messengers[$messenger]);
2672 2672
 			}
2673 2673
 
2674
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2674
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2675 2675
 			EE_Error::overwrite_success();
2676
-			if ( $message_type ) {
2677
-				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']) ) );
2676
+			if ($message_type) {
2677
+				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'])));
2678 2678
 			} else {
2679
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2679
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2680 2680
 			}
2681 2681
 
2682 2682
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2683
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2684
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2685
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2686
-				if ( $count_updated > 0 ) {
2687
-					$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' );
2688
-					EE_Error::add_attention( $msg );
2683
+			if ($messenger == 'html' || $message_type == 'invoice') {
2684
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2685
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2686
+				if ($count_updated > 0) {
2687
+					$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');
2688
+					EE_Error::add_attention($msg);
2689 2689
 				}
2690 2690
 			}
2691 2691
 
@@ -2702,8 +2702,8 @@  discard block
 block discarded – undo
2702 2702
 	 * @return string html data
2703 2703
 	 */
2704 2704
 	public function update_mt_form() {
2705
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2706
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2705
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2706
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2707 2707
 			$this->_return_json();
2708 2708
 		}
2709 2709
 
@@ -2712,7 +2712,7 @@  discard block
 block discarded – undo
2712 2712
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2713 2713
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2714 2714
 
2715
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2715
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2716 2716
 		$this->_template_args['success'] = true;
2717 2717
 		$this->_template_args['content'] = $content;
2718 2718
 		$this->_return_json();
@@ -2726,36 +2726,36 @@  discard block
 block discarded – undo
2726 2726
 	 * @return json success or fail message
2727 2727
 	 */
2728 2728
 	public function save_settings() {
2729
-		if ( !isset( $this->_req_data['type'] ) ) {
2730
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2729
+		if ( ! isset($this->_req_data['type'])) {
2730
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2731 2731
 			$this->_template_args['error'] = TRUE;
2732 2732
 			$this->_return_json();
2733 2733
 		}
2734 2734
 
2735 2735
 
2736
-		if ( $this->_req_data['type'] == 'messenger' ) {
2736
+		if ($this->_req_data['type'] == 'messenger') {
2737 2737
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2738 2738
 			$messenger = $settings['messenger'];
2739 2739
 			//let's setup the settings data
2740
-			foreach ( $settings as $key => $value ) {
2741
-				switch ( $key ) {
2740
+			foreach ($settings as $key => $value) {
2741
+				switch ($key) {
2742 2742
 					case 'messenger' :
2743
-						unset( $settings['messenger'] );
2743
+						unset($settings['messenger']);
2744 2744
 						break;
2745 2745
 					case 'message_types' :
2746
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2747
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2748
-								if ( isset( $settings['message_types'][$mt] ) )
2749
-									$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();
2746
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2747
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2748
+								if (isset($settings['message_types'][$mt]))
2749
+									$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();
2750 2750
 							}
2751 2751
 						} else {
2752
-							foreach ( $value as $mt => $v ) {
2752
+							foreach ($value as $mt => $v) {
2753 2753
 								//let's see if this message type is already present and has settings.
2754
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2754
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2755 2755
 							}
2756 2756
 						}
2757 2757
 						//k settings are set let's get rid of the message types index
2758
-						unset( $settings['message_types'] );
2758
+						unset($settings['message_types']);
2759 2759
 						break;
2760 2760
 					default :
2761 2761
 						$settings[$key] = $value;
@@ -2765,36 +2765,36 @@  discard block
 block discarded – undo
2765 2765
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2766 2766
 		}
2767 2767
 
2768
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2768
+		else if ($this->_req_data['type'] == 'message_type') {
2769 2769
 			$settings = $this->_req_data['message_type_settings'];
2770 2770
 			$messenger = $settings['messenger'];
2771 2771
 			$message_type = $settings['message_type'];
2772 2772
 
2773
-			foreach ( $settings as $key => $value ) {
2774
-				switch ( $key ) {
2773
+			foreach ($settings as $key => $value) {
2774
+				switch ($key) {
2775 2775
 					case 'messenger' :
2776
-						unset( $settings['messenger'] );
2776
+						unset($settings['messenger']);
2777 2777
 						break;
2778 2778
 					case 'message_type' :
2779
-						unset( $settings['message_type'] );
2779
+						unset($settings['message_type']);
2780 2780
 						break;
2781 2781
 					default :
2782 2782
 						$settings['settings'][$key] = $value;
2783
-						unset( $settings[$key] );
2783
+						unset($settings[$key]);
2784 2784
 						break;
2785 2785
 				}
2786 2786
 			}
2787 2787
 
2788
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2788
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2789 2789
 		}
2790 2790
 
2791 2791
 		//okay we should have the data all setup.  Now we just update!
2792
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2792
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2793 2793
 
2794
-		if ( $success ) {
2795
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2794
+		if ($success) {
2795
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2796 2796
 		} else {
2797
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2797
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2798 2798
 		}
2799 2799
 
2800 2800
 		$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   +166 added lines, -166 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,44 +243,44 @@  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 248
 		//setup tabs, one for each payment method type
249 249
 		$tabs = array();
250 250
 		$payment_methods = array();
251
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
251
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
252 252
 			// we don't want to show admin-only PMTs for now
253
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
253
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
254 254
 				continue;
255 255
 			}
256 256
 			//check access
257
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
257
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
258 258
 				continue;
259 259
 			}
260 260
 			//check for any active pms of that type
261
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
262
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
261
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
262
+			if ( ! $payment_method instanceof EE_Payment_Method) {
263 263
 				$payment_method = EE_Payment_Method::new_instance(
264 264
 					array(
265
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
265
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
266 266
 						'PMD_type'					=>$pmt_obj->system_name(),
267 267
 						'PMD_name'				=>$pmt_obj->pretty_name(),
268 268
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
269 269
 					)
270 270
 				);
271 271
 			}
272
-			$payment_methods[ $payment_method->slug() ] = $payment_method;
272
+			$payment_methods[$payment_method->slug()] = $payment_method;
273 273
 		}
274
-		$payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods );
275
-		foreach( $payment_methods as $payment_method ) {
276
-			if ( $payment_method instanceof EE_Payment_Method ) {
274
+		$payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods);
275
+		foreach ($payment_methods as $payment_method) {
276
+			if ($payment_method instanceof EE_Payment_Method) {
277 277
 				add_meta_box(
278 278
 					//html id
279
-					'espresso_' . $payment_method->slug() . '_payment_settings',
279
+					'espresso_'.$payment_method->slug().'_payment_settings',
280 280
 					//title
281
-					sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ),
281
+					sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
282 282
 					//callback
283
-					array( $this, 'payment_method_settings_meta_box' ),
283
+					array($this, 'payment_method_settings_meta_box'),
284 284
 					//post type
285 285
 					null,
286 286
 					//context
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
 					//priority
289 289
 					'default',
290 290
 					//callback args
291
-					array( 'payment_method' => $payment_method )
291
+					array('payment_method' => $payment_method)
292 292
 				);
293 293
 				//setup for tabbed content
294
-				$tabs[ $payment_method->slug() ] = array(
294
+				$tabs[$payment_method->slug()] = array(
295 295
 					'label' => $payment_method->admin_name(),
296 296
 					'class' => $payment_method->active() ? 'gateway-active' : '',
297
-					'href'  => 'espresso_' . $payment_method->slug() . '_payment_settings',
298
-					'title' => __( 'Modify this Payment Method', 'event_espresso' ),
297
+					'href'  => 'espresso_'.$payment_method->slug().'_payment_settings',
298
+					'title' => __('Modify this Payment Method', 'event_espresso'),
299 299
 					'slug'  => $payment_method->slug()
300 300
 				);
301 301
 			}
302 302
 		}
303
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
303
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
304 304
 		$this->display_admin_page_with_sidebar();
305 305
 
306 306
 	}
@@ -311,20 +311,20 @@  discard block
 block discarded – undo
311 311
 	 *   _get_active_payment_method_slug
312 312
 	 * 	@return string
313 313
 	 */
314
-	protected function _get_active_payment_method_slug(){
314
+	protected function _get_active_payment_method_slug() {
315 315
 		$payment_method_slug = FALSE;
316 316
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
317
-		if ( isset( $this->_req_data['payment_method'] )) {
317
+		if (isset($this->_req_data['payment_method'])) {
318 318
 			// if they provided the current payment method, use it
319
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
319
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
320 320
 		}
321
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
321
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
322 322
 		// if that didn't work or wasn't provided, find another way to select the current pm
323
-		if ( ! $this->_verify_payment_method( $payment_method )) {
323
+		if ( ! $this->_verify_payment_method($payment_method)) {
324 324
 			// like, looking for an active one
325
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
325
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
326 326
 			// test that one as well
327
-			if ( $this->_verify_payment_method( $payment_method )) {
327
+			if ($this->_verify_payment_method($payment_method)) {
328 328
 				$payment_method_slug = $payment_method->slug();
329 329
 			} else {
330 330
 				$payment_method_slug = 'paypal_standard';
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	 * @param \EE_Payment_Method $payment_method
343 343
 	 * @return boolean
344 344
 	 */
345
-	protected function _verify_payment_method( $payment_method ){
345
+	protected function _verify_payment_method($payment_method) {
346 346
 		if (
347 347
 			$payment_method instanceof EE_Payment_Method &&
348 348
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
349
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
349
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
350 350
 		) {
351 351
 			return TRUE;
352 352
 		}
@@ -363,21 +363,21 @@  discard block
 block discarded – undo
363 363
 	 * @return string
364 364
 	 * @throws EE_Error
365 365
 	 */
366
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
367
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
368
-		if ( ! $payment_method instanceof EE_Payment_Method ){
369
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
366
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
367
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
368
+		if ( ! $payment_method instanceof EE_Payment_Method) {
369
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
370 370
 		}
371 371
 		$payment_method_scopes = $payment_method->active();
372 372
 		// if the payment method really exists show its form, otherwise the activation template
373
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
374
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
375
-				if ( $form->form_data_present_in( $this->_req_data )) {
376
-					$form->receive_form_submission( $this->_req_data );
373
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
374
+				$form = $this->_generate_payment_method_settings_form($payment_method);
375
+				if ($form->form_data_present_in($this->_req_data)) {
376
+					$form->receive_form_submission($this->_req_data);
377 377
 				}
378
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
378
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
379 379
 		} else {
380
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
380
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
381 381
 		}
382 382
 	}
383 383
 
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
 	 * @param \EE_Payment_Method $payment_method
391 391
 	 * @return \EE_Form_Section_Proper
392 392
 	 */
393
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
394
-		if ( ! $payment_method instanceof EE_Payment_Method ){
393
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
394
+		if ( ! $payment_method instanceof EE_Payment_Method) {
395 395
 			return new EE_Form_Section_Proper();
396 396
 		}
397 397
 		return new EE_Form_Section_Proper(
398 398
 			array(
399
-				'name' 	=> $payment_method->slug() . '_settings_form',
400
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
399
+				'name' 	=> $payment_method->slug().'_settings_form',
400
+				'html_id' 	=> $payment_method->slug().'_settings_form',
401 401
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
402 402
 					array(
403 403
 						'action' 						=> 'update_payment_method',
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 				'subsections' 			=> apply_filters(
410 410
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
411 411
 					array(
412
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
413
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
414
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
415
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
416
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
417
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
412
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
413
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
414
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
415
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
416
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
417
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
418 418
 					),
419 419
 					$payment_method
420 420
 				)
@@ -431,19 +431,19 @@  discard block
 block discarded – undo
431 431
 	 * @param \EE_Payment_Method $payment_method
432 432
 	 * @return \EE_Form_Section_Proper
433 433
 	 */
434
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
435
-		if ( $payment_method->type_obj()->requires_https() ) {
434
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
435
+		if ($payment_method->type_obj()->requires_https()) {
436 436
 			return new EE_Form_Section_HTML(
437 437
 				EEH_HTML::tr(
438 438
 					EEH_HTML::th(
439 439
 						EEH_HTML::label(
440
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
440
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
441 441
 						)
442
-					) .
442
+					).
443 443
 					EEH_HTML::td(
444
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
445
-						EEH_HTML::br() .
446
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
444
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
445
+						EEH_HTML::br().
446
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
447 447
 					)
448 448
 				)
449 449
 			);
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 	 * @param \EE_Payment_Method $payment_method
462 462
 	 * @return \EE_Form_Section_Proper
463 463
 	 */
464
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
465
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
464
+	protected function _currency_support(EE_Payment_Method $payment_method) {
465
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
466 466
 			return new EE_Form_Section_HTML(
467 467
 				EEH_HTML::tr(
468 468
 					EEH_HTML::th(
469 469
 						EEH_HTML::label(
470
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
470
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
471 471
 						)
472
-					) .
472
+					).
473 473
 					EEH_HTML::td(
474 474
 						EEH_HTML::strong(
475 475
 							sprintf(
476
-								__( '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'),
476
+								__('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'),
477 477
 								EE_Config::instance()->currency->code
478 478
 							)
479 479
 						)
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
 	 * @param \EE_Payment_Method $payment_method
494 494
 	 * @return \EE_Form_Section_HTML
495 495
 	 */
496
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
496
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
497 497
 		//modify the form so we only have/show fields that will be implemented for this version
498
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
498
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
499 499
 	}
500 500
 
501 501
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	 * @return \EE_Payment_Method_Form
509 509
 	 * @throws \EE_Error
510 510
 	 */
511
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
512
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
511
+	protected function _simplify_form($form_section, $payment_method_name = '') {
512
+		if ($form_section instanceof EE_Payment_Method_Form) {
513 513
 			$form_section->exclude(
514 514
 				array(
515 515
 					'PMD_type', //dont want them changing the type
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 			);
521 521
 			return $form_section;
522 522
 		} else {
523
-			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 ));
523
+			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));
524 524
 		}
525 525
 	}
526 526
 
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 	 * @param \EE_Payment_Method $payment_method
534 534
 	 * @return \EE_Form_Section_HTML
535 535
 	 */
536
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
536
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
537 537
 		$update_button = new EE_Submit_Input(
538 538
 			array(
539
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
540
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
539
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
540
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
541 541
 				'html_label' => EEH_HTML::nbsp()
542 542
 			)
543 543
 		);
544 544
 		return new EE_Form_Section_HTML(
545
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
545
+			EEH_HTML::no_row(EEH_HTML::br(2)).
546 546
 			EEH_HTML::tr(
547
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
547
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
548 548
 				EEH_HTML::td(
549 549
 					$update_button->get_html_for_input()
550 550
 				)
@@ -561,11 +561,11 @@  discard block
 block discarded – undo
561 561
 	 * @param \EE_Payment_Method $payment_method
562 562
 	 * @return \EE_Form_Section_Proper
563 563
 	 */
564
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
565
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
564
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
565
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
566 566
 		return new EE_Form_Section_HTML(
567 567
 			EEH_HTML::tr(
568
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
568
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
569 569
 				EEH_HTML::td(
570 570
 					EEH_HTML::link(
571 571
 						EE_Admin_Page::add_query_args_and_nonce(
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 						),
578 578
 						$link_text_and_title,
579 579
 						$link_text_and_title,
580
-						'deactivate_' . $payment_method->slug(),
580
+						'deactivate_'.$payment_method->slug(),
581 581
 						'espresso-button button-secondary'
582 582
 					)
583 583
 				)
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	 * @param \EE_Payment_Method $payment_method
594 594
 	 * @return \EE_Form_Section_Proper
595 595
 	 */
596
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
597
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
596
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
597
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
598 598
 		return new EE_Form_Section_Proper(
599 599
 			array(
600
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
601
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
600
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
601
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
602 602
 				'action' 	=> '#',
603 603
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
604 604
 				'subsections' 			=> apply_filters(
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 						new EE_Form_Section_HTML(
608 608
 							EEH_HTML::tr(
609 609
 								EEH_HTML::th(
610
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
611
-								) .
610
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
611
+								).
612 612
 								EEH_HTML::td(
613 613
 									EEH_HTML::link(
614 614
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 										),
621 621
 										$link_text_and_title,
622 622
 										$link_text_and_title,
623
-										'activate_' . $payment_method->slug(),
623
+										'activate_'.$payment_method->slug(),
624 624
 										'espresso-button-green button-primary'
625 625
 									)
626 626
 								)
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 	protected function _fine_print() {
643 643
 		return new EE_Form_Section_HTML(
644 644
 			EEH_HTML::tr(
645
-				EEH_HTML::th() .
645
+				EEH_HTML::th().
646 646
 				EEH_HTML::td(
647
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
647
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
648 648
 				)
649 649
 			)
650 650
 		);
@@ -656,15 +656,15 @@  discard block
 block discarded – undo
656 656
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
657 657
 	 * @global WP_User $current_user
658 658
 	 */
659
-	protected function _activate_payment_method(){
660
-		if(isset($this->_req_data['payment_method_type'])){
659
+	protected function _activate_payment_method() {
660
+		if (isset($this->_req_data['payment_method_type'])) {
661 661
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
662 662
 			//see if one exists
663
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
664
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
663
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
664
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
665 665
 
666
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
667
-		}else{
666
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
667
+		} else {
668 668
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
669 669
 		}
670 670
 	}
@@ -672,14 +672,14 @@  discard block
 block discarded – undo
672 672
 	/**
673 673
 	 * Deactivates the payment method with the specified slug, and redirects.
674 674
 	 */
675
-	protected function _deactivate_payment_method(){
676
-		if(isset($this->_req_data['payment_method'])){
675
+	protected function _deactivate_payment_method() {
676
+		if (isset($this->_req_data['payment_method'])) {
677 677
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
678 678
 			//deactivate it
679 679
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
680
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
681
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
682
-		}else{
680
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
681
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
682
+		} else {
683 683
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
684 684
 		}
685 685
 	}
@@ -693,39 +693,39 @@  discard block
 block discarded – undo
693 693
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
694 694
 	 * @return void
695 695
 	 */
696
-	protected function _update_payment_method(){
697
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
696
+	protected function _update_payment_method() {
697
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
698 698
 			//ok let's find which gateway form to use based on the form input
699 699
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
700 700
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
701 701
 			$correct_pmt_form_to_use = NULL;
702 702
 			$pmt_obj = NULL;
703
-			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){
703
+			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
704 704
 				/** @var $pmt_obj EE_PMT_Base */
705 705
 				//get the form and simplify it, like what we do when we display it
706 706
 				$pmt_form = $pmt_obj->settings_form();
707 707
 				$this->_simplify_form($pmt_form);
708
-				if($pmt_form->form_data_present_in($this->_req_data)){
708
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
709 709
 					$correct_pmt_form_to_use = $pmt_form;
710 710
 					break;
711 711
 				}
712 712
 			}
713 713
 			//if we couldn't find the correct payment method type...
714
-			if( ! $correct_pmt_form_to_use ){
714
+			if ( ! $correct_pmt_form_to_use) {
715 715
 				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__);
716 716
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
717 717
 			}
718 718
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
719
-			if($correct_pmt_form_to_use->is_valid()){
719
+			if ($correct_pmt_form_to_use->is_valid()) {
720 720
 				$correct_pmt_form_to_use->save();
721 721
 				$pm = $correct_pmt_form_to_use->get_model_object();
722 722
 				/** @var $pm EE_Payment_Method */
723
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
724
-			}else{
723
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug()));
724
+			} else {
725 725
 				EE_Error::add_error(
726 726
 					sprintf(
727 727
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
728
-						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )
728
+						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso')
729 729
 					),
730 730
 					__FILE__,
731 731
 					__FUNCTION__,
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	protected function _payment_settings() {
743 743
 
744 744
 		$this->_template_args['values'] = $this->_yes_no_values;
745
-		$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;
745
+		$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;
746 746
 
747
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
748
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
749
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
747
+		$this->_set_add_edit_form_tags('update_payment_settings');
748
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
749
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
750 750
 		$this->display_admin_page_with_sidebar();
751 751
 
752 752
 	}
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
 	*		@return array
761 761
 	*/
762 762
 	protected function _update_payment_settings() {
763
-		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;
764
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
763
+		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;
764
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
765 765
 
766 766
 
767
-		$what = __('Payment Settings','event_espresso');
768
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
769
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
767
+		$what = __('Payment Settings', 'event_espresso');
768
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
769
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
770 770
 
771 771
 	}
772 772
 	protected function _payment_log_overview_list_table() {
@@ -792,18 +792,18 @@  discard block
 block discarded – undo
792 792
 	 * @param bool $count
793 793
 	 * @return array
794 794
 	 */
795
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
796
-		EE_Registry::instance()->load_model( 'Change_Log' );
795
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
796
+		EE_Registry::instance()->load_model('Change_Log');
797 797
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
798
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
798
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
799 799
 		//check if they've selected a specific payment method
800
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
800
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
801 801
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
802 802
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
803 803
 		}
804 804
 		//take into account search
805
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
806
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
805
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
806
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
807 807
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
808 808
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
809 809
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -818,48 +818,48 @@  discard block
 block discarded – undo
818 818
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
819 819
 
820 820
 		}
821
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
821
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
822 822
 			//add date
823
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
824
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
823
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
824
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
825 825
 			//make sure our timestamps start and end right at the boundaries for each day
826
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
827
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
826
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
827
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
828 828
 
829 829
 			//convert to timestamps
830
-			$start_date = strtotime( $start_date );
831
-			$end_date = strtotime( $end_date );
830
+			$start_date = strtotime($start_date);
831
+			$end_date = strtotime($end_date);
832 832
 
833 833
 			//makes sure start date is the lowest value and vice versa
834
-			$start_date = min( $start_date, $end_date );
835
-			$end_date = max( $start_date, $end_date );
834
+			$start_date = min($start_date, $end_date);
835
+			$end_date = max($start_date, $end_date);
836 836
 
837 837
 			//convert for query
838
-			$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' );
839
-			$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' );
838
+			$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');
839
+			$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 840
 
841
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
841
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
842 842
 
843 843
 		}
844
-		if($count){
844
+		if ($count) {
845 845
 			return EEM_Change_Log::instance()->count($query_params);
846 846
 		}
847
-		if(isset($this->_req_data['order'])){
848
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
847
+		if (isset($this->_req_data['order'])) {
848
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
849 849
 			$query_params['order_by'] = array('LOG_time' => $sort);
850
-		}else{
850
+		} else {
851 851
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
852 852
 		}
853
-		$offset = ($current_page-1)*$per_page;
853
+		$offset = ($current_page - 1) * $per_page;
854 854
 
855
-		if( ! isset($this->_req_data['download_results'])){
856
-			$query_params['limit'] = array( $offset, $per_page );
855
+		if ( ! isset($this->_req_data['download_results'])) {
856
+			$query_params['limit'] = array($offset, $per_page);
857 857
 		}
858 858
 
859 859
 
860 860
 
861 861
 		//now they've requested to instead just download the file instead of viewing it.
862
-		if(isset($this->_req_data['download_results'])){
862
+		if (isset($this->_req_data['download_results'])) {
863 863
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
864 864
 			header('Content-Disposition: attachment');
865 865
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -881,36 +881,36 @@  discard block
 block discarded – undo
881 881
 	 * @param EE_Change_Log $logB
882 882
 	 * @return int
883 883
 	 */
884
-	protected function _sort_logs_again($logA,$logB){
884
+	protected function _sort_logs_again($logA, $logB) {
885 885
 		$timeA = $logA->get_raw('LOG_time');
886 886
 		$timeB = $logB->get_raw('LOG_time');
887
-		if($timeA == $timeB){
887
+		if ($timeA == $timeB) {
888 888
 			return 0;
889 889
 		}
890 890
 		$comparison = $timeA < $timeB ? -1 : 1;
891
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
891
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
892 892
 			return $comparison * -1;
893
-		}else{
893
+		} else {
894 894
 			return $comparison;
895 895
 		}
896 896
 	}
897 897
 
898 898
 	protected function _payment_log_details() {
899
-		EE_Registry::instance()->load_model( 'Change_Log' );
899
+		EE_Registry::instance()->load_model('Change_Log');
900 900
 		/** @var $payment_log EE_Change_Log */
901 901
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
902 902
 		$payment_method = NULL;
903 903
 		$transaction = NULL;
904
-		if( $payment_log instanceof EE_Change_Log ){
905
-			if( $payment_log->object() instanceof EE_Payment ){
904
+		if ($payment_log instanceof EE_Change_Log) {
905
+			if ($payment_log->object() instanceof EE_Payment) {
906 906
 				$payment_method = $payment_log->object()->payment_method();
907 907
 				$transaction = $payment_log->object()->transaction();
908
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
908
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
909 909
 				$payment_method = $payment_log->object();
910 910
 			}
911 911
 		}
912 912
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
913
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
913
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
914 914
 			array(
915 915
 				'payment_log'=>$payment_log,
916 916
 				'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.
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.
Spacing   +83 added lines, -83 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,32 +308,32 @@  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 315
 
316 316
         //Build row actions
317
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
317
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
318 318
 		$dl_invoice_lnk_url = $registration->invoice_url();
319 319
 		$dl_receipt_lnk_url = $registration->receipt_url();
320
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
321
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
320
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
321
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
322 322
 
323 323
 		//Build row actions
324 324
 		$view_lnk = '
325 325
 			<li>
326
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
326
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
327 327
 					<span class="dashicons dashicons-cart"></span>
328 328
 				</a>
329 329
 			</li>';
330 330
 
331 331
 
332 332
 	//only show invoice link if message type is active.
333
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
333
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
334 334
 		$dl_invoice_lnk = '
335 335
 		<li>
336
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
336
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
337 337
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
338 338
 			</a>
339 339
 		</li>';
@@ -342,10 +342,10 @@  discard block
 block discarded – undo
342 342
 	}
343 343
 
344 344
 	//only show receipt link if message type is active.
345
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
345
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
346 346
 		$dl_receipt_lnk = '
347 347
 		<li>
348
-			<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
348
+			<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
349 349
 				<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
350 350
 			</a>
351 351
 		</li>';
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 	}
355 355
 
356 356
       		//only show payment reminder link if the message type is active.
357
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
358
-		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
357
+      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
358
+		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? '
359 359
 			<li>
360
-				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
360
+				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
361 361
 					<span class="dashicons dashicons-email-alt"></span>
362 362
 				</a>
363 363
 			</li>' : '';
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 			$send_pay_lnk = '';
367 367
 		}
368 368
 
369
-		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
369
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
370 370
 			<li>
371
-				<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
371
+				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
372 372
 					<span class="dashicons dashicons-clipboard"></span>
373 373
 				</a>
374 374
 			</li>' : '';
375 375
 
376
-	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
376
+	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 377
     }
378 378
 
379 379
 
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.
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.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -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,16 +140,16 @@  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
 		}
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 
158 158
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
159 159
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
160
-		if ( is_wp_error($tabbed_content) ) {
160
+		if (is_wp_error($tabbed_content)) {
161 161
 			$tabbed_content = $tabbed_content->get_error_message();
162 162
 		}
163 163
 
164 164
 		$notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey">
165
-				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
165
+				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
166 166
 			</div><div class="ee-notices"></div>';
167 167
 
168
-		if ( defined('DOING_AJAX' ) ) {
168
+		if (defined('DOING_AJAX')) {
169 169
 			return $tabbed_content;
170 170
 		}
171 171
 
172
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
173
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
174
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
172
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
173
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
174
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
175 175
 
176 176
 	}
177 177
 
@@ -185,22 +185,22 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function create_new_custom() {
187 187
 
188
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
189
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
188
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
189
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
190 190
 		}
191 191
 
192 192
 		//let's clean up the _POST global a bit for downstream usage of name and description.
193
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
194
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
193
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
194
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
195 195
 
196 196
 
197 197
 		//set EE_Admin_Page object (see method details in EE_Admin_Hooks parent
198 198
 		$this->_set_page_object();
199 199
 
200 200
 		//is this a template switch if so EE_Admin_Page child needs this object
201
-		$this->_page_object->set_hook_object( $this );
201
+		$this->_page_object->set_hook_object($this);
202 202
 
203
-		$this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] );
203
+		$this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']);
204 204
 	}
205 205
 
206 206
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @return string (admin_footer contents)
216 216
 	 */
217 217
 	public function edit_admin_footer() {
218
-		$template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php';
218
+		$template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php';
219 219
 		EEH_Template::display_template($template_path, array());
220 220
 	}
221 221
 
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 4 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.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * This file contains the Caffeinated Messages class that handles plugging in all the caffeinated messages functionality.
4
- * @package      Event Espresso
5
- * @subpackage plugin api, messages
6
- * @since           4.3.2
7
- */
3
+	 * This file contains the Caffeinated Messages class that handles plugging in all the caffeinated messages functionality.
4
+	 * @package      Event Espresso
5
+	 * @subpackage plugin api, messages
6
+	 * @since           4.3.2
7
+	 */
8 8
 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
9 9
 
10 10
 /**
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 4 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.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author			Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link					http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EED_Recaptcha
17
- *
18
- * @package		Event Espresso
19
- * @subpackage	/modules/recaptcha/
20
- * @author		Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author			Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+	 * @ link					http://www.eventespresso.com
12
+	 * @ version		 	4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * EED_Recaptcha
17
+	 *
18
+	 * @package		Event Espresso
19
+	 * @subpackage	/modules/recaptcha/
20
+	 * @author		Brent Christensen
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 class EED_Recaptcha  extends EED_Module {
25 25
 
26 26
 
Please login to merge, or discard this patch.
Spacing   +128 added lines, -129 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
 
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function set_hooks() {
58 58
 		// use_captcha ?
59
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
59
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
60 60
 			EED_Recaptcha::set_definitions();
61 61
 			EED_Recaptcha::enqueue_styles_and_scripts();
62
-			add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 );
63
-			add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 );
64
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
65
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
66
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
67
-			add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 );
62
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
63
+			add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0);
64
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
65
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
66
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
67
+			add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1);
68 68
 		}
69 69
 	}
70 70
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	public static function set_hooks_admin() {
80 80
 		EED_Recaptcha::set_definitions();
81 81
 		// use_captcha ?
82
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
82
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
83 83
 			EED_Recaptcha::enqueue_styles_and_scripts();
84
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
85
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
86
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
84
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
85
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
86
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
87 87
 		}
88 88
 		// admin settings
89
-		add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 );
90
-		add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 );
89
+		add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1);
90
+		add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1);
91 91
 	}
92 92
 
93 93
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_definitions() {
102
-		if ( is_user_logged_in() ) {
102
+		if (is_user_logged_in()) {
103 103
 			EED_Recaptcha::$_not_a_robot = true;
104 104
 		}
105
-		define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
106
-		define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ ));
105
+		define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
106
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
107 107
 	}
108 108
 
109 109
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	public static function set_late_hooks() {
118 118
 		add_filter(
119 119
 			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
120
-			array( 'EED_Recaptcha', 'not_a_robot' )
120
+			array('EED_Recaptcha', 'not_a_robot')
121 121
 		);
122 122
 	}
123 123
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 *  @return 	void
131 131
 	 */
132 132
 	public static function enqueue_styles_and_scripts() {
133
-		wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE );
134
-		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 );
135
-		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' );
136
-		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' );
137
-		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' );
133
+		wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE);
134
+		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);
135
+		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');
136
+		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');
137
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso');
138 138
 	}
139 139
 
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @access    public
146 146
 	 * @param \WP $WP
147 147
 	 */
148
-	public function run( $WP ) {
148
+	public function run($WP) {
149 149
 	}
150 150
 
151 151
 
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
 	 *  @return boolean
156 156
 	 */
157 157
 	public static function not_a_robot() {
158
-		$not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot :
159
-			EED_Recaptcha::recaptcha_passed();
158
+		$not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed();
160 159
 		return $not_a_robot;
161 160
 	}
162 161
 
@@ -172,22 +171,22 @@  discard block
 block discarded – undo
172 171
 	 */
173 172
 	public static function display_recaptcha() {
174 173
 		// logged in means you have already passed a turing test of sorts
175
-		if ( is_user_logged_in() ) {
174
+		if (is_user_logged_in()) {
176 175
 			return;
177 176
 		}
178 177
 		// don't display if not using recaptcha or user is logged in
179
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
178
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
180 179
 			// only display if they have NOT passed the test yet
181
-			if ( ! EED_Recaptcha::$_not_a_robot ) {
180
+			if ( ! EED_Recaptcha::$_not_a_robot) {
182 181
 				EEH_Template::display_template(
183
-					RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php',
182
+					RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php',
184 183
 					array(
185 184
 						'recaptcha_publickey' 	=> EE_Registry::instance()->CFG->registration->recaptcha_publickey,
186 185
 						'recaptcha_theme' 		=> EE_Registry::instance()->CFG->registration->recaptcha_theme,
187 186
 						'recaptcha_type' 			=> EE_Registry::instance()->CFG->registration->recaptcha_type
188 187
 					)
189 188
 				);
190
-				wp_enqueue_script( 'google_recaptcha' );
189
+				wp_enqueue_script('google_recaptcha');
191 190
 			}
192 191
 		}
193 192
 	}
@@ -218,17 +217,17 @@  discard block
 block discarded – undo
218 217
 	 */
219 218
 	public static function recaptcha_passed() {
220 219
 		// logged in means you have already passed a turing test of sorts
221
-		if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) {
220
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
222 221
 			return TRUE;
223 222
 		}
224 223
 		// was test already passed?
225
-		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' );
226
-		$recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN );
224
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
225
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
227 226
 		// verify recaptcha
228 227
 		EED_Recaptcha::_get_recaptcha_response();
229
-		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) {
228
+		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
230 229
 			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
231
-			EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed ));
230
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
232 231
 			EE_Registry::instance()->SSN->update();
233 232
 		}
234 233
 		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
@@ -244,8 +243,8 @@  discard block
 block discarded – undo
244 243
 	 * @param array $recaptcha_response
245 244
 	 * @return boolean
246 245
 	 */
247
-	public static function recaptcha_response( $recaptcha_response = array() ) {
248
-		if ( EED_Recaptcha::_bypass_recaptcha() ) {
246
+	public static function recaptcha_response($recaptcha_response = array()) {
247
+		if (EED_Recaptcha::_bypass_recaptcha()) {
249 248
 			$recaptcha_response['bypass_recaptcha'] = TRUE;
250 249
 			$recaptcha_response['recaptcha_passed'] = TRUE;
251 250
 		} else {
@@ -265,16 +264,16 @@  discard block
 block discarded – undo
265 264
 	 */
266 265
 	private static function _bypass_recaptcha() {
267 266
 		// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY
268
-		$bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() );
267
+		$bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array());
269 268
 		// does $bypass_request_params_array have any values ?
270
-		if ( empty( $bypass_request_params_array )) {
269
+		if (empty($bypass_request_params_array)) {
271 270
 			return FALSE;
272 271
 		}
273 272
 		// initially set bypass to TRUE
274 273
 		$bypass_recaptcha = TRUE;
275
-		foreach ( $bypass_request_params_array as $key => $value ) {
274
+		foreach ($bypass_request_params_array as $key => $value) {
276 275
 			// 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
277
-			$bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE;
276
+			$bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE;
278 277
 		}
279 278
 		return $bypass_recaptcha;
280 279
 	}
@@ -289,7 +288,7 @@  discard block
 block discarded – undo
289 288
 	 * 	@return 	boolean
290 289
 	 */
291 290
 	private static function _get_recaptcha_response() {
292
-		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
291
+		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false);
293 292
 	}
294 293
 
295 294
 
@@ -303,26 +302,26 @@  discard block
 block discarded – undo
303 302
 	 */
304 303
 	private static function _process_recaptcha_response() {
305 304
 		// verify library is loaded
306
-		if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) {
307
-			require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' );
305
+		if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) {
306
+			require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php');
308 307
 		}
309 308
 		// The response from reCAPTCHA
310 309
 		EED_Recaptcha::_get_recaptcha_response();
311 310
 		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
312 311
 		// Was there a reCAPTCHA response?
313
-		if ( $recaptcha_response ) {
312
+		if ($recaptcha_response) {
314 313
 			// if allow_url_fopen is Off, then set a different request method
315
-			$request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null;
314
+			$request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null;
316 315
 			$recaptcha = new \ReCaptcha\ReCaptcha(
317 316
 				EE_Registry::instance()->CFG->registration->recaptcha_privatekey,
318 317
 				$request_method
319 318
 			);
320 319
 			$recaptcha_response = $recaptcha->verify(
321 320
 				EED_Recaptcha::$_recaptcha_response,
322
-				$_SERVER[ 'REMOTE_ADDR' ]
321
+				$_SERVER['REMOTE_ADDR']
323 322
 			);
324 323
 		}
325
-		if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) {
324
+		if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) {
326 325
 			return TRUE;
327 326
 		}
328 327
 		// sorry... it appears you can't don't know what soup or hamburgers are !!!
@@ -366,12 +365,12 @@  discard block
 block discarded – undo
366 365
 				'subsections' 			=> apply_filters(
367 366
 					'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections',
368 367
 					array(
369
-						'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' ))),
368
+						'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'))),
370 369
 						'main_settings' 						=> EED_Recaptcha::_recaptcha_main_settings(),
371
-						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )),
370
+						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))),
372 371
 						'appearance_settings' 			=> EED_Recaptcha::_recaptcha_appearance_settings(),
373 372
 						// 'recaptcha_example' 				=> new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ),
374
-						'required_fields_note' 			=> new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ))
373
+						'required_fields_note' 			=> new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))
375 374
 					)
376 375
 				)
377 376
 			)
@@ -398,28 +397,28 @@  discard block
 block discarded – undo
398 397
 					array(
399 398
 						'use_captcha' 				=> new EE_Yes_No_Input(
400 399
 							array(
401
-								'html_label_text'	 	=> __( 'Use reCAPTCHA', 'event_espresso' ),
400
+								'html_label_text'	 	=> __('Use reCAPTCHA', 'event_espresso'),
402 401
 								'html_help_text' 		=> sprintf(
403
-									__( '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' ),
402
+									__('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'),
404 403
 									'<a href="https://www.google.com/recaptcha/intro/index.html">',
405 404
 									'</a>'
406 405
 								),
407
-								'default' 								=> isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
406
+								'default' 								=> isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
408 407
 								'display_html_label_text' 	=> FALSE
409 408
 							)
410 409
 						),
411 410
 						'recaptcha_publickey' 		=> new EE_Text_Input(
412 411
 							array(
413
-								'html_label_text'	 	=> __( 'Site Key', 'event_espresso' ),
414
-								'html_help_text' 		=> __( 'The site key is used to display the widget on your site.', 'event_espresso' ),
415
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''
412
+								'html_label_text'	 	=> __('Site Key', 'event_espresso'),
413
+								'html_help_text' 		=> __('The site key is used to display the widget on your site.', 'event_espresso'),
414
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''
416 415
 							)
417 416
 						),
418 417
 						'recaptcha_privatekey' 		=> new EE_Text_Input(
419 418
 							array(
420
-								'html_label_text'	 	=> __( 'Secret Key', 'event_espresso' ),
421
-								'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' ),
422
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''
419
+								'html_label_text'	 	=> __('Secret Key', 'event_espresso'),
420
+								'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'),
421
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''
423 422
 							)
424 423
 						)
425 424
 					)
@@ -451,81 +450,81 @@  discard block
 block discarded – undo
451 450
 					array(
452 451
 						'recaptcha_theme' 		=> new EE_Radio_Button_Input(
453 452
 							array(
454
-								'light' => __( 'Light', 'event_espresso' ),
455
-								'dark' => __( 'Dark', 'event_espresso' )
453
+								'light' => __('Light', 'event_espresso'),
454
+								'dark' => __('Dark', 'event_espresso')
456 455
 							),
457 456
 							array(
458
-								'html_label_text'	 	=> __( 'Theme', 'event_espresso' ),
459
-								'html_help_text' 		=> __( 'The color theme of the widget.', 'event_espresso' ),
460
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
457
+								'html_label_text'	 	=> __('Theme', 'event_espresso'),
458
+								'html_help_text' 		=> __('The color theme of the widget.', 'event_espresso'),
459
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
461 460
 								'display_html_label_text' => FALSE
462 461
 							)
463 462
 						),
464 463
 						'recaptcha_type' 		=> new EE_Radio_Button_Input(
465 464
 							array(
466
-								'image' => __( 'Image', 'event_espresso' ),
467
-								'audio' => __( 'Audio', 'event_espresso' )
465
+								'image' => __('Image', 'event_espresso'),
466
+								'audio' => __('Audio', 'event_espresso')
468 467
 							),
469 468
 							array(
470
-								'html_label_text'	 	=> __( 'Type', 'event_espresso' ),
471
-								'html_help_text' 		=> __( 'The type of CAPTCHA to serve.', 'event_espresso' ),
472
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
469
+								'html_label_text'	 	=> __('Type', 'event_espresso'),
470
+								'html_help_text' 		=> __('The type of CAPTCHA to serve.', 'event_espresso'),
471
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
473 472
 								'display_html_label_text' =>FALSE
474 473
 							)
475 474
 						),
476 475
 						'recaptcha_language' 		=> new EE_Select_Input(
477 476
 							array(
478
-								 'ar' 			=> __( 'Arabic', 'event_espresso' ),
479
-								 'bg' 		=> __( 'Bulgarian', 'event_espresso' ),
480
-								 'ca' 			=> __( 'Catalan', 'event_espresso' ),
481
-								 'zh-CN' 	=>  __( 'Chinese (Simplified)', 'event_espresso' ),
482
-								 'zh-TW' 	=>  __( 'Chinese (Traditional)	', 'event_espresso' ),
483
-								 'hr' 			=> __( 'Croatian', 'event_espresso' ),
484
-								 'cs' 			=> __( 'Czech', 'event_espresso' ),
485
-								 'da' 			=> __( 'Danish', 'event_espresso' ),
486
-								 'nl' 			=> __( 'Dutch', 'event_espresso' ),
487
-								 'en-GB' 	=>  __( 'English (UK)', 'event_espresso' ),
488
-								 'en' 			=> __( 'English (US)', 'event_espresso' ),
489
-								 'fil' 			=> __( 'Filipino', 'event_espresso' ),
490
-								 'fi' 			=> __( 'Finnish', 'event_espresso' ),
491
-								 'fr' 			=> __( 'French', 'event_espresso' ),
492
-								 'fr-CA' 	=>  __( 'French (Canadian)', 'event_espresso' ),
493
-								 'de' 			=> __( 'German', 'event_espresso' ),
494
-								 'de-AT' 	=>  __( 'German (Austria)', 'event_espresso' ),
495
-								 'de-CH' 	=>  __( 'German (Switzerland)', 'event_espresso' ),
496
-								 'el' 			=> __( 'Greek', 'event_espresso' ),
497
-								 'iw' 			=> __( 'Hebrew', 'event_espresso' ),
498
-								 'hi' 			=> __( 'Hindi', 'event_espresso' ),
499
-								 'hu' 		=> __( 'Hungarian', 'event_espresso' ),
500
-								 'id' 			=> __( 'Indonesian', 'event_espresso' ),
501
-								 'it' 			=> __( 'Italian', 'event_espresso' ),
502
-								 'ja' 			=> __( 'Japanese', 'event_espresso' ),
503
-								 'ko' 			=> __( 'Korean', 'event_espresso' ),
504
-								 'lv' 			=> __( 'Latvian', 'event_espresso' ),
505
-								 'lt' 			=> __( 'Lithuanian', 'event_espresso' ),
506
-								 'no' 		=> __( 'Norwegian', 'event_espresso' ),
507
-								 'fa' 			=> __( 'Persian', 'event_espresso' ),
508
-								 'pl' 			=> __( 'Polish', 'event_espresso' ),
509
-								 'pt' 			=> __( 'Portuguese', 'event_espresso' ),
510
-								 'pt-BR' 	=>  __( 'Portuguese (Brazil)', 'event_espresso' ),
511
-								 'pt-PT' 	=>  __( 'Portuguese (Portugal)', 'event_espresso' ),
512
-								 'ro' 			=> __( 'Romanian', 'event_espresso' ),
513
-								 'ru' 			=> __( 'Russian', 'event_espresso' ),
514
-								 'sr' 			=> __( 'Serbian', 'event_espresso' ),
515
-								 'sk' 			=> __( 'Slovak', 'event_espresso' ),
516
-								 'sl' 			=> __( 'Slovenian', 'event_espresso' ),
517
-								 'es' 			=> __( 'Spanish', 'event_espresso' ),
518
-								 'es-419' 	=>  __( 'Spanish (Latin America)', 'event_espresso' ),
519
-								 'sv' 			=> __( 'Swedish', 'event_espresso' ),
520
-								 'th' 			=> __( 'Thai', 'event_espresso' ),
521
-								 'tr' 			=> __( 'Turkish', 'event_espresso' ),
522
-								 'uk' 			=> __( 'Ukrainian', 'event_espresso' ),
523
-								 'vi' 			=> __( 'Vietnamese', 'event_espresso')
477
+								 'ar' 			=> __('Arabic', 'event_espresso'),
478
+								 'bg' 		=> __('Bulgarian', 'event_espresso'),
479
+								 'ca' 			=> __('Catalan', 'event_espresso'),
480
+								 'zh-CN' 	=>  __('Chinese (Simplified)', 'event_espresso'),
481
+								 'zh-TW' 	=>  __('Chinese (Traditional)	', 'event_espresso'),
482
+								 'hr' 			=> __('Croatian', 'event_espresso'),
483
+								 'cs' 			=> __('Czech', 'event_espresso'),
484
+								 'da' 			=> __('Danish', 'event_espresso'),
485
+								 'nl' 			=> __('Dutch', 'event_espresso'),
486
+								 'en-GB' 	=>  __('English (UK)', 'event_espresso'),
487
+								 'en' 			=> __('English (US)', 'event_espresso'),
488
+								 'fil' 			=> __('Filipino', 'event_espresso'),
489
+								 'fi' 			=> __('Finnish', 'event_espresso'),
490
+								 'fr' 			=> __('French', 'event_espresso'),
491
+								 'fr-CA' 	=>  __('French (Canadian)', 'event_espresso'),
492
+								 'de' 			=> __('German', 'event_espresso'),
493
+								 'de-AT' 	=>  __('German (Austria)', 'event_espresso'),
494
+								 'de-CH' 	=>  __('German (Switzerland)', 'event_espresso'),
495
+								 'el' 			=> __('Greek', 'event_espresso'),
496
+								 'iw' 			=> __('Hebrew', 'event_espresso'),
497
+								 'hi' 			=> __('Hindi', 'event_espresso'),
498
+								 'hu' 		=> __('Hungarian', 'event_espresso'),
499
+								 'id' 			=> __('Indonesian', 'event_espresso'),
500
+								 'it' 			=> __('Italian', 'event_espresso'),
501
+								 'ja' 			=> __('Japanese', 'event_espresso'),
502
+								 'ko' 			=> __('Korean', 'event_espresso'),
503
+								 'lv' 			=> __('Latvian', 'event_espresso'),
504
+								 'lt' 			=> __('Lithuanian', 'event_espresso'),
505
+								 'no' 		=> __('Norwegian', 'event_espresso'),
506
+								 'fa' 			=> __('Persian', 'event_espresso'),
507
+								 'pl' 			=> __('Polish', 'event_espresso'),
508
+								 'pt' 			=> __('Portuguese', 'event_espresso'),
509
+								 'pt-BR' 	=>  __('Portuguese (Brazil)', 'event_espresso'),
510
+								 'pt-PT' 	=>  __('Portuguese (Portugal)', 'event_espresso'),
511
+								 'ro' 			=> __('Romanian', 'event_espresso'),
512
+								 'ru' 			=> __('Russian', 'event_espresso'),
513
+								 'sr' 			=> __('Serbian', 'event_espresso'),
514
+								 'sk' 			=> __('Slovak', 'event_espresso'),
515
+								 'sl' 			=> __('Slovenian', 'event_espresso'),
516
+								 'es' 			=> __('Spanish', 'event_espresso'),
517
+								 'es-419' 	=>  __('Spanish (Latin America)', 'event_espresso'),
518
+								 'sv' 			=> __('Swedish', 'event_espresso'),
519
+								 'th' 			=> __('Thai', 'event_espresso'),
520
+								 'tr' 			=> __('Turkish', 'event_espresso'),
521
+								 'uk' 			=> __('Ukrainian', 'event_espresso'),
522
+								 'vi' 			=> __('Vietnamese', 'event_espresso')
524 523
 							),
525 524
 							array(
526
-								'html_label_text'	 	=> __( 'Language', 'event_espresso' ),
527
-								'html_help_text' 		=> __( 'Forces the widget to render in a specific language.', 'event_espresso' ),
528
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
525
+								'html_label_text'	 	=> __('Language', 'event_espresso'),
526
+								'html_help_text' 		=> __('Forces the widget to render in a specific language.', 'event_espresso'),
527
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
529 528
 							)
530 529
 						)
531 530
 					)
@@ -573,25 +572,25 @@  discard block
 block discarded – undo
573 572
 	 * @param EE_Registration_Config $EE_Registration_Config
574 573
 	 * @return array
575 574
 	 */
576
-	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
575
+	public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) {
577 576
 		try {
578 577
 			$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form();
579 578
 			// if not displaying a form, then check for form submission
580
-			if ( $recaptcha_settings_form->was_submitted() ) {
579
+			if ($recaptcha_settings_form->was_submitted()) {
581 580
 				// capture form data
582 581
 				$recaptcha_settings_form->receive_form_submission();
583 582
 				// validate form data
584
-				if ( $recaptcha_settings_form->is_valid() ) {
583
+				if ($recaptcha_settings_form->is_valid()) {
585 584
 					// grab validated data from form
586 585
 					$valid_data = $recaptcha_settings_form->valid_data();
587 586
 					// 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.
588 587
 					if (
589
-						apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config )
588
+						apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config)
590 589
 						&& $valid_data['main_settings']['use_captcha']
591
-						&& ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] )))
590
+						&& ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))
592 591
 					) {
593 592
 						$valid_data['main_settings']['use_captcha'] = FALSE;
594
-						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__ );
593
+						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__);
595 594
 					}
596 595
 					$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha'];
597 596
 					$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey'];
@@ -600,12 +599,12 @@  discard block
 block discarded – undo
600 599
 					$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme'];
601 600
 					$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language'];
602 601
 				} else {
603
-					if ( $recaptcha_settings_form->submission_error_message() != '' ) {
604
-						EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
602
+					if ($recaptcha_settings_form->submission_error_message() != '') {
603
+						EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
605 604
 					}
606 605
 				}
607 606
 			}
608
-		} catch( EE_Error $e ) {
607
+		} catch (EE_Error $e) {
609 608
 			$e->get_error();
610 609
 		}
611 610
 
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.