Completed
Branch BUG-9431-email-input (c0d0dc)
by
unknown
344:01 queued 329:14
created
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 
137 137
 	/**
138 138
 	 * 		grab url requests and route them
139
-	*		@access private
140
-	*		@return void
141
-	*/
139
+	 *		@access private
140
+	 *		@return void
141
+	 */
142 142
 	public function _set_page_routes() {
143 143
 
144 144
 		$this->_get_registration_status_array();
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 						'title' => __('Registrations Other', 'event_espresso'),
405 405
 						'filename' => 'registrations_overview_other'
406 406
 					)
407
-                ),
407
+				),
408 408
 				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
409 409
 				'qtips' => array('Registration_List_Table_Tips'),
410 410
 				'list_table' => 'EE_Registrations_List_Table',
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
419 419
 					'persistent' => FALSE
420 420
 					),
421
-                'help_tabs' => array(
421
+				'help_tabs' => array(
422 422
 					'registrations_details_help_tab' => array(
423 423
 						'title' => __('Registration Details', 'event_espresso'),
424 424
 						'filename' => 'registrations_details'
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 					'order' => 20
483 483
 					),
484 484
 				'list_table' => 'EE_Attendee_Contact_List_Table',
485
-                'help_tabs' => array(
485
+				'help_tabs' => array(
486 486
 					'registrations_contact_list_help_tab' => array(
487 487
 						'title' => __('Registrations Contact List', 'event_espresso'),
488 488
 						'filename' => 'registrations_contact_list'
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 						'title' => __('Contact List Other', 'event_espresso'),
500 500
 						'filename' => 'registrations_contact_list_other'
501 501
 					)
502
-                ),
502
+				),
503 503
 				'help_tour' => array( 'Contact_List_Help_Tour' ),
504 504
 				'metaboxes' => array(),
505 505
 				'require_nonce' => FALSE
@@ -533,9 +533,9 @@  discard block
 block discarded – undo
533 533
 
534 534
 	/**
535 535
 	 * 		get list of registration statuses
536
-	*		@access private
537
-	*		@return void
538
-	*/
536
+	 *		@access private
537
+	 *		@return void
538
+	 */
539 539
 	private function _get_registration_status_array() {
540 540
 		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
541 541
 	}
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 			return TRUE;
843 843
 		}
844 844
 
845
-	    $REG = EEM_Registration::instance();
845
+		$REG = EEM_Registration::instance();
846 846
 
847 847
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
848 848
 
@@ -1065,9 +1065,9 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
 	/**
1067 1067
 	 * 		generates HTML for the View Registration Details Admin page
1068
-	*		@access protected
1069
-	*		@return void
1070
-	*/
1068
+	 *		@access protected
1069
+	 *		@return void
1070
+	 */
1071 1071
 	protected function _registration_details() {
1072 1072
 
1073 1073
 		$this->_template_args = array();
@@ -1145,9 +1145,9 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 	/**
1147 1147
 	 * 		_set_approve_or_decline_reg_status_buttons
1148
-	*		@access protected
1149
-	*		@return string
1150
-	*/
1148
+	 *		@access protected
1149
+	 *		@return string
1150
+	 */
1151 1151
 	public function set_reg_status_buttons_metabox() {
1152 1152
 
1153 1153
 		//is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown.
@@ -1337,10 +1337,10 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
 	/**
1339 1339
 	 * 		approve_registration
1340
-	*		@access protected
1341
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1342
-	*		@return void
1343
-	*/
1340
+	 *		@access protected
1341
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1342
+	 *		@return void
1343
+	 */
1344 1344
 	protected function approve_registration( $notify = false ) {
1345 1345
 		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1346 1346
 	}
@@ -1350,10 +1350,10 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
 	/**
1352 1352
 	 * 		decline_registration
1353
-	*		@access protected
1354
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1355
-	*		@return void
1356
-	*/
1353
+	 *		@access protected
1354
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1355
+	 *		@return void
1356
+	 */
1357 1357
 	protected function decline_registration( $notify = false ) {
1358 1358
 		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1359 1359
 	}
@@ -1363,10 +1363,10 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
 	/**
1365 1365
 	 * 		cancel_registration
1366
-	*		@access protected
1367
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1368
-	*		@return void
1369
-	*/
1366
+	 *		@access protected
1367
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1368
+	 *		@return void
1369
+	 */
1370 1370
 	protected function cancel_registration( $notify = false ) {
1371 1371
 		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1372 1372
 	}
@@ -1377,10 +1377,10 @@  discard block
 block discarded – undo
1377 1377
 
1378 1378
 	/**
1379 1379
 	 * 		not_approve_registration
1380
-	*		@access protected
1381
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1382
-	*		@return void
1383
-	*/
1380
+	 *		@access protected
1381
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1382
+	 *		@return void
1383
+	 */
1384 1384
 	protected function not_approve_registration( $notify = false ) {
1385 1385
 		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1386 1386
 	}
@@ -1389,10 +1389,10 @@  discard block
 block discarded – undo
1389 1389
 
1390 1390
 	/**
1391 1391
 	 * 		decline_registration
1392
-	*		@access protected
1393
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1394
-	*		@return void
1395
-	*/
1392
+	 *		@access protected
1393
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1394
+	 *		@return void
1395
+	 */
1396 1396
 	protected function pending_registration( $notify = false ) {
1397 1397
 		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1398 1398
 	}
@@ -1402,9 +1402,9 @@  discard block
 block discarded – undo
1402 1402
 
1403 1403
 	/**
1404 1404
 	 * 		generates HTML for the Registration main meta box
1405
-	*		@access public
1406
-	*		@return void
1407
-	*/
1405
+	 *		@access public
1406
+	 *		@return void
1407
+	 */
1408 1408
 	public function _reg_details_meta_box() {
1409 1409
 		EEH_Autoloader::register_line_item_display_autoloaders();
1410 1410
 		EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 	 *
1488 1488
 	 * @access public
1489 1489
 	 * @return void
1490
-	*/
1490
+	 */
1491 1491
 	public function _reg_questions_meta_box() {
1492 1492
 		//allow someone to override this method entirely
1493 1493
 		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
@@ -1689,12 +1689,12 @@  discard block
 block discarded – undo
1689 1689
 
1690 1690
 	/**
1691 1691
 	 * 		generates HTML for the Registration main meta box
1692
-	*		@access public
1693
-	*		@return void
1694
-	*/
1692
+	 *		@access public
1693
+	 *		@return void
1694
+	 */
1695 1695
 	public function _reg_attendees_meta_box() {
1696 1696
 
1697
-	    $REG = EEM_Registration::instance();
1697
+		$REG = EEM_Registration::instance();
1698 1698
 		//get all other registrations on this transaction, and cache
1699 1699
 		//the attendees for them so we don't have to run another query using force_join
1700 1700
 		$registrations = $REG->get_all(array(
@@ -1747,9 +1747,9 @@  discard block
 block discarded – undo
1747 1747
 
1748 1748
 	/**
1749 1749
 	 * 		generates HTML for the Edit Registration side meta box
1750
-	*		@access public
1751
-	*		@return void
1752
-	*/
1750
+	 *		@access public
1751
+	 *		@return void
1752
+	 */
1753 1753
 	public function _reg_registrant_side_meta_box() {
1754 1754
 
1755 1755
 		/*@var $attendee EE_Attendee */
@@ -2095,9 +2095,9 @@  discard block
 block discarded – undo
2095 2095
 
2096 2096
 	/**
2097 2097
 	 * 		set_reg_event
2098
-	*		@access private
2099
-	*		@return boolean
2100
-	*/
2098
+	 *		@access private
2099
+	 *		@return boolean
2100
+	 */
2101 2101
 	private function _set_reg_event() {
2102 2102
 		if ( is_object( $this->_reg_event )) {
2103 2103
 			return TRUE;
@@ -2204,9 +2204,9 @@  discard block
 block discarded – undo
2204 2204
 
2205 2205
 	/**
2206 2206
 	 * 		generates HTML for the Attendee Contact List
2207
-	*		@access protected
2208
-	*		@return void
2209
-	*/
2207
+	 *		@access protected
2208
+	 *		@return void
2209
+	 */
2210 2210
 	protected function _attendee_contact_list_table() {
2211 2211
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2212 2212
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
@@ -2220,9 +2220,9 @@  discard block
 block discarded – undo
2220 2220
 	/**
2221 2221
 	 * 		get_attendees
2222 2222
 	 * 		@param bool $count whether to return count or data.
2223
-	*		@access public
2224
-	*		@return array
2225
-	*/
2223
+	 *		@access public
2224
+	 *		@return array
2225
+	 */
2226 2226
 	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2227 2227
 
2228 2228
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2558,9 +2558,9 @@  discard block
 block discarded – undo
2558 2558
 
2559 2559
 	/**
2560 2560
 	 * 		_attendee_details
2561
-	*		@access protected
2562
-	*		@return void
2563
-	*/
2561
+	 *		@access protected
2562
+	 *		@return void
2563
+	 */
2564 2564
 	public function attendee_registrations_meta_box( $post ) {
2565 2565
 
2566 2566
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
@@ -2593,10 +2593,10 @@  discard block
 block discarded – undo
2593 2593
 
2594 2594
 	/**
2595 2595
 	 * 		_trash_or_restore_attendee
2596
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2597
-	*		@access protected
2598
-	*		@return void
2599
-	*/
2596
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2597
+	 *		@access protected
2598
+	 *		@return void
2599
+	 */
2600 2600
 	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2601 2601
 
2602 2602
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function instance() {
49 49
 		// check if class object is instantiated
50
-		if (  ! self::$_instance instanceof EE_Admin ) {
50
+		if ( ! self::$_instance instanceof EE_Admin) {
51 51
 			self::$_instance = new self();
52 52
 		}
53 53
 		return self::$_instance;
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
64 64
 		// set autoloaders for our admin page classes based on included path information
65
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
65
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
66 66
 		// admin hooks
67
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
67
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
68 68
 		// load EE_Request_Handler early
69
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
70
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
69
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
70
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin == $main_file ) {
122
+		 if ($plugin == $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -175,36 +175,36 @@  discard block
 block discarded – undo
175 175
 	public function init() {
176 176
 
177 177
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
178
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
178
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
179 179
 			//ok so we want to enable the entire admin
180
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
181
-			add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 );
182
-			add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 );
183
-			add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
184
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
185
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
180
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
181
+			add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2);
182
+			add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3);
183
+			add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
184
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
185
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
186 186
 			//at a glance dashboard widget
187
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 );
187
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
188 188
 			//filter for get_edit_post_link used on comments for custom post types
189
-			add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 );
189
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
190 190
 		}
191 191
 
192 192
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
193
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
193
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
194 194
 			try {
195 195
 				//this loads the controller for the admin pages which will setup routing etc
196
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
197
-			} catch ( EE_Error $e ) {
196
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
197
+			} catch (EE_Error $e) {
198 198
 				$e->get_error();
199 199
 			}
200 200
 		}
201 201
 
202 202
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
203
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
204
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
203
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
204
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
205 205
 
206 206
 		//exclude EE critical pages from all nav menus and wp_list_pages
207
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
207
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
208 208
 	}
209 209
 
210 210
 
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param  object $post_type WP post type object
218 218
 	 * @return object            WP post type object
219 219
 	 */
220
-	public function remove_pages_from_nav_menu( $post_type ) {
220
+	public function remove_pages_from_nav_menu($post_type) {
221 221
 		//if this isn't the "pages" post type let's get out
222
-		if ( $post_type->name !== 'page' )
222
+		if ($post_type->name !== 'page')
223 223
 			return $post_type;
224 224
 
225 225
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -239,28 +239,28 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function enable_hidden_ee_nav_menu_metaboxes() {
241 241
 		global $wp_meta_boxes, $pagenow;
242
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
242
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
243 243
 			return;
244 244
 		}
245 245
 		$user = wp_get_current_user();
246 246
 		//has this been done yet?
247
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
247
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
248 248
 			return;
249 249
 		}
250 250
 
251
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
252
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
251
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
252
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
253 253
 
254
-		if ( is_array( $hidden_meta_boxes ) ) {
255
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
256
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
257
-					unset( $hidden_meta_boxes[ $key ] );
254
+		if (is_array($hidden_meta_boxes)) {
255
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
256
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
257
+					unset($hidden_meta_boxes[$key]);
258 258
 				}
259 259
 			}
260 260
 		}
261 261
 
262
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
263
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
262
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
263
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
264 264
 	}
265 265
 
266 266
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return void
280 280
 	 */
281 281
 	public function register_custom_nav_menu_boxes() {
282
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
282
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
283 283
 	}
284 284
 
285 285
 
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
 	 *
297 297
 	 * @return string  the (maybe) modified link
298 298
 	 */
299
-	public function modify_edit_post_link( $link, $id, $context ) {
300
-		if ( ! $post = get_post( $id ) )
299
+	public function modify_edit_post_link($link, $id, $context) {
300
+		if ( ! $post = get_post($id))
301 301
 			return $link;
302 302
 
303
-		if ( $post->post_type == 'espresso_attendees' ) {
303
+		if ($post->post_type == 'espresso_attendees') {
304 304
 			$query_args = array(
305 305
 				'action' => 'edit_attendee',
306 306
 				'post' => $id
307 307
 				);
308 308
 			EE_Registry::instance()->load_helper('URL');
309
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
309
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
310 310
 		}
311 311
 		return $link;
312 312
 	}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		global $nav_menu_selected_id;
319 319
 
320 320
 		$db_fields = false;
321
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
321
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
322 322
 		$current_tab = 'event-archives';
323 323
 
324 324
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 		?>
338 338
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
339 339
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
340
-				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
341
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
342
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
340
+				<li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>>
341
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
342
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
343 343
 					</a>
344 344
 				</li>
345 345
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
  			<?php */ ?>
358 358
 
359 359
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
360
-			echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
360
+			echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
361 361
 			?>">
362 362
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
363 363
 					<?php
364 364
 					$pages = $this->_get_extra_nav_menu_pages_items();
365 365
 					$args['walker'] = $walker;
366
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
366
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
367 367
 					?>
368 368
 				</ul>
369 369
 			</div><!-- /.tabs-panel -->
@@ -371,18 +371,18 @@  discard block
 block discarded – undo
371 371
 			<p class="button-controls">
372 372
 				<span class="list-controls">
373 373
 					<a href="<?php
374
-						echo esc_url( add_query_arg(
374
+						echo esc_url(add_query_arg(
375 375
 							array(
376 376
 								'extra-nav-menu-pages-tab' => 'event-archives',
377 377
 								'selectall' => 1,
378 378
 							),
379
-							remove_query_arg( $removed_args )
379
+							remove_query_arg($removed_args)
380 380
 						));
381 381
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
382 382
 				</span>
383 383
 
384 384
 				<span class="add-to-menu">
385
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
385
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
386 386
 					<span class="spinner"></span>
387 387
 				</span>
388 388
 			</p>
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
 	private function _get_extra_nav_menu_pages_items() {
404 404
 		$menuitems[] = array(
405 405
 			'title' => __('Event List', 'event_espresso'),
406
-			'url' => get_post_type_archive_link( 'espresso_events' ),
406
+			'url' => get_post_type_archive_link('espresso_events'),
407 407
 			'description' => __('Archive page for all events.', 'event_espresso')
408 408
 		);
409
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
409
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
410 410
 	}
411 411
 
412 412
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * @param $menu_item_values
419 419
 	 * @return stdClass
420 420
 	 */
421
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
421
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
422 422
 		$menu_item = new stdClass();
423 423
 		$keys = array(
424 424
 			'ID' => 0,
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 			'xfn' => ''
439 439
 		);
440 440
 
441
-		foreach ( $keys as $key => $value) {
442
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
441
+		foreach ($keys as $key => $value) {
442
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
443 443
 		}
444 444
 		return $menu_item;
445 445
 	}
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 		 * - check if doing post processing of one of EE CPTs
479 479
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
480 480
 		 */
481
-		if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) {
482
-			if ( isset( $_POST['post_type'] ) ) {
483
-				EE_Registry::instance()->load_core( 'Register_CPTs' );
484
-				EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
481
+		if (isset($_POST['action']) && $_POST['action'] == 'editpost') {
482
+			if (isset($_POST['post_type'])) {
483
+				EE_Registry::instance()->load_core('Register_CPTs');
484
+				EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
485 485
 			}
486 486
 		}
487 487
 
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
492 492
 		 */
493 493
 		global $pagenow;
494
-		if ( $pagenow == 'options-reading.php' ) {
495
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
494
+		if ($pagenow == 'options-reading.php') {
495
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
496 496
 		}
497 497
 
498 498
 	}
@@ -504,25 +504,25 @@  discard block
 block discarded – undo
504 504
 	 * @param string $output  Current output.
505 505
 	 * @return string
506 506
 	 */
507
-	public function modify_dropdown_pages( $output ) {
507
+	public function modify_dropdown_pages($output) {
508 508
 		//get critical pages
509 509
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
510 510
 
511 511
 		//split current output by line break for easier parsing.
512
-		$split_output = explode( "\n", $output );
512
+		$split_output = explode("\n", $output);
513 513
 
514 514
 		//loop through to remove any critical pages from the array.
515
-		foreach ( $critical_pages as $page_id ) {
516
-			$needle = 'value="' . $page_id . '"';
517
-			foreach( $split_output as $key => $haystack ) {
518
-				if( strpos( $haystack, $needle ) !== false ) {
519
-					unset( $split_output[$key] );
515
+		foreach ($critical_pages as $page_id) {
516
+			$needle = 'value="'.$page_id.'"';
517
+			foreach ($split_output as $key => $haystack) {
518
+				if (strpos($haystack, $needle) !== false) {
519
+					unset($split_output[$key]);
520 520
 				}
521 521
 			}
522 522
 		}
523 523
 
524 524
 		//replace output with the new contents
525
-		$output = implode( "\n", $split_output );
525
+		$output = implode("\n", $split_output);
526 526
 
527 527
 		return $output;
528 528
 	}
@@ -538,37 +538,37 @@  discard block
 block discarded – undo
538 538
 	public function enqueue_admin_scripts() {
539 539
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
540 540
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
541
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
541
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
542 542
 		// register cookie script for future dependencies
543
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
543
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
544 544
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
545
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
545
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
546 546
 			// register jQuery Validate
547
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
547
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
548 548
 		}
549 549
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
550
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
550
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
551 551
 			//joyride style
552
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
553
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
554
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
552
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
553
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
554
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
555 555
 			//joyride JS
556
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
556
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
557 557
 			// wanna go for a joyride?
558 558
 			wp_enqueue_style('ee-joyride-css');
559 559
 			wp_enqueue_script('jquery-joyride');
560 560
 		}
561 561
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
562
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
562
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
563 563
 			EE_Registry::instance()->load_helper('Qtip_Loader');
564 564
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
565 565
 		}
566 566
 		//accounting.js library
567 567
 		// @link http://josscrowcroft.github.io/accounting.js/
568
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
569
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
570
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
571
-			wp_enqueue_script( 'ee-accounting' );
568
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
569
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
570
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
571
+			wp_enqueue_script('ee-accounting');
572 572
 			// array of settings to get converted to JSON array via wp_localize_script
573 573
 			$currency_config = array(
574 574
 				'currency' => array(
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 	public function get_persistent_admin_notices() {
616 616
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
617 617
 		$args = array(
618
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
619
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
618
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
619
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
620 620
 		);
621
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
622
-		echo EE_Error::get_persistent_admin_notices( $return_url );
621
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
622
+		echo EE_Error::get_persistent_admin_notices($return_url);
623 623
 	}
624 624
 
625 625
 
@@ -640,26 +640,26 @@  discard block
 block discarded – undo
640 640
 	 * @param $elements
641 641
 	 * @return array
642 642
 	 */
643
-	public function dashboard_glance_items( $elements ) {
643
+	public function dashboard_glance_items($elements) {
644 644
 		$events = EEM_Event::instance()->count();
645
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
646
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
645
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
646
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
647 647
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
648 648
 		$registrations = EEM_Registration::instance()->count(
649 649
 			array(
650 650
 				array(
651
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
651
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
652 652
 				)
653 653
 			)
654 654
 		);
655
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
656
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
655
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
656
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
657 657
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
658 658
 
659
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
659
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
660 660
 
661
-		foreach ( $items as $type => $item_properties ) {
662
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
661
+		foreach ($items as $type => $item_properties) {
662
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
663 663
 		}
664 664
 		return $elements;
665 665
 	}
@@ -678,63 +678,63 @@  discard block
 block discarded – undo
678 678
 	 * @param $post
679 679
 	 * @return    void
680 680
 	 */
681
-	public static function parse_post_content_on_save( $post_ID, $post ) {
681
+	public static function parse_post_content_on_save($post_ID, $post) {
682 682
 		// default post types
683
-		$post_types = array( 'post' => 0, 'page' => 1 );
683
+		$post_types = array('post' => 0, 'page' => 1);
684 684
 		// add CPTs
685 685
 		$CPTs = EE_Register_CPTs::get_CPTs();
686
-		$post_types = array_merge( $post_types, $CPTs );
686
+		$post_types = array_merge($post_types, $CPTs);
687 687
 		// for default or CPT posts...
688
-		if ( isset( $post_types[ $post->post_type ] )) {
688
+		if (isset($post_types[$post->post_type])) {
689 689
 			// post on frontpage ?
690 690
 			$page_for_posts = EE_Config::get_page_for_posts();
691 691
 			$maybe_remove_from_posts = array();
692 692
 			// critical page shortcodes that we do NOT want added to the Posts page (blog)
693 693
 			$critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array();
694 694
 			// array of shortcodes indexed by post name
695
-			EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
695
+			EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
696 696
 			// whether to proceed with update, if an entry already exists for this post, then we want to update
697
-			$update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false;
697
+			$update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false;
698 698
 			// empty both arrays
699
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array();
699
+			EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array();
700 700
 			// check that posts page is already being tracked
701
-			if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) {
701
+			if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
702 702
 				// if not, then ensure that it is properly added
703
-				EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array();
703
+				EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array();
704 704
 			}
705 705
 			// loop thru shortcodes
706
-			foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
706
+			foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
707 707
 				// convert to UPPERCASE to get actual shortcode
708
-				$EES_Shortcode = strtoupper( $EES_Shortcode );
708
+				$EES_Shortcode = strtoupper($EES_Shortcode);
709 709
 				// is the shortcode in the post_content ?
710
-				if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) {
710
+				if (strpos($post->post_content, $EES_Shortcode) !== FALSE) {
711 711
 					// map shortcode to post names and post IDs
712
-					EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
712
+					EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
713 713
 					// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
714
-					if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) {
714
+					if ( ! in_array($EES_Shortcode, $critical_shortcodes)) {
715 715
 						// add shortcode to "Posts page" tracking
716
-						EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID;
716
+						EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID;
717 717
 					}
718 718
 					$update_post_shortcodes = TRUE;
719
-					unset( $maybe_remove_from_posts[ $EES_Shortcode ] );
719
+					unset($maybe_remove_from_posts[$EES_Shortcode]);
720 720
 				} else {
721
-					$maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID;
721
+					$maybe_remove_from_posts[$EES_Shortcode] = $post_ID;
722 722
 				}
723 723
 			}
724
-			if ( $update_post_shortcodes ) {
724
+			if ($update_post_shortcodes) {
725 725
 				// remove shortcodes from $maybe_remove_from_posts that are still being used
726
-				foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) {
727
-					if ( $post_name == $page_for_posts ) {
726
+				foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) {
727
+					if ($post_name == $page_for_posts) {
728 728
 						continue;
729 729
 					}
730 730
 					// compute difference between active post_shortcodes array and $maybe_remove_from_posts array
731
-					$maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes );
731
+					$maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes);
732 732
 				}
733 733
 				// now unset unused shortcodes from the $page_for_posts post_shortcodes
734
-				foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) {
735
-					unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] );
734
+				foreach ($maybe_remove_from_posts as $shortcode => $post_ID) {
735
+					unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]);
736 736
 				}
737
-				EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts );
737
+				EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts);
738 738
 			}
739 739
 		}
740 740
 	}
@@ -752,32 +752,32 @@  discard block
 block discarded – undo
752 752
 	 * @throws EE_Error
753 753
 	 * @return    string
754 754
 	 */
755
-	public function check_for_invalid_datetime_formats( $value, $option ) {
756
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
755
+	public function check_for_invalid_datetime_formats($value, $option) {
756
+		EE_Registry::instance()->load_helper('DTT_Helper');
757 757
 		// check for date_format or time_format
758
-		switch ( $option ) {
758
+		switch ($option) {
759 759
 			case 'date_format' :
760
-				$date_time_format = $value . ' ' . get_option('time_format');
760
+				$date_time_format = $value.' '.get_option('time_format');
761 761
 				break;
762 762
 			case 'time_format' :
763
-				$date_time_format = get_option('date_format') . ' ' . $value;
763
+				$date_time_format = get_option('date_format').' '.$value;
764 764
 				break;
765 765
 			default :
766 766
 				$date_time_format = FALSE;
767 767
 		}
768 768
 		// do we have a date_time format to check ?
769
-		if ( $date_time_format ) {
770
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
769
+		if ($date_time_format) {
770
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
771 771
 
772
-			if ( is_array( $error_msg ) ) {
773
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
772
+			if (is_array($error_msg)) {
773
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
774 774
 
775 775
 
776
-				foreach ( $error_msg as $error ) {
777
-					$msg .= '<li>' . $error . '</li>';
776
+				foreach ($error_msg as $error) {
777
+					$msg .= '<li>'.$error.'</li>';
778 778
 				}
779 779
 
780
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
780
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
781 781
 
782 782
 				// trigger WP settings error
783 783
 				add_settings_error(
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 				);
788 788
 
789 789
 				// set format to something valid
790
-				switch ( $option ) {
790
+				switch ($option) {
791 791
 					case 'date_format' :
792 792
 						$value = 'F j, Y';
793 793
 						break;
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 	 * @param 	$value
814 814
 	 * @return 	void
815 815
 	 */
816
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
817
-		if ( $option == 'page_for_posts' ) {
816
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
817
+		if ($option == 'page_for_posts') {
818 818
 			global $wpdb;
819
-			$SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
820
-			$old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts';
821
-			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts';
822
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ];
823
-			EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts );
819
+			$SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
820
+			$old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts';
821
+			$new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
822
+			EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts];
823
+			EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts);
824 824
 		}
825 825
 	}
826 826
 
@@ -833,8 +833,8 @@  discard block
 block discarded – undo
833 833
 	 * @param $content
834 834
 	 * @return    string
835 835
 	 */
836
-	public function its_eSpresso( $content ) {
837
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
836
+	public function its_eSpresso($content) {
837
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
838 838
 	}
839 839
 
840 840
 
@@ -847,9 +847,9 @@  discard block
 block discarded – undo
847 847
 	 */
848 848
 	public function espresso_admin_footer() {
849 849
 		return sprintf(
850
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
850
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
851 851
 			'<a href="https://eventespresso.com/" title="',
852
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
852
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
853 853
 		);
854 854
 	}
855 855
 
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 	 * @param array $config
870 870
 	 * @return void
871 871
 	 */
872
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
873
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
874
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
872
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
873
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
874
+		if (class_exists('EE_Register_Admin_Page'))
875 875
 			$config['page_path'] = $page_path;
876
-			EE_Register_Admin_Page::register( $page_basename, $config );
876
+			EE_Register_Admin_Page::register($page_basename, $config);
877 877
 	}
878 878
 
879 879
 
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Spacing   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public static function instance() {
104 104
 		// check if class object is instantiated
105
-		if ( ! self::$_instance instanceof EE_System ) {
105
+		if ( ! self::$_instance instanceof EE_System) {
106 106
 			self::$_instance = new self();
107 107
 		}
108 108
 		return self::$_instance;
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	 * resets the instance and returns it
114 114
 	 * @return EE_System
115 115
 	 */
116
-	public static function reset(){
116
+	public static function reset() {
117 117
 		self::$_instance->_req_type = NULL;
118 118
 		//we need to reset the migration manager in order for it to detect DMSs properly
119 119
 		EE_Data_Migration_Manager::reset();
120 120
 		//make sure none of the old hooks are left hanging around
121
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
121
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
122 122
 		self::instance()->detect_activations_or_upgrades();
123 123
 		self::instance()->perform_activations_upgrades_and_migrations();
124 124
 		return self::instance();
@@ -134,26 +134,26 @@  discard block
 block discarded – undo
134 134
 	 * @access    private
135 135
 	 */
136 136
 	private function __construct() {
137
-		do_action( 'AHEE__EE_System__construct__begin', $this );
137
+		do_action('AHEE__EE_System__construct__begin', $this);
138 138
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
139
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
139
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
140 140
 		// when an ee addon is activated, we want to call the core hook(s) again
141 141
 		// because the newly-activated addon didn't get a chance to run at all
142
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
142
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
143 143
 		// detect whether install or upgrade
144
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
144
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
145 145
 		// load EE_Config, EE_Textdomain, etc
146
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
146
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
147 147
 		// load EE_Config, EE_Textdomain, etc
148
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
148
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
149 149
 		// you wanna get going? I wanna get going... let's get going!
150
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
150
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
151 151
 		//other housekeeping
152 152
 		//exclude EE critical pages from wp_list_pages
153
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
153
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
154 154
 		// ALL EE Addons should use the following hook point to attach their initial setup too
155 155
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
156
-		do_action( 'AHEE__EE_System__construct__complete', $this );
156
+		do_action('AHEE__EE_System__construct__complete', $this);
157 157
 	}
158 158
 
159 159
 
@@ -173,30 +173,30 @@  discard block
 block discarded – undo
173 173
 	public function load_espresso_addons() {
174 174
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
175 175
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
176
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
176
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
177 177
 		//load and setup EE_Capabilities
178
-		EE_Registry::instance()->load_core( 'Capabilities' );
178
+		EE_Registry::instance()->load_core('Capabilities');
179 179
 		//caps need to be initialized on every request so that capability maps are set.
180 180
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
181 181
 		EE_Registry::instance()->CAP->init_caps();
182
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
182
+		do_action('AHEE__EE_System__load_espresso_addons');
183 183
 		//if the WP API basic auth plugin isn't already loaded, load it now.
184 184
 		//We want it for mobile apps. Just include the entire plugin
185 185
 		//also, don't load the basic auth when a plugin is getting activated, because
186 186
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
187 187
 		//and causes a fatal error
188
-		if( !function_exists( 'json_basic_auth_handler' )
189
-			&& ! function_exists( 'json_basic_auth_error' )
188
+		if ( ! function_exists('json_basic_auth_handler')
189
+			&& ! function_exists('json_basic_auth_error')
190 190
 			&& ! (
191
-				isset( $_GET[ 'action'] )
192
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
191
+				isset($_GET['action'])
192
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
193 193
 			)
194 194
 			&& ! (
195
-				isset( $_GET['activate' ] )
196
-				&& $_GET['activate' ] === 'true'
195
+				isset($_GET['activate'])
196
+				&& $_GET['activate'] === 'true'
197 197
 			)
198 198
 		) {
199
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
199
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
200 200
 		}
201 201
 	}
202 202
 
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	 * @access public
213 213
 	 * @return void
214 214
 	 */
215
-	public function detect_activations_or_upgrades(){
215
+	public function detect_activations_or_upgrades() {
216 216
 		//first off: let's make sure to handle core
217 217
 		$this->detect_if_activation_or_upgrade();
218
-		foreach(EE_Registry::instance()->addons as $addon){
218
+		foreach (EE_Registry::instance()->addons as $addon) {
219 219
 			//detect teh request type for that addon
220 220
 			$addon->detect_activation_or_upgrade();
221 221
 		}
@@ -236,44 +236,44 @@  discard block
 block discarded – undo
236 236
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
237 237
 
238 238
 		// load M-Mode class
239
-		EE_Registry::instance()->load_core( 'Maintenance_Mode' );
239
+		EE_Registry::instance()->load_core('Maintenance_Mode');
240 240
 		// check if db has been updated, or if its a brand-new installation
241 241
 
242 242
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
243
-		$request_type =  $this->detect_req_type($espresso_db_update);
243
+		$request_type = $this->detect_req_type($espresso_db_update);
244 244
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
245
-		if( $request_type != EE_System::req_type_normal){
245
+		if ($request_type != EE_System::req_type_normal) {
246 246
 			EE_Registry::instance()->load_helper('Activation');
247 247
 		}
248 248
 
249
-		switch($request_type){
249
+		switch ($request_type) {
250 250
 			case EE_System::req_type_new_activation:
251
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
252
-				$this->_handle_core_version_change( $espresso_db_update );
251
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
252
+				$this->_handle_core_version_change($espresso_db_update);
253 253
 				break;
254 254
 			case EE_System::req_type_reactivation:
255
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
256
-				$this->_handle_core_version_change( $espresso_db_update );
255
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
256
+				$this->_handle_core_version_change($espresso_db_update);
257 257
 				break;
258 258
 			case EE_System::req_type_upgrade:
259
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
259
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
260 260
 				//migrations may be required now that we've upgraded
261 261
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
262
-				$this->_handle_core_version_change( $espresso_db_update );
262
+				$this->_handle_core_version_change($espresso_db_update);
263 263
 //				echo "done upgrade";die;
264 264
 				break;
265 265
 			case EE_System::req_type_downgrade:
266
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
266
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
267 267
 				//its possible migrations are no longer required
268 268
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
269
-				$this->_handle_core_version_change( $espresso_db_update );
269
+				$this->_handle_core_version_change($espresso_db_update);
270 270
 				break;
271 271
 			case EE_System::req_type_normal:
272 272
 			default:
273 273
 //				$this->_maybe_redirect_to_ee_about();
274 274
 				break;
275 275
 		}
276
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
276
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
277 277
 	}
278 278
 
279 279
 	/**
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 	 * initializing the database later during the request
282 282
 	 * @param array $espresso_db_update
283 283
 	 */
284
-	protected function _handle_core_version_change( $espresso_db_update ){
285
-		$this->update_list_of_installed_versions( $espresso_db_update );
284
+	protected function _handle_core_version_change($espresso_db_update) {
285
+		$this->update_list_of_installed_versions($espresso_db_update);
286 286
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
287
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
287
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
288 288
 	}
289 289
 
290 290
 
@@ -299,44 +299,44 @@  discard block
 block discarded – undo
299 299
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
300 300
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
301 301
 	 */
302
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
303
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
304
-		if( ! $espresso_db_update){
305
-			$espresso_db_update = get_option( 'espresso_db_update' );
302
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
303
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
304
+		if ( ! $espresso_db_update) {
305
+			$espresso_db_update = get_option('espresso_db_update');
306 306
 		}
307 307
 		// check that option is an array
308
-		if( ! is_array( $espresso_db_update )) {
308
+		if ( ! is_array($espresso_db_update)) {
309 309
 			// if option is FALSE, then it never existed
310
-			if ( $espresso_db_update === FALSE ) {
310
+			if ($espresso_db_update === FALSE) {
311 311
 				// make $espresso_db_update an array and save option with autoload OFF
312
-				$espresso_db_update =  array();
313
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
312
+				$espresso_db_update = array();
313
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
314 314
 			} else {
315 315
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
316
-				$espresso_db_update =  array( $espresso_db_update=>array() );
317
-				update_option( 'espresso_db_update', $espresso_db_update );
316
+				$espresso_db_update = array($espresso_db_update=>array());
317
+				update_option('espresso_db_update', $espresso_db_update);
318 318
 			}
319
-		}else{
319
+		} else {
320 320
 			$corrected_db_update = array();
321 321
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
322
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
323
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
322
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
323
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
324 324
 					//the key is an int, and the value IS NOT an array
325 325
 					//so it must be numerically-indexed, where values are versions installed...
326 326
 					//fix it!
327 327
 					$version_string = $should_be_array;
328 328
 					$corrected_db_update[$version_string] = array('unknown-date');
329
-				}else{
329
+				} else {
330 330
 					//ok it checks out
331 331
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
332 332
 				}
333 333
 			}
334 334
 			$espresso_db_update = $corrected_db_update;
335
-			update_option( 'espresso_db_update', $espresso_db_update );
335
+			update_option('espresso_db_update', $espresso_db_update);
336 336
 
337 337
 		}
338 338
 
339
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
339
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
340 340
 		return $espresso_db_update;
341 341
 	}
342 342
 
@@ -355,34 +355,34 @@  discard block
 block discarded – undo
355 355
 	 * so we prefer to only do it when necessary
356 356
 	 * @return void
357 357
 	 */
358
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
358
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
359 359
 		$request_type = $this->detect_req_type();
360 360
 		//only initialize system if we're not in maintenance mode.
361
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
362
-			update_option( 'ee_flush_rewrite_rules', TRUE );
361
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
362
+			update_option('ee_flush_rewrite_rules', TRUE);
363 363
 
364
-			if( $verify_schema ) {
364
+			if ($verify_schema) {
365 365
 				EEH_Activation::initialize_db_and_folders();
366 366
 			}
367 367
 			EEH_Activation::initialize_db_content();
368 368
 			EEH_Activation::system_initialization();
369
-			if( $initialize_addons_too ) {
369
+			if ($initialize_addons_too) {
370 370
 				$this->initialize_addons();
371 371
 			}
372
-		}else{
373
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
372
+		} else {
373
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
374 374
 		}
375
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
376
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
375
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
376
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
377 377
 		}
378 378
 	}
379 379
 
380 380
 	/**
381 381
 	 * Initializes the db for all registered addons
382 382
 	 */
383
-	public function initialize_addons(){
383
+	public function initialize_addons() {
384 384
 		//foreach registered addon, make sure its db is up-to-date too
385
-		foreach(EE_Registry::instance()->addons as $addon){
385
+		foreach (EE_Registry::instance()->addons as $addon) {
386 386
 			$addon->initialize_db_if_no_migrations_required();
387 387
 		}
388 388
 	}
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
395 395
 	 * @return 	boolean success as to whether or not this option was changed
396 396
 	 */
397
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
398
-		if( ! $version_history ) {
397
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
398
+		if ( ! $version_history) {
399 399
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
400 400
 		}
401
-		if( $current_version_to_add == NULL){
401
+		if ($current_version_to_add == NULL) {
402 402
 			$current_version_to_add = espresso_version();
403 403
 		}
404
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
404
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
405 405
 		// re-save
406
-		return update_option( 'espresso_db_update', $version_history );
406
+		return update_option('espresso_db_update', $version_history);
407 407
 	}
408 408
 
409 409
 
@@ -420,10 +420,10 @@  discard block
 block discarded – undo
420 420
 	 *                            but still know if this is a new install or not
421 421
 	 * @return int one of the constants on EE_System::req_type_
422 422
 	 */
423
-	public function detect_req_type( $espresso_db_update = NULL ){
424
-		if ( $this->_req_type === NULL ){
425
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
426
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
423
+	public function detect_req_type($espresso_db_update = NULL) {
424
+		if ($this->_req_type === NULL) {
425
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
426
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
427 427
 		}
428 428
 		return $this->_req_type;
429 429
 	}
@@ -439,39 +439,39 @@  discard block
 block discarded – undo
439 439
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
440 440
 	 * @return int one of the constants on EE_System::req_type_*
441 441
 	 */
442
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
443
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
444
-		if( $activation_history_for_addon ){
442
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
443
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
444
+		if ($activation_history_for_addon) {
445 445
 			//it exists, so this isn't a completely new install
446 446
 			//check if this version already in that list of previously installed versions
447
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
447
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
448 448
 				//it a version we haven't seen before
449
-				if( $version_is_higher === 1 ){
449
+				if ($version_is_higher === 1) {
450 450
 					$req_type = EE_System::req_type_upgrade;
451
-				}else{
451
+				} else {
452 452
 					$req_type = EE_System::req_type_downgrade;
453 453
 				}
454
-				delete_option( $activation_indicator_option_name );
454
+				delete_option($activation_indicator_option_name);
455 455
 			} else {
456 456
 				// its not an update. maybe a reactivation?
457
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
458
-					if ( $version_is_higher === -1 ){
457
+				if (get_option($activation_indicator_option_name, FALSE)) {
458
+					if ($version_is_higher === -1) {
459 459
 						$req_type = EE_System::req_type_downgrade;
460
-					}elseif( $version_is_higher === 0 ){
460
+					}elseif ($version_is_higher === 0) {
461 461
 						//we've seen this version before, but it's an activation. must be a reactivation
462 462
 						$req_type = EE_System::req_type_reactivation;
463
-					}else{//$version_is_higher === 1
463
+					} else {//$version_is_higher === 1
464 464
 						$req_type = EE_System::req_type_upgrade;
465 465
 					}
466
-					delete_option( $activation_indicator_option_name );
466
+					delete_option($activation_indicator_option_name);
467 467
 				} else {
468 468
 					//we've seen this version before and the activation indicate doesn't show it was just activated
469
-					if ( $version_is_higher === -1 ){
469
+					if ($version_is_higher === -1) {
470 470
 						$req_type = EE_System::req_type_downgrade;
471
-					}elseif( $version_is_higher === 0 ){
471
+					}elseif ($version_is_higher === 0) {
472 472
 						//we've seen this version before and it's not an activation. its normal request
473 473
 						$req_type = EE_System::req_type_normal;
474
-					}else{//$version_is_higher === 1
474
+					} else {//$version_is_higher === 1
475 475
 						$req_type = EE_System::req_type_upgrade;
476 476
 					}
477 477
 				}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		} else {
480 480
 			//brand new install
481 481
 			$req_type = EE_System::req_type_new_activation;
482
-			delete_option( $activation_indicator_option_name );
482
+			delete_option($activation_indicator_option_name);
483 483
 		}
484 484
 		return $req_type;
485 485
 	}
@@ -497,30 +497,30 @@  discard block
 block discarded – undo
497 497
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
498 498
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
499 499
 	 */
500
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
500
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
501 501
 		//find the most recently-activated version
502 502
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
503 503
 		$most_recently_active_version = '0.0.0.dev.000';
504
-		if( is_array( $activation_history_for_addon ) ){
505
-			foreach( $activation_history_for_addon as $version => $times_activated ){
504
+		if (is_array($activation_history_for_addon)) {
505
+			foreach ($activation_history_for_addon as $version => $times_activated) {
506 506
 				//check there is a record of when this version was activated. Otherwise,
507 507
 				//mark it as unknown
508
-				if( ! $times_activated ){
509
-					$times_activated = array( 'unknown-date');
508
+				if ( ! $times_activated) {
509
+					$times_activated = array('unknown-date');
510 510
 				}
511
-				if( is_string( $times_activated ) ){
512
-					$times_activated = array( $times_activated );
511
+				if (is_string($times_activated)) {
512
+					$times_activated = array($times_activated);
513 513
 				}
514
-				foreach( $times_activated as $an_activation ){
515
-					if( $an_activation != 'unknown-date' &&
516
-							$an_activation > $most_recently_active_version_activation  ){
514
+				foreach ($times_activated as $an_activation) {
515
+					if ($an_activation != 'unknown-date' &&
516
+							$an_activation > $most_recently_active_version_activation) {
517 517
 						$most_recently_active_version = $version;
518 518
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
519 519
 					}
520 520
 				}
521 521
 			}
522 522
 		}
523
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
523
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
524 524
 	}
525 525
 
526 526
 
@@ -530,20 +530,20 @@  discard block
 block discarded – undo
530 530
 	 * @return void
531 531
 	 */
532 532
 	public function redirect_to_about_ee() {
533
-		$notices = EE_Error::get_notices( FALSE );
533
+		$notices = EE_Error::get_notices(FALSE);
534 534
 		//if current user is an admin and it's not an ajax request
535
-		if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX  ) && ! isset( $notices[ 'errors' ] ) ){
536
-			$query_params =  array( 'page' => 'espresso_about' );
535
+		if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) {
536
+			$query_params = array('page' => 'espresso_about');
537 537
 
538
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
538
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
539 539
 			    $query_params['new_activation'] = TRUE;
540 540
 			}
541 541
 
542
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
542
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
543 543
 			    $query_params['reactivation'] = TRUE;
544 544
 			}
545
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
546
-			wp_safe_redirect( $url );
545
+			$url = add_query_arg($query_params, admin_url('admin.php'));
546
+			wp_safe_redirect($url);
547 547
 			exit();
548 548
 		}
549 549
 	}
@@ -557,31 +557,31 @@  discard block
 block discarded – undo
557 557
 	 *
558 558
 	 * @return void
559 559
 	 */
560
-	public function load_core_configuration(){
561
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
562
-		EE_Registry::instance()->load_core( 'EE_Load_Textdomain' );
560
+	public function load_core_configuration() {
561
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
562
+		EE_Registry::instance()->load_core('EE_Load_Textdomain');
563 563
 		//load textdomain
564 564
 		EE_Load_Textdomain::load_textdomain();
565 565
 		// load and setup EE_Config and EE_Network_Config
566
-		EE_Registry::instance()->load_core( 'Config' );
567
-		EE_Registry::instance()->load_core( 'Network_Config' );
566
+		EE_Registry::instance()->load_core('Config');
567
+		EE_Registry::instance()->load_core('Network_Config');
568 568
 		// setup autoloaders
569 569
 		// enable logging?
570
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
571
-			EE_Registry::instance()->load_core( 'Log' );
570
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
571
+			EE_Registry::instance()->load_core('Log');
572 572
 		}
573 573
 		// check for activation errors
574
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
575
-		if ( $activation_errors ) {
576
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
577
-			update_option( 'ee_plugin_activation_errors', FALSE );
574
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
575
+		if ($activation_errors) {
576
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
577
+			update_option('ee_plugin_activation_errors', FALSE);
578 578
 		}
579 579
 		// get model names
580 580
 		$this->_parse_model_names();
581 581
 
582 582
 		//load caf stuff a chance to play during the activation process too.
583 583
 		$this->_maybe_brew_regular();
584
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
584
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
585 585
 	}
586 586
 
587 587
 
@@ -590,23 +590,23 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @return void
592 592
 	 */
593
-	private function _parse_model_names(){
593
+	private function _parse_model_names() {
594 594
 		//get all the files in the EE_MODELS folder that end in .model.php
595
-		$models = glob( EE_MODELS.'*.model.php');
595
+		$models = glob(EE_MODELS.'*.model.php');
596 596
 		$model_names = array();
597 597
 		$non_abstract_db_models = array();
598
-		foreach( $models as $model ){
598
+		foreach ($models as $model) {
599 599
 			// get model classname
600
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
601
-			$shortname = str_replace( 'EEM_', '', $classname );
600
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
601
+			$shortname = str_replace('EEM_', '', $classname);
602 602
 			$reflectionClass = new ReflectionClass($classname);
603
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
603
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
604 604
 				$non_abstract_db_models[$shortname] = $classname;
605 605
 			}
606
-			$model_names[ $shortname ] = $classname;
606
+			$model_names[$shortname] = $classname;
607 607
 		}
608
-		EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
609
-		EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
608
+		EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
609
+		EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
610 610
 	}
611 611
 
612 612
 
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 	 * @return void
617 617
 	 */
618 618
 	private function _maybe_brew_regular() {
619
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
620
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
619
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
620
+			require_once EE_CAFF_PATH.'brewing_regular.php';
621 621
 		}
622 622
 	}
623 623
 
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	 * @return void
635 635
 	 */
636 636
 	public function register_shortcodes_modules_and_widgets() {
637
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
637
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
638 638
 		// check for addons using old hookpoint
639
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
639
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
640 640
 			$this->_incompatible_addon_error();
641 641
 		}
642 642
 	}
@@ -650,19 +650,19 @@  discard block
 block discarded – undo
650 650
 	*/
651 651
 	private function _incompatible_addon_error() {
652 652
 		// get array of classes hooking into here
653
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
654
-		if ( ! empty( $class_names )) {
655
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
653
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
654
+		if ( ! empty($class_names)) {
655
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
656 656
 			$msg .= '<ul>';
657
-			foreach ( $class_names as $class_name ) {
658
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
657
+			foreach ($class_names as $class_name) {
658
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
659 659
 			}
660 660
 			$msg .= '</ul>';
661
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
661
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
662 662
 			// save list of incompatible addons to wp-options for later use
663
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
664
-			if ( is_admin() ) {
665
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
663
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
664
+			if (is_admin()) {
665
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
666 666
 			}
667 667
 		}
668 668
 	}
@@ -679,25 +679,25 @@  discard block
 block discarded – undo
679 679
 	 *
680 680
 	 * @return void
681 681
 	 */
682
-	public function brew_espresso(){
683
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
682
+	public function brew_espresso() {
683
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
684 684
 		// load some final core systems
685
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
686
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
687
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
688
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
689
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
690
-		add_action( 'init', array( $this, 'initialize' ), 10 );
691
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
692
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
693
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
694
-
695
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
685
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
686
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
687
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
688
+		add_action('init', array($this, 'load_controllers'), 7);
689
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
690
+		add_action('init', array($this, 'initialize'), 10);
691
+		add_action('init', array($this, 'initialize_last'), 100);
692
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
693
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
694
+
695
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
696 696
 			// pew pew pew
697
-			EE_Registry::instance()->load_core( 'PUE' );
698
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
697
+			EE_Registry::instance()->load_core('PUE');
698
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
699 699
 		}
700
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
700
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
701 701
 	}
702 702
 
703 703
 
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function set_hooks_for_core() {
713 713
 		$this->_deactivate_incompatible_addons();
714
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
714
+		do_action('AHEE__EE_System__set_hooks_for_core');
715 715
 	}
716 716
 
717 717
 
@@ -720,15 +720,15 @@  discard block
 block discarded – undo
720 720
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
721 721
 	 * deactivates any addons considered incompatible with the current version of EE
722 722
 	 */
723
-	private function _deactivate_incompatible_addons(){
724
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
725
-		if ( ! empty( $incompatible_addons )) {
726
-			$active_plugins = get_option( 'active_plugins', array() );
727
-			foreach ( $active_plugins as $active_plugin ) {
728
-				foreach ( $incompatible_addons as $incompatible_addon ) {
729
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
730
-						unset( $_GET['activate'] );
731
-						espresso_deactivate_plugin( $active_plugin );
723
+	private function _deactivate_incompatible_addons() {
724
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
725
+		if ( ! empty($incompatible_addons)) {
726
+			$active_plugins = get_option('active_plugins', array());
727
+			foreach ($active_plugins as $active_plugin) {
728
+				foreach ($incompatible_addons as $incompatible_addon) {
729
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
730
+						unset($_GET['activate']);
731
+						espresso_deactivate_plugin($active_plugin);
732 732
 					}
733 733
 				}
734 734
 			}
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	public function perform_activations_upgrades_and_migrations() {
747 747
 		//first check if we had previously attempted to setup EE's directories but failed
748
-		if( EEH_Activation::upload_directories_incomplete() ) {
748
+		if (EEH_Activation::upload_directories_incomplete()) {
749 749
 			EEH_Activation::create_upload_directories();
750 750
 		}
751
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
751
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
752 752
 	}
753 753
 
754 754
 
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
 	 *  	@return 	void
761 761
 	 */
762 762
 	public function load_CPTs_and_session() {
763
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
763
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
764 764
 		// register Custom Post Types
765
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
766
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
765
+		EE_Registry::instance()->load_core('Register_CPTs');
766
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
767 767
 	}
768 768
 
769 769
 
@@ -778,16 +778,16 @@  discard block
 block discarded – undo
778 778
 	* @return void
779 779
 	*/
780 780
 	public function load_controllers() {
781
-		do_action( 'AHEE__EE_System__load_controllers__start' );
781
+		do_action('AHEE__EE_System__load_controllers__start');
782 782
 		// let's get it started
783
-		if ( ! is_admin() && !  EE_Maintenance_Mode::instance()->level() ) {
784
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
785
-			EE_Registry::instance()->load_core( 'Front_Controller' );
786
-		} else if ( ! EE_FRONT_AJAX ) {
787
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
788
-			EE_Registry::instance()->load_core( 'Admin' );
783
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
784
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
785
+			EE_Registry::instance()->load_core('Front_Controller');
786
+		} else if ( ! EE_FRONT_AJAX) {
787
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
788
+			EE_Registry::instance()->load_core('Admin');
789 789
 		}
790
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
790
+		do_action('AHEE__EE_System__load_controllers__complete');
791 791
 	}
792 792
 
793 793
 
@@ -801,10 +801,10 @@  discard block
 block discarded – undo
801 801
 	* @return void
802 802
 	*/
803 803
 	public function core_loaded_and_ready() {
804
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
805
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
804
+		do_action('AHEE__EE_System__core_loaded_and_ready');
805
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
806 806
 //		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
807
-		EE_Registry::instance()->load_core( 'Session' );
807
+		EE_Registry::instance()->load_core('Session');
808 808
 	}
809 809
 
810 810
 
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 	* @return void
819 819
 	*/
820 820
 	public function initialize() {
821
-		do_action( 'AHEE__EE_System__initialize' );
821
+		do_action('AHEE__EE_System__initialize');
822 822
 	}
823 823
 
824 824
 
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	* @return void
833 833
 	*/
834 834
 	public function initialize_last() {
835
-		do_action( 'AHEE__EE_System__initialize_last' );
835
+		do_action('AHEE__EE_System__initialize_last');
836 836
 	}
837 837
 
838 838
 
@@ -864,21 +864,21 @@  discard block
 block discarded – undo
864 864
 	*/
865 865
 	public static function do_not_cache() {
866 866
 		// set no cache constants
867
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
868
-			define( 'DONOTCACHEPAGE', true );
867
+		if ( ! defined('DONOTCACHEPAGE')) {
868
+			define('DONOTCACHEPAGE', true);
869 869
 		}
870
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
871
-			define( 'DONOTCACHCEOBJECT', true );
870
+		if ( ! defined('DONOTCACHCEOBJECT')) {
871
+			define('DONOTCACHCEOBJECT', true);
872 872
 		}
873
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
874
-			define( 'DONOTCACHEDB', true );
873
+		if ( ! defined('DONOTCACHEDB')) {
874
+			define('DONOTCACHEDB', true);
875 875
 		}
876 876
 		// add no cache headers
877
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
877
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
878 878
 		// plus a little extra for nginx and Google Chrome
879
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
879
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
880 880
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
881
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
881
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
882 882
 	}
883 883
 
884 884
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	 * @param $headers
891 891
 	 * @return    array
892 892
 	 */
893
-	public static function extra_nocache_headers ( $headers ) {
893
+	public static function extra_nocache_headers($headers) {
894 894
 		// for NGINX
895 895
 		$headers['X-Accel-Expires'] = 0;
896 896
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -919,15 +919,15 @@  discard block
 block discarded – undo
919 919
 	 * @param $admin_bar
920 920
 	 * @return    void
921 921
 	 */
922
-	public function espresso_toolbar_items( $admin_bar ) {
922
+	public function espresso_toolbar_items($admin_bar) {
923 923
 
924 924
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
925
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
925
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
926 926
 			return;
927 927
 		}
928 928
 
929
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
930
-		EE_Registry::instance()->load_helper( 'URL' );
929
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
930
+		EE_Registry::instance()->load_helper('URL');
931 931
 		$menu_class = 'espresso_menu_item_class';
932 932
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
933 933
 		//because they're only defined in each of their respective constructors
@@ -939,20 +939,20 @@  discard block
 block discarded – undo
939 939
 		//Top Level
940 940
 		$admin_bar->add_menu(array(
941 941
 				'id' => 'espresso-toolbar',
942
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
942
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
943 943
 				'href' => $events_admin_url,
944 944
 				'meta' => array(
945 945
 						'title' => __('Event Espresso', 'event_espresso'),
946
-						'class' => $menu_class . 'first'
946
+						'class' => $menu_class.'first'
947 947
 				),
948 948
 		));
949 949
 
950 950
 		//Events
951
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
951
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
952 952
 			$admin_bar->add_menu(array(
953 953
 					'id' => 'espresso-toolbar-events',
954 954
 					'parent' => 'espresso-toolbar',
955
-					'title' => __( 'Events', 'event_espresso' ),
955
+					'title' => __('Events', 'event_espresso'),
956 956
 					'href' => $events_admin_url,
957 957
 					'meta' => array(
958 958
 							'title' => __('Events', 'event_espresso'),
@@ -963,13 +963,13 @@  discard block
 block discarded – undo
963 963
 		}
964 964
 
965 965
 
966
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
966
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
967 967
 			//Events Add New
968 968
 			$admin_bar->add_menu(array(
969 969
 					'id' => 'espresso-toolbar-events-new',
970 970
 					'parent' => 'espresso-toolbar-events',
971 971
 					'title' => __('Add New', 'event_espresso'),
972
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
972
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
973 973
 					'meta' => array(
974 974
 							'title' => __('Add New', 'event_espresso'),
975 975
 							'target' => '',
@@ -978,18 +978,18 @@  discard block
 block discarded – undo
978 978
 			));
979 979
 		}
980 980
 
981
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
981
+		if (is_single() && (get_post_type() == 'espresso_events')) {
982 982
 
983 983
 			//Current post
984 984
 			global $post;
985 985
 
986
-	    	if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
986
+	    	if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
987 987
 				//Events Edit Current Event
988 988
 				$admin_bar->add_menu(array(
989 989
 						'id' => 'espresso-toolbar-events-edit',
990 990
 						'parent' => 'espresso-toolbar-events',
991 991
 						'title' => __('Edit Event', 'event_espresso'),
992
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
992
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
993 993
 						'meta' => array(
994 994
 								'title' => __('Edit Event', 'event_espresso'),
995 995
 								'target' => '',
@@ -1001,11 +1001,11 @@  discard block
 block discarded – undo
1001 1001
 		}
1002 1002
 
1003 1003
 		//Events View
1004
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
1004
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1005 1005
 			$admin_bar->add_menu(array(
1006 1006
 					'id' => 'espresso-toolbar-events-view',
1007 1007
 					'parent' => 'espresso-toolbar-events',
1008
-					'title' => __( 'View', 'event_espresso' ),
1008
+					'title' => __('View', 'event_espresso'),
1009 1009
 					'href' => $events_admin_url,
1010 1010
 					'meta' => array(
1011 1011
 							'title' => __('View', 'event_espresso'),
@@ -1015,12 +1015,12 @@  discard block
 block discarded – undo
1015 1015
 			));
1016 1016
 		}
1017 1017
 
1018
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1018
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1019 1019
 			//Events View All
1020 1020
 			$admin_bar->add_menu(array(
1021 1021
 					'id' => 'espresso-toolbar-events-all',
1022 1022
 					'parent' => 'espresso-toolbar-events-view',
1023
-					'title' => __( 'All', 'event_espresso' ),
1023
+					'title' => __('All', 'event_espresso'),
1024 1024
 					'href' => $events_admin_url,
1025 1025
 					'meta' => array(
1026 1026
 							'title' => __('All', 'event_espresso'),
@@ -1031,13 +1031,13 @@  discard block
 block discarded – undo
1031 1031
 		}
1032 1032
 
1033 1033
 
1034
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1034
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1035 1035
 			//Events View Today
1036 1036
 			$admin_bar->add_menu(array(
1037 1037
 					'id' => 'espresso-toolbar-events-today',
1038 1038
 					'parent' => 'espresso-toolbar-events-view',
1039 1039
 					'title' => __('Today', 'event_espresso'),
1040
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1040
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1041 1041
 					'meta' => array(
1042 1042
 							'title' => __('Today', 'event_espresso'),
1043 1043
 							'target' => '',
@@ -1047,13 +1047,13 @@  discard block
 block discarded – undo
1047 1047
 		}
1048 1048
 
1049 1049
 
1050
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1050
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1051 1051
 			//Events View This Month
1052 1052
 			$admin_bar->add_menu(array(
1053 1053
 					'id' => 'espresso-toolbar-events-month',
1054 1054
 					'parent' => 'espresso-toolbar-events-view',
1055
-					'title' => __( 'This Month', 'event_espresso'),
1056
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1055
+					'title' => __('This Month', 'event_espresso'),
1056
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1057 1057
 					'meta' => array(
1058 1058
 							'title' => __('This Month', 'event_espresso'),
1059 1059
 							'target' => '',
@@ -1063,11 +1063,11 @@  discard block
 block discarded – undo
1063 1063
 		}
1064 1064
 
1065 1065
 		//Registration Overview
1066
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1066
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1067 1067
 			$admin_bar->add_menu(array(
1068 1068
 					'id' => 'espresso-toolbar-registrations',
1069 1069
 					'parent' => 'espresso-toolbar',
1070
-					'title' => __( 'Registrations', 'event_espresso' ),
1070
+					'title' => __('Registrations', 'event_espresso'),
1071 1071
 					'href' => $reg_admin_url,
1072 1072
 					'meta' => array(
1073 1073
 							'title' => __('Registrations', 'event_espresso'),
@@ -1078,12 +1078,12 @@  discard block
 block discarded – undo
1078 1078
 		}
1079 1079
 
1080 1080
 		//Registration Overview Today
1081
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1081
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1082 1082
 			$admin_bar->add_menu(array(
1083 1083
 					'id' => 'espresso-toolbar-registrations-today',
1084 1084
 					'parent' => 'espresso-toolbar-registrations',
1085
-					'title' => __( 'Today', 'event_espresso'),
1086
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1085
+					'title' => __('Today', 'event_espresso'),
1086
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1087 1087
 					'meta' => array(
1088 1088
 							'title' => __('Today', 'event_espresso'),
1089 1089
 							'target' => '',
@@ -1093,14 +1093,14 @@  discard block
 block discarded – undo
1093 1093
 		}
1094 1094
 
1095 1095
 		//Registration Overview Today Completed
1096
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1096
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1097 1097
 			$admin_bar->add_menu(array(
1098 1098
 					'id' => 'espresso-toolbar-registrations-today-approved',
1099 1099
 					'parent' => 'espresso-toolbar-registrations-today',
1100
-					'title' => __( 'Approved', 'event_espresso' ),
1101
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1100
+					'title' => __('Approved', 'event_espresso'),
1101
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1102 1102
 					'meta' => array(
1103
-							'title' => __('Approved', 'event_espresso' ),
1103
+							'title' => __('Approved', 'event_espresso'),
1104 1104
 							'target' => '',
1105 1105
 							'class' => $menu_class
1106 1106
 					),
@@ -1108,14 +1108,14 @@  discard block
 block discarded – undo
1108 1108
 		}
1109 1109
 
1110 1110
 		//Registration Overview Today Pending\
1111
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1111
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1112 1112
 			$admin_bar->add_menu(array(
1113 1113
 					'id' => 'espresso-toolbar-registrations-today-pending',
1114 1114
 					'parent' => 'espresso-toolbar-registrations-today',
1115
-					'title' => __( 'Pending', 'event_espresso' ),
1116
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1115
+					'title' => __('Pending', 'event_espresso'),
1116
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1117 1117
 					'meta' => array(
1118
-							'title' => __('Pending Payment', 'event_espresso' ),
1118
+							'title' => __('Pending Payment', 'event_espresso'),
1119 1119
 							'target' => '',
1120 1120
 							'class' => $menu_class
1121 1121
 					),
@@ -1123,14 +1123,14 @@  discard block
 block discarded – undo
1123 1123
 		}
1124 1124
 
1125 1125
 		//Registration Overview Today Incomplete
1126
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1126
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1127 1127
 			$admin_bar->add_menu(array(
1128 1128
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1129 1129
 					'parent' => 'espresso-toolbar-registrations-today',
1130
-					'title' => __( 'Not Approved', 'event_espresso' ),
1131
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1130
+					'title' => __('Not Approved', 'event_espresso'),
1131
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1132 1132
 					'meta' => array(
1133
-							'title' => __('Not Approved', 'event_espresso' ),
1133
+							'title' => __('Not Approved', 'event_espresso'),
1134 1134
 							'target' => '',
1135 1135
 							'class' => $menu_class
1136 1136
 					),
@@ -1138,12 +1138,12 @@  discard block
 block discarded – undo
1138 1138
 		}
1139 1139
 
1140 1140
 		//Registration Overview Today Incomplete
1141
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1141
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1142 1142
 			$admin_bar->add_menu(array(
1143 1143
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1144 1144
 					'parent' => 'espresso-toolbar-registrations-today',
1145
-					'title' => __( 'Cancelled', 'event_espresso'),
1146
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1145
+					'title' => __('Cancelled', 'event_espresso'),
1146
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1147 1147
 					'meta' => array(
1148 1148
 							'title' => __('Cancelled', 'event_espresso'),
1149 1149
 							'target' => '',
@@ -1153,12 +1153,12 @@  discard block
 block discarded – undo
1153 1153
 		}
1154 1154
 
1155 1155
 		//Registration Overview This Month
1156
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1156
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1157 1157
 			$admin_bar->add_menu(array(
1158 1158
 					'id' => 'espresso-toolbar-registrations-month',
1159 1159
 					'parent' => 'espresso-toolbar-registrations',
1160
-					'title' => __( 'This Month', 'event_espresso' ),
1161
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1160
+					'title' => __('This Month', 'event_espresso'),
1161
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1162 1162
 					'meta' => array(
1163 1163
 							'title' => __('This Month', 'event_espresso'),
1164 1164
 							'target' => '',
@@ -1168,12 +1168,12 @@  discard block
 block discarded – undo
1168 1168
 		}
1169 1169
 
1170 1170
 		//Registration Overview This Month Approved
1171
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1171
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1172 1172
 			$admin_bar->add_menu(array(
1173 1173
 					'id' => 'espresso-toolbar-registrations-month-approved',
1174 1174
 					'parent' => 'espresso-toolbar-registrations-month',
1175
-					'title' => __( 'Approved', 'event_espresso' ),
1176
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1175
+					'title' => __('Approved', 'event_espresso'),
1176
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1177 1177
 					'meta' => array(
1178 1178
 							'title' => __('Approved', 'event_espresso'),
1179 1179
 							'target' => '',
@@ -1183,12 +1183,12 @@  discard block
 block discarded – undo
1183 1183
 		}
1184 1184
 
1185 1185
 		//Registration Overview This Month Pending
1186
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1186
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1187 1187
 			$admin_bar->add_menu(array(
1188 1188
 					'id' => 'espresso-toolbar-registrations-month-pending',
1189 1189
 					'parent' => 'espresso-toolbar-registrations-month',
1190
-					'title' => __( 'Pending', 'event_espresso'),
1191
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1190
+					'title' => __('Pending', 'event_espresso'),
1191
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1192 1192
 					'meta' => array(
1193 1193
 							'title' => __('Pending', 'event_espresso'),
1194 1194
 							'target' => '',
@@ -1198,14 +1198,14 @@  discard block
 block discarded – undo
1198 1198
 		}
1199 1199
 
1200 1200
 		//Registration Overview This Month Not Approved
1201
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1201
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1202 1202
 			$admin_bar->add_menu(array(
1203 1203
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1204 1204
 					'parent' => 'espresso-toolbar-registrations-month',
1205
-					'title' => __( 'Not Approved', 'event_espresso'),
1206
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1205
+					'title' => __('Not Approved', 'event_espresso'),
1206
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1207 1207
 					'meta' => array(
1208
-							'title' => __('Not Approved', 'event_espresso' ),
1208
+							'title' => __('Not Approved', 'event_espresso'),
1209 1209
 							'target' => '',
1210 1210
 							'class' => $menu_class
1211 1211
 					),
@@ -1214,12 +1214,12 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 
1216 1216
 		//Registration Overview This Month Cancelled
1217
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1217
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1218 1218
 			$admin_bar->add_menu(array(
1219 1219
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1220 1220
 					'parent' => 'espresso-toolbar-registrations-month',
1221 1221
 					'title' => __('Cancelled', 'event_espresso'),
1222
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1222
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1223 1223
 					'meta' => array(
1224 1224
 							'title' => __('Cancelled', 'event_espresso'),
1225 1225
 							'target' => '',
@@ -1229,11 +1229,11 @@  discard block
 block discarded – undo
1229 1229
 		}
1230 1230
 
1231 1231
 		//Extensions & Services
1232
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1232
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1233 1233
 			$admin_bar->add_menu(array(
1234 1234
 					'id' => 'espresso-toolbar-extensions-and-services',
1235 1235
 					'parent' => 'espresso-toolbar',
1236
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1236
+					'title' => __('Extensions & Services', 'event_espresso'),
1237 1237
 					'href' => $extensions_admin_url,
1238 1238
 					'meta' => array(
1239 1239
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1255,8 +1255,8 @@  discard block
 block discarded – undo
1255 1255
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1256 1256
 	 * @return array
1257 1257
 	 */
1258
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1259
-		return  array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() );
1258
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1259
+		return  array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array());
1260 1260
 	}
1261 1261
 
1262 1262
 
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
 	 */
1277 1277
 	public function wp_enqueue_scripts() {
1278 1278
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1279
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1279
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1280 1280
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1281
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1281
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1282 1282
 				// register jQuery Validate
1283
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE );
1283
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
1284 1284
 			}
1285 1285
 		}
1286 1286
 	}
Please login to merge, or discard this patch.
strategies/validation/EE_Email_Validation_Strategy.strategy.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{
12 12
 
13 13
 	/**
14
-     * @param null $validation_error_message
15
-     */
14
+	 * @param null $validation_error_message
15
+	 */
16 16
    public function __construct( $validation_error_message = NULL ) {
17 17
 	   if( ! $validation_error_message ){
18 18
 			$validation_error_message = __("Please enter a valid email address.", "event_espresso");
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 
40 40
 	/**
41
-     * @return array
42
-     */
41
+	 * @return array
42
+	 */
43 43
    function get_jquery_validation_rule_array(){
44 44
 	   return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) );
45 45
 	}
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@  discard block
 block discarded – undo
8 8
  * @since 				4.6
9 9
  *
10 10
  */
11
-class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{
11
+class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy {
12 12
 
13 13
 	/**
14 14
      * @param null $validation_error_message
15 15
      */
16
-   public function __construct( $validation_error_message = NULL ) {
17
-	   if( ! $validation_error_message ){
16
+   public function __construct($validation_error_message = NULL) {
17
+	   if ( ! $validation_error_message) {
18 18
 			$validation_error_message = __("Please enter a valid email address.", "event_espresso");
19 19
 		}
20
-		parent::__construct( $validation_error_message );
20
+		parent::__construct($validation_error_message);
21 21
 	}
22 22
 
23 23
 
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
     * @return bool
30 30
     * @throws \EE_Validation_Error
31 31
     */
32
-	function validate( $normalized_value ) {
33
-		if( $normalized_value && ! $this->_validate_email( $normalized_value ) ){
34
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'required');
32
+	function validate($normalized_value) {
33
+		if ($normalized_value && ! $this->_validate_email($normalized_value)) {
34
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
35 35
 		}
36 36
 	}
37 37
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	/**
41 41
      * @return array
42 42
      */
43
-   function get_jquery_validation_rule_array(){
44
-	   return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) );
43
+   function get_jquery_validation_rule_array() {
44
+	   return array('email'=>true, 'messages' => array('email' => $this->get_validation_error_message()));
45 45
 	}
46 46
 
47 47
 
@@ -54,32 +54,32 @@  discard block
 block discarded – undo
54 54
 	 * @return bool of whether the email is valid or not
55 55
 	 * @throws \EE_Validation_Error
56 56
 	 */
57
-	private function _validate_email( $email ) {
58
-		if ( ! preg_match( '/^.+\@\S+\.\S+$/', $email ) ) {
57
+	private function _validate_email($email) {
58
+		if ( ! preg_match('/^.+\@\S+\.\S+$/', $email)) {
59 59
 			// email not in correct {string}@{string}.{string} format
60 60
 			return false;
61 61
 		} else {
62
-			$atIndex = strrpos( $email, "@" );
63
-			$domain = substr( $email, $atIndex + 1 );
64
-			$local = substr( $email, 0, $atIndex );
65
-			$localLen = strlen( $local );
66
-			$domainLen = strlen( $domain );
67
-			if ( $localLen < 1 || $localLen > 64 ) {
62
+			$atIndex = strrpos($email, "@");
63
+			$domain = substr($email, $atIndex + 1);
64
+			$local = substr($email, 0, $atIndex);
65
+			$localLen = strlen($local);
66
+			$domainLen = strlen($domain);
67
+			if ($localLen < 1 || $localLen > 64) {
68 68
 				// local part length exceeded
69 69
 				return false;
70
-			} else if ( $domainLen < 1 || $domainLen > 255 ) {
70
+			} else if ($domainLen < 1 || $domainLen > 255) {
71 71
 				// domain part length exceeded
72 72
 				return false;
73
-			} else if ( $local[ 0 ] == '.' || $local[ $localLen - 1 ] == '.' ) {
73
+			} else if ($local[0] == '.' || $local[$localLen - 1] == '.') {
74 74
 				// local part starts or ends with '.'
75 75
 				return false;
76
-			} else if ( preg_match( '/\\.\\./', $local ) ) {
76
+			} else if (preg_match('/\\.\\./', $local)) {
77 77
 				// local part has two consecutive dots
78 78
 				return false;
79
-			} else if ( preg_match( '/\\.\\./', $domain ) ) {
79
+			} else if (preg_match('/\\.\\./', $domain)) {
80 80
 				// domain part has two consecutive dots
81 81
 				return false;
82
-			} else if ( ! checkdnsrr( $domain, "MX" ) ) {
82
+			} else if ( ! checkdnsrr($domain, "MX")) {
83 83
 				// domain not found in MX records
84 84
 				throw new EE_Validation_Error(
85 85
 					__(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 						'event_espresso'
88 88
 					)
89 89
 				);
90
-			} else if ( ! checkdnsrr( $domain, "A" ) ) {
90
+			} else if ( ! checkdnsrr($domain, "A")) {
91 91
 				// domain not found in A records
92 92
 				throw new EE_Validation_Error(
93 93
 					__(
Please login to merge, or discard this patch.
strategies/display/EE_Text_Input_Display_Strategy.strategy.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @since               	4.6
12 12
  *
13 13
  */
14
-class EE_Text_Input_Display_Strategy extends EE_Display_Strategy_Base{
14
+class EE_Text_Input_Display_Strategy extends EE_Display_Strategy_Base {
15 15
 	/**
16 16
 	 * The html "type" attribute value. default is "text"
17 17
 	 * @var string
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	 * @param string $type
25 25
 	 */
26
-	function __construct( $type = 'text' ) {
26
+	function __construct($type = 'text') {
27 27
 		$this->_type = $type;
28 28
 		parent::__construct();
29 29
 	}
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 * Gets the html "type" attribute's value
35 35
 	 * @return string
36 36
 	 */
37
-	function get_type(){
37
+	function get_type() {
38 38
 		if (
39 39
 			$this->_type == 'email'
40
-			&& ! apply_filters( 'FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false )
40
+			&& ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false)
41 41
 		) {
42 42
 			return 'text';
43 43
 		}
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return string of html to display the field
52 52
 	 */
53
-	function display(){
54
-		$input = '<input type="'. $this->get_type() .'"';
55
-		$input .= ' name="' . $this->_input->html_name() . '"';
56
-		$input .= ' id="' . $this->_input->html_id() . '"';
57
-		$class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
58
-		$input .= ' class="' . $class . '"';
53
+	function display() {
54
+		$input = '<input type="'.$this->get_type().'"';
55
+		$input .= ' name="'.$this->_input->html_name().'"';
56
+		$input .= ' id="'.$this->_input->html_id().'"';
57
+		$class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class();
58
+		$input .= ' class="'.$class.'"';
59 59
 		// add html5 required
60 60
 		$input .= $this->_input->required() ? ' required' : '';
61
-		$input .= ' value="' . $this->_input->raw_value_in_form() . '"';
62
-		$input .= ' style="' . $this->_input->html_style() . '"';
61
+		$input .= ' value="'.$this->_input->raw_value_in_form().'"';
62
+		$input .= ' style="'.$this->_input->html_style().'"';
63 63
 		$input .= $this->_input->html_other_attributes();
64 64
 		$input .= '/>';
65 65
 		return $input;
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 1 patch
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -141,66 +141,66 @@  discard block
 block discarded – undo
141 141
 	 *		@type EE_Validation_Strategy_Base[] $validation_strategies
142 142
 	 * }
143 143
 	 */
144
-	public function __construct( $input_args = array() ){
145
-		$input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
144
+	public function __construct($input_args = array()) {
145
+		$input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
146 146
 		// the following properties must be cast as arrays
147 147
 		$set_as_array = array(
148 148
 			'validation_strategies' => true
149 149
 		);
150 150
 		// loop thru incoming options
151
-		foreach( $input_args as $key => $value ) {
151
+		foreach ($input_args as $key => $value) {
152 152
 			// add underscore to $key to match property names
153
-			$_key = '_' . $key;
154
-			if ( property_exists( $this, $_key )) {
153
+			$_key = '_'.$key;
154
+			if (property_exists($this, $_key)) {
155 155
 				// first check if this property needs to be set as an array
156
-				if ( isset( $set_as_array[ $key ] )) {
156
+				if (isset($set_as_array[$key])) {
157 157
 					// ensure value is an array
158
-					$value = is_array( $value ) ? $value : array( get_class( $value ), $value );
158
+					$value = is_array($value) ? $value : array(get_class($value), $value);
159 159
 					// and merge with existing values
160
-					$this->{$_key} = array_merge( $this->{$_key}, $value );
160
+					$this->{$_key} = array_merge($this->{$_key}, $value);
161 161
 				} else {
162 162
 					$this->{$_key} = $value;
163 163
 				}
164 164
 			}
165 165
 		}
166 166
 		// ensure that "required" is set correctly
167
-		$this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL );
167
+		$this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL);
168 168
 
169 169
 		//$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
170 170
 
171 171
 		$this->_display_strategy->_construct_finalize($this);
172
-		if ( $this->_validation_strategies ){
173
-			foreach( $this->_validation_strategies as $validation_strategy ){
172
+		if ($this->_validation_strategies) {
173
+			foreach ($this->_validation_strategies as $validation_strategy) {
174 174
 				$validation_strategy->_construct_finalize($this);
175 175
 			}
176 176
 		}
177 177
 
178
-		if( ! $this->_normalization_strategy){
178
+		if ( ! $this->_normalization_strategy) {
179 179
 			$this->_normalization_strategy = new EE_Text_Normalization();
180 180
 		}
181 181
 		$this->_normalization_strategy->_construct_finalize($this);
182 182
 
183 183
 		//at least we can use the normalization strategy to populate the default
184
-		if( isset( $input_args[ 'default' ] ) ) {
185
-			$this->set_default( $input_args[ 'default' ] );
184
+		if (isset($input_args['default'])) {
185
+			$this->set_default($input_args['default']);
186 186
 		}
187 187
 
188
-		if( ! $this->_sensitive_data_removal_strategy){
188
+		if ( ! $this->_sensitive_data_removal_strategy) {
189 189
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
190 190
 		}
191 191
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
192
-		parent::__construct( $input_args );
192
+		parent::__construct($input_args);
193 193
 	}
194 194
 
195 195
 	/**
196 196
 	 * Sets the html_name to its default value, if none was specified in teh constructor.
197 197
 	 * Calculation involves using the name and the parent's html_name
198 198
 	 */
199
-	protected function _set_default_html_name_if_empty(){
200
-		if( ! $this->_html_name){
201
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
202
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
203
-			}else{
199
+	protected function _set_default_html_name_if_empty() {
200
+		if ( ! $this->_html_name) {
201
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
202
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
203
+			} else {
204 204
 				$this->_html_name = $this->name();
205 205
 			}
206 206
 		}
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 	function _construct_finalize($parent_form_section, $name) {
216 216
 		parent::_construct_finalize($parent_form_section, $name);
217 217
 		$this->_set_default_html_name_if_empty();
218
-		if( ! $this->_html_label ){
219
-			if( ! $this->_html_label_text){
220
-				$this->_html_label_text = ucwords( str_replace("_"," ",$name));
218
+		if ( ! $this->_html_label) {
219
+			if ( ! $this->_html_label_text) {
220
+				$this->_html_label_text = ucwords(str_replace("_", " ", $name));
221 221
 			}
222 222
 		}
223
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
223
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
224 224
 	}
225 225
 
226 226
 	 /**
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 	  * @return EE_Display_Strategy_Base
229 229
 	  * @throws EE_Error
230 230
 	  */
231
-	protected function _get_display_strategy(){
232
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
233
-			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
234
-		}else{
231
+	protected function _get_display_strategy() {
232
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
233
+			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id()));
234
+		} else {
235 235
 			return $this->_display_strategy;
236 236
 		}
237 237
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * Sets the display strategy.
240 240
 	 * @param EE_Display_Strategy_Base $strategy
241 241
 	 */
242
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
242
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
243 243
 		$this->_display_strategy = $strategy;
244 244
 	}
245 245
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * Sets the sanitization strategy
248 248
 	 * @param EE_Normalization_Strategy_Base $strategy
249 249
 	 */
250
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
250
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
251 251
 		$this->_normalization_strategy = $strategy;
252 252
 	}
253 253
 
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
 	 * Gets the display strategy for this input
274 274
 	 * @return EE_Display_Strategy_Base
275 275
 	 */
276
-	public function get_display_strategy(){
276
+	public function get_display_strategy() {
277 277
 		return $this->_display_strategy;
278 278
 	}
279 279
 	/**
280 280
 	 * Overwrites the display strategy
281 281
 	 * @param EE_Display_Strategy_Base $display_strategy
282 282
 	 */
283
-	public function set_display_strategy($display_strategy){
283
+	public function set_display_strategy($display_strategy) {
284 284
 		$this->_display_strategy = $display_strategy;
285 285
 		$this->_display_strategy->_construct_finalize($this);
286 286
 	}
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 * Gets the normalization strategy set on this input
289 289
 	 * @return EE_Normalization_Strategy_Base
290 290
 	 */
291
-	public function get_normalization_strategy(){
291
+	public function get_normalization_strategy() {
292 292
 		return $this->_normalization_strategy;
293 293
 	}
294 294
 	/**
295 295
 	 * Overwrites the normalization strategy
296 296
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
297 297
 	 */
298
-	public function set_normalization_strategy($normalization_strategy){
298
+	public function set_normalization_strategy($normalization_strategy) {
299 299
 		$this->_normalization_strategy = $normalization_strategy;
300 300
 		$this->_normalization_strategy->_construct_finalize($this);
301 301
 	}
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
305 305
 	 * @return EE_Validation_Strategy_Base[]
306 306
 	 */
307
-	public function get_validation_strategies(){
308
-		if(is_array($this->_validation_strategies)){
307
+	public function get_validation_strategies() {
308
+		if (is_array($this->_validation_strategies)) {
309 309
 			return $this->_validation_strategies;
310
-		}else{
310
+		} else {
311 311
 			return array();
312 312
 		}
313 313
 
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 	 * @param EE_Validation_Strategy_Base $validation_strategy
318 318
 	 * @return void
319 319
 	 */
320
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
321
-		$validation_strategy->_construct_finalize( $this );
322
-		$this->_validation_strategies[ get_class($validation_strategy) ] = $validation_strategy;
320
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
321
+		$validation_strategy->_construct_finalize($this);
322
+		$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
323 323
 	}
324 324
 
325 325
 	/**
@@ -327,18 +327,18 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Validation_Strategy_Base $validation_strategy
328 328
 	 * @return void
329 329
 	 */
330
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
331
-		$this->_add_validation_strategy( $validation_strategy );
330
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
331
+		$this->_add_validation_strategy($validation_strategy);
332 332
 	}
333 333
 
334 334
 	/**
335 335
 	 * The classname of the validation strategy to remove
336 336
 	 * @param string $validation_strategy_classname
337 337
 	 */
338
-	public function remove_validation_strategy( $validation_strategy_classname ) {
339
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
340
-			if( is_subclass_of( $validation_strategy, $validation_strategy_classname ) ){
341
-				unset( $this->_validation_strategies[ $key ] );
338
+	public function remove_validation_strategy($validation_strategy_classname) {
339
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
340
+			if (is_subclass_of($validation_strategy, $validation_strategy_classname)) {
341
+				unset($this->_validation_strategies[$key]);
342 342
 			}
343 343
 		}
344 344
 	}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * to the parent form's layout strategy
348 348
 	 * @return string
349 349
 	 */
350
-	public function get_html_and_js(){
350
+	public function get_html_and_js() {
351 351
 		return $this->_parent_section->get_html_for_input($this);
352 352
 	}
353 353
 	/**
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 * Makes sure the JS and CSS are enqueued for it
357 357
 	 * @return string
358 358
 	 */
359
-	public function get_html_for_input(){
359
+	public function get_html_for_input() {
360 360
 		return  $this->_get_display_strategy()->display();
361 361
 	}
362 362
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @return string
367 367
 	 */
368 368
 	public function html_other_attributes() {
369
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
369
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
370 370
 	}
371 371
 
372 372
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	/**
375 375
 	 * @param string $html_other_attributes
376 376
 	 */
377
-	public function set_html_other_attributes( $html_other_attributes ) {
377
+	public function set_html_other_attributes($html_other_attributes) {
378 378
 		$this->_html_other_attributes = $html_other_attributes;
379 379
 	}
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * according to the form section's layout strategy
384 384
 	 * @return string
385 385
 	 */
386
-	public function get_html_for_label(){
386
+	public function get_html_for_label() {
387 387
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
388 388
 	}
389 389
 	/**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 * according to the form section's layout strategy
392 392
 	 * @return string
393 393
 	 */
394
-	public function get_html_for_errors(){
394
+	public function get_html_for_errors() {
395 395
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
396 396
 	}
397 397
 	/**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 * according to the form section's layout strategy
400 400
 	 * @return string
401 401
 	 */
402
-	public function get_html_for_help(){
402
+	public function get_html_for_help() {
403 403
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
404 404
 	}
405 405
 	/**
@@ -408,20 +408,20 @@  discard block
 block discarded – undo
408 408
 	 * @return boolean
409 409
 	 */
410 410
 	protected function _validate() {
411
-		if(is_array($this->_validation_strategies)){
412
-			foreach($this->_validation_strategies as $validation_strategy){
413
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
414
-					try{
411
+		if (is_array($this->_validation_strategies)) {
412
+			foreach ($this->_validation_strategies as $validation_strategy) {
413
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
414
+					try {
415 415
 						$validation_strategy->validate($this->normalized_value());
416
-					}catch(EE_Validation_Error $e){
416
+					} catch (EE_Validation_Error $e) {
417 417
 						$this->add_validation_error($e);
418 418
 					}
419 419
 				}
420 420
 			}
421 421
 		}
422
-		if( $this->get_validation_errors()){
422
+		if ($this->get_validation_errors()) {
423 423
 			return false;
424
-		}else{
424
+		} else {
425 425
 			return true;
426 426
 		}
427 427
 	}
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 * @param string $value
435 435
 	 * @return null|string
436 436
 	 */
437
-	private function _sanitize($value){
438
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
437
+	private function _sanitize($value) {
438
+		return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
439 439
 	}
440 440
 
441 441
 
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
 	 * @param array $req_data like $_POST
448 448
 	 * @return boolean whether or not there was an error
449 449
 	 */
450
-	protected function _normalize( $req_data ) {
450
+	protected function _normalize($req_data) {
451 451
 		//any existing validation errors don't apply so clear them
452 452
 		$this->_validation_errors = array();
453 453
 		try {
454
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
454
+			$raw_input = $this->find_form_data_for_this_section($req_data);
455 455
 			//super simple sanitization for now
456
-			if ( is_array( $raw_input )) {
456
+			if (is_array($raw_input)) {
457 457
 				$this->_raw_value = array();
458
-				foreach( $raw_input as $key => $value ) {
459
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
458
+				foreach ($raw_input as $key => $value) {
459
+					$this->_raw_value[$key] = $this->_sanitize($value);
460 460
 				}
461 461
 			} else {
462
-				$this->_raw_value = $this->_sanitize( $raw_input );
462
+				$this->_raw_value = $this->_sanitize($raw_input);
463 463
 			}
464 464
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
465
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
466
-		} catch ( EE_Validation_Error $e ) {
467
-			$this->add_validation_error( $e );
465
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
466
+		} catch (EE_Validation_Error $e) {
467
+			$this->add_validation_error($e);
468 468
 		}
469 469
 	}
470 470
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	/**
474 474
 	 * @return string
475 475
 	 */
476
-	public function html_name(){
476
+	public function html_name() {
477 477
 		return $this->_html_name;
478 478
 	}
479 479
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	/**
483 483
 	 * @return string
484 484
 	 */
485
-	function html_label_id(){
486
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
485
+	function html_label_id() {
486
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
487 487
 	}
488 488
 
489 489
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	/**
492 492
 	 * @return string
493 493
 	 */
494
-	function html_label_class(){
494
+	function html_label_class() {
495 495
 		return $this->_html_label_class;
496 496
 	}
497 497
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	/**
501 501
 	 * @return string
502 502
 	 */
503
-	function html_label_style(){
503
+	function html_label_style() {
504 504
 		return $this->_html_label_style;
505 505
 	}
506 506
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 	/**
510 510
 	 * @return string
511 511
 	 */
512
-	function html_label_text(){
512
+	function html_label_text() {
513 513
 		return $this->_html_label_text;
514 514
 	}
515 515
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	/**
519 519
 	 * @return string
520 520
 	 */
521
-	function html_help_text(){
521
+	function html_help_text() {
522 522
 		return $this->_html_help_text;
523 523
 	}
524 524
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	/**
528 528
 	 * @return string
529 529
 	 */
530
-	function html_help_class(){
530
+	function html_help_class() {
531 531
 		return $this->_html_help_class;
532 532
 	}
533 533
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	/**
537 537
 	 * @return string
538 538
 	 */
539
-	function html_help_style(){
539
+	function html_help_style() {
540 540
 		return $this->_html_style;
541 541
 	}
542 542
 	/**
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 * in which case, we would have stored the malicious content to our database.
550 550
 	 * @return string
551 551
 	 */
552
-	function raw_value(){
552
+	function raw_value() {
553 553
 		return $this->_raw_value;
554 554
 	}
555 555
 	/**
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 	 * it escapes all html entities
558 558
 	 * @return string
559 559
 	 */
560
-	function raw_value_in_form(){
561
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
560
+	function raw_value_in_form() {
561
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
562 562
 	}
563 563
 	/**
564 564
 	 * returns the value after it's been sanitized, and then converted into it's proper type
565 565
 	 * in PHP. Eg, a string, an int, an array,
566 566
 	 * @return mixed
567 567
 	 */
568
-	function normalized_value(){
568
+	function normalized_value() {
569 569
 		return $this->_normalized_value;
570 570
 	}
571 571
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 * the best thing to display
576 576
 	 * @return string
577 577
 	 */
578
-	function pretty_value(){
578
+	function pretty_value() {
579 579
 		return $this->_normalized_value;
580 580
 	}
581 581
 	/**
@@ -594,19 +594,19 @@  discard block
 block discarded – undo
594 594
 		  }</code>
595 595
 	 * @return array
596 596
 	 */
597
-	function get_jquery_validation_rules(){
597
+	function get_jquery_validation_rules() {
598 598
 
599 599
 		$jquery_validation_rules = array();
600
-		foreach($this->get_validation_strategies() as $validation_strategy){
600
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
601 601
 			$jquery_validation_rules = array_replace_recursive(
602 602
 				$jquery_validation_rules,
603 603
 				$validation_strategy->get_jquery_validation_rule_array()
604 604
 			);
605 605
 		}
606 606
 
607
-		if(! empty($jquery_validation_rules)){
608
-			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
609
-		}else{
607
+		if ( ! empty($jquery_validation_rules)) {
608
+			$jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules;
609
+		} else {
610 610
 			return array();
611 611
 		}
612 612
 		return $jquery_validation_js;
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 	 * @param mixed $value
619 619
 	 * @return void
620 620
 	 */
621
-	function set_default($value){
621
+	function set_default($value) {
622 622
 		$this->_normalized_value = $value;
623
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
623
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
624 624
 	}
625 625
 
626 626
 	/**
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 * @param string $label
629 629
 	 * @return void
630 630
 	 */
631
-	function set_html_label_text($label){
631
+	function set_html_label_text($label) {
632 632
 		$this->_html_label_text = $label;
633 633
 	}
634 634
 
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 	 * @param boolean $required
641 641
 	 * @param null    $required_text
642 642
 	 */
643
-	function set_required($required = true, $required_text = NULL ){
644
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN );
645
-		if ( $required ) {
646
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
643
+	function set_required($required = true, $required_text = NULL) {
644
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
645
+		if ($required) {
646
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
647 647
 		} else {
648
-			unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] );
648
+			unset($this->_validation_strategies['EE_Required_Validation_Strategy']);
649 649
 		}
650 650
 		$this->_required = $required;
651 651
 	}
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * Returns whether or not this field is required
654 654
 	 * @return boolean
655 655
 	 */
656
-	public function required(){
656
+	public function required() {
657 657
 		return $this->_required;
658 658
 	}
659 659
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	/**
663 663
 	 * @param string $required_css_class
664 664
 	 */
665
-	public function set_required_css_class( $required_css_class ) {
665
+	public function set_required_css_class($required_css_class) {
666 666
 		$this->_required_css_class = $required_css_class;
667 667
 	}
668 668
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * Sets the help text, in case
682 682
 	 * @param string $text
683 683
 	 */
684
-	public function set_html_help_text($text){
684
+	public function set_html_help_text($text) {
685 685
 		$this->_html_help_text = $text;
686 686
 	}
687 687
 	/**
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
 	public function clean_sensitive_data() {
694 694
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
695 695
 		//if we need more logic than this we'll make a strategy for it
696
-		if( $this->_sensitive_data_removal_strategy &&
697
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
696
+		if ($this->_sensitive_data_removal_strategy &&
697
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
698 698
 			$this->_raw_value = NULL;
699 699
 		}
700 700
 		//and clean the normalized value according to the appropriate strategy
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
 	 * @param string $button_size
709 709
 	 * @param string $other_attributes
710 710
 	 */
711
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
711
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
712 712
 		$button_css_attributes = 'button';
713 713
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
714
-		switch ( $button_size ) {
714
+		switch ($button_size) {
715 715
 			case 'xs' :
716 716
 			case 'extra-small' :
717 717
 				$button_css_attributes .= ' button-xs';
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			default :
733 733
 				$button_css_attributes .= '';
734 734
 		}
735
-		$this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes;
735
+		$this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes;
736 736
 	}
737 737
 
738 738
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	 * @return string
742 742
 	 */
743 743
 	public function button_css_attributes() {
744
-		if ( empty( $this->_button_css_attributes )) {
744
+		if (empty($this->_button_css_attributes)) {
745 745
 			$this->set_button_css_attributes();
746 746
 		}
747 747
 		return $this->_button_css_attributes;
@@ -761,27 +761,27 @@  discard block
 block discarded – undo
761 761
 	 * @param array $req_data
762 762
 	 * @return mixed whatever the raw value of this form section is in the request data
763 763
 	 */
764
-	public function find_form_data_for_this_section( $req_data ){
764
+	public function find_form_data_for_this_section($req_data) {
765 765
 		// break up the html name by "[]"
766
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
767
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
766
+		if (strpos($this->html_name(), '[') !== FALSE) {
767
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
768 768
 		} else {
769 769
 			$before_any_brackets = $this->html_name();
770 770
 		}
771 771
 		// grab all of the segments
772
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
773
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
774
-			$name_parts = $matches[ 1 ];
772
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
773
+		if (isset($matches[1]) && is_array($matches[1])) {
774
+			$name_parts = $matches[1];
775 775
 			array_unshift($name_parts, $before_any_brackets);
776
-		}else{
777
-			$name_parts = array( $before_any_brackets );
776
+		} else {
777
+			$name_parts = array($before_any_brackets);
778 778
 		}
779 779
 		// now get the value for the input
780 780
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
781
-		if( $value === NULL ){
781
+		if ($value === NULL) {
782 782
 			//check if this thing's name is at the TOP level of the request data
783
-			if( isset( $req_data[ $this->name() ] ) ){
784
-				$value = $req_data[ $this->name() ];
783
+			if (isset($req_data[$this->name()])) {
784
+				$value = $req_data[$this->name()];
785 785
 			}
786 786
 		}
787 787
 		return $value;
@@ -795,15 +795,15 @@  discard block
 block discarded – undo
795 795
 	 * @param array $req_data
796 796
 	 * @return array | NULL
797 797
 	 */
798
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
799
-		$first_part_to_consider = array_shift( $html_name_parts );
800
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
801
-			if( empty($html_name_parts ) ){
802
-				return $req_data[ $first_part_to_consider ];
803
-			}else{
804
-				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
798
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
799
+		$first_part_to_consider = array_shift($html_name_parts);
800
+		if (isset($req_data[$first_part_to_consider])) {
801
+			if (empty($html_name_parts)) {
802
+				return $req_data[$first_part_to_consider];
803
+			} else {
804
+				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]);
805 805
 			}
806
-		}else{
806
+		} else {
807 807
 			return NULL;
808 808
 		}
809 809
 	}
@@ -815,14 +815,14 @@  discard block
 block discarded – undo
815 815
 	 * @param array $req_data like $_POST
816 816
 	 * @return boolean
817 817
 	 */
818
-	public function form_data_present_in($req_data = NULL){
819
-		if( $req_data === NULL ){
818
+	public function form_data_present_in($req_data = NULL) {
819
+		if ($req_data === NULL) {
820 820
 			$req_data = $_POST;
821 821
 		}
822
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
823
-		if( $checked_value !== null ){
822
+		$checked_value = $this->find_form_data_for_this_section($req_data);
823
+		if ($checked_value !== null) {
824 824
 			return TRUE;
825
-		}else{
825
+		} else {
826 826
 			return FALSE;
827 827
 		}
828 828
 	}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Email_Input.input.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,22 +6,22 @@
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Email_Input extends EE_Form_Input_Base{
9
+class EE_Email_Input extends EE_Form_Input_Base {
10 10
 
11 11
 	/**
12 12
 	 * @param array $input_settings
13 13
 	 */
14
-	function __construct( $input_settings = array() ){
15
-		$this->_set_display_strategy( new EE_Text_Input_Display_Strategy('email') );
16
-		$this->_set_normalization_strategy( new EE_Text_Normalization() );
14
+	function __construct($input_settings = array()) {
15
+		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email'));
16
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
17 17
 		$this->_add_validation_strategy(
18 18
 			new EE_Email_Validation_Strategy(
19
-				isset( $input_settings[ 'validation_error_message' ] )
20
-					? $input_settings[ 'validation_error_message' ]
19
+				isset($input_settings['validation_error_message'])
20
+					? $input_settings['validation_error_message']
21 21
 					: NULL
22 22
 			)
23 23
 		);
24
-		parent::__construct( $input_settings );
25
-		$this->set_html_class( $this->html_class() . ' email' );
24
+		parent::__construct($input_settings);
25
+		$this->set_html_class($this->html_class().' email');
26 26
 	}
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.