Completed
Branch BUG-6292-conflict-legacy-wp-me... (bf4350)
by
unknown
16:25 queued 19s
created
core/EE_System.core.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
 
204 204
 
205 205
 	/**
206
-	* detect_if_activation_or_upgrade
207
-	*
208
-	* Takes care of detecting whether this is a brand new install or code upgrade,
209
-	* and either setting up the DB or setting up maintenance mode etc.
210
-	*
211
-	* @access public
212
-	* @return void
213
-	*/
206
+	 * detect_if_activation_or_upgrade
207
+	 *
208
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
209
+	 * and either setting up the DB or setting up maintenance mode etc.
210
+	 *
211
+	 * @access public
212
+	 * @return void
213
+	 */
214 214
 	public function detect_if_activation_or_upgrade() {
215 215
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
216 216
 
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 			$query_params =  array( 'page' => 'espresso_about' );
515 515
 
516 516
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
517
-			    $query_params['new_activation'] = TRUE;
517
+				$query_params['new_activation'] = TRUE;
518 518
 			}
519 519
 
520 520
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
521
-			    $query_params['reactivation'] = TRUE;
521
+				$query_params['reactivation'] = TRUE;
522 522
 			}
523 523
 			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
524 524
 			wp_safe_redirect( $url );
@@ -621,11 +621,11 @@  discard block
 block discarded – undo
621 621
 
622 622
 
623 623
 	/**
624
-	* _incompatible_addon_error
625
-	*
626
-	* @access public
627
-	* @return void
628
-	*/
624
+	 * _incompatible_addon_error
625
+	 *
626
+	 * @access public
627
+	 * @return void
628
+	 */
629 629
 	private function _incompatible_addon_error() {
630 630
 		// get array of classes hooking into here
631 631
 		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
 
748 748
 
749 749
 	/**
750
-	* load_controllers
751
-	*
752
-	* this is the best place to load any additional controllers that needs access to EE core.
753
-	* it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
754
-	*
755
-	* @access public
756
-	* @return void
757
-	*/
750
+	 * load_controllers
751
+	 *
752
+	 * this is the best place to load any additional controllers that needs access to EE core.
753
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
754
+	 *
755
+	 * @access public
756
+	 * @return void
757
+	 */
758 758
 	public function load_controllers() {
759 759
 		do_action( 'AHEE__EE_System__load_controllers__start' );
760 760
 		// let's get it started
@@ -771,13 +771,13 @@  discard block
 block discarded – undo
771 771
 
772 772
 
773 773
 	/**
774
-	* core_loaded_and_ready
775
-	*
776
-	* all of the basic EE core should be loaded at this point and available regardless of M-Mode
777
-	*
778
-	* @access public
779
-	* @return void
780
-	*/
774
+	 * core_loaded_and_ready
775
+	 *
776
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
777
+	 *
778
+	 * @access public
779
+	 * @return void
780
+	 */
781 781
 	public function core_loaded_and_ready() {
782 782
 		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
783 783
 		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
@@ -788,13 +788,13 @@  discard block
 block discarded – undo
788 788
 
789 789
 
790 790
 	/**
791
-	* initialize
792
-	*
793
-	* this is the best place to begin initializing client code
794
-	*
795
-	* @access public
796
-	* @return void
797
-	*/
791
+	 * initialize
792
+	 *
793
+	 * this is the best place to begin initializing client code
794
+	 *
795
+	 * @access public
796
+	 * @return void
797
+	 */
798 798
 	public function initialize() {
799 799
 		do_action( 'AHEE__EE_System__initialize' );
800 800
 	}
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 
803 803
 
804 804
 	/**
805
-	* initialize_last
806
-	*
807
-	* this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
808
-	*
809
-	* @access public
810
-	* @return void
811
-	*/
805
+	 * initialize_last
806
+	 *
807
+	 * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
808
+	 *
809
+	 * @access public
810
+	 * @return void
811
+	 */
812 812
 	public function initialize_last() {
813 813
 		do_action( 'AHEE__EE_System__initialize_last' );
814 814
 	}
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
 
818 818
 
819 819
 	/**
820
-	* set_hooks_for_shortcodes_modules_and_addons
821
-	*
822
-	* this is the best place for other systems to set callbacks for hooking into other parts of EE
823
-	* this happens at the very beginning of the wp_loaded hookpoint
824
-	*
825
-	* @access public
826
-	* @return void
827
-	*/
820
+	 * set_hooks_for_shortcodes_modules_and_addons
821
+	 *
822
+	 * this is the best place for other systems to set callbacks for hooking into other parts of EE
823
+	 * this happens at the very beginning of the wp_loaded hookpoint
824
+	 *
825
+	 * @access public
826
+	 * @return void
827
+	 */
828 828
 	public function set_hooks_for_shortcodes_modules_and_addons() {
829 829
 //		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
830 830
 	}
@@ -833,13 +833,13 @@  discard block
 block discarded – undo
833 833
 
834 834
 
835 835
 	/**
836
-	* do_not_cache
837
-	*
838
-	* sets no cache headers and defines no cache constants for WP plugins
839
-	*
840
-	* @access public
841
-	* @return void
842
-	*/
836
+	 * do_not_cache
837
+	 *
838
+	 * sets no cache headers and defines no cache constants for WP plugins
839
+	 *
840
+	 * @access public
841
+	 * @return void
842
+	 */
843 843
 	public static function do_not_cache() {
844 844
 		// set no cache constants
845 845
 		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 			//Current post
958 958
 			global $post;		
959 959
     	
960
-	    	if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
960
+			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
961 961
 				//Events Edit Current Event
962 962
 				$admin_bar->add_menu(array(
963 963
 						'id' => 'espresso-toolbar-events-edit',
Please login to merge, or discard this patch.
core/db_classes/EE_CSV.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -315,7 +315,7 @@
 block discarded – undo
315 315
 //		header("Content-Type: application/download");
316 316
 		header('Content-disposition: attachment; filename='.$filename);
317 317
 		header("Content-Type: text/csv; charset=utf-8");
318
-                do_action( 'AHEE__EE_CSV__begin_sending_csv__headers' );
318
+				do_action( 'AHEE__EE_CSV__begin_sending_csv__headers' );
319 319
 		echo apply_filters('FHEE__EE_CSV__begin_sending_csv__start_writing', "\xEF\xBB\xBF" ); // makes excel open it as UTF-8. UTF-8 BOM, see http://stackoverflow.com/a/4440143/2773835
320 320
 		$fh = fopen('php://output', 'w');
321 321
 		return $fh;
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1092,14 +1092,14 @@  discard block
 block discarded – undo
1092 1092
 							$QSG_ID = reset( $id_col );
1093 1093
 						} else {
1094 1094
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1095
-                                                        EE_Log::instance()->log( 
1096
-                                                                __FILE__, 
1097
-                                                                __FUNCTION__, 
1098
-                                                                sprintf( 
1099
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100
-                                                                        $QST_ID ), 
1101
-                                                                'error' );
1102
-                                                        continue;
1095
+														EE_Log::instance()->log( 
1096
+																__FILE__, 
1097
+																__FUNCTION__, 
1098
+																sprintf( 
1099
+																		__( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100
+																		$QST_ID ), 
1101
+																'error' );
1102
+														continue;
1103 1103
 						}
1104 1104
 					}
1105 1105
                                         
@@ -1629,8 +1629,8 @@  discard block
 block discarded – undo
1629 1629
 				}
1630 1630
 			}
1631 1631
 		}
1632
-                //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1633
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1632
+				//also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1633
+				remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1634 1634
 
1635 1635
 		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1636 1636
 			$db_update_sans_ee4 = array();
Please login to merge, or discard this patch.
Spacing   +359 added lines, -359 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 * @param $table_name
58 58
 	 * @return string
59 59
 	 */
60
-	public static function ensure_table_name_has_prefix( $table_name ) {
60
+	public static function ensure_table_name_has_prefix($table_name) {
61 61
 		global $wpdb;
62
-		return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
62
+		return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
63 63
 	}
64 64
 
65 65
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * be called on plugin activation and reactivation
86 86
 	 * @return boolean success, whether the database and folders are setup properly
87 87
 	 */
88
-	public static function initialize_db_and_folders(){
88
+	public static function initialize_db_and_folders() {
89 89
 		$good_filesystem = EEH_Activation::create_upload_directories();
90 90
 		$good_db = EEH_Activation::create_database_tables();
91 91
 		return $good_filesystem && $good_db;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * upon activation of a new plugin, reactivation, and at the end
100 100
 	 * of running migration scripts
101 101
 	 */
102
-	public static function initialize_db_content(){
102
+	public static function initialize_db_content() {
103 103
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
104
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
104
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
105 105
 			return;
106 106
 		}
107 107
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		EEH_Activation::remove_cron_tasks();
119 119
 		EEH_Activation::create_cron_tasks();
120 120
 		//also, check for CAF default db content
121
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
121
+		do_action('AHEE__EEH_Activation__initialize_db_content');
122 122
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
123 123
 		//which users really won't care about on initial activation
124 124
 		EE_Error::overwrite_success();
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return array
138 138
 	 * @throws \EE_Error
139 139
 	 */
140
-	public static function get_cron_tasks( $which_to_include ) {
140
+	public static function get_cron_tasks($which_to_include) {
141 141
 		$cron_tasks = apply_filters(
142 142
 			'FHEE__EEH_Activation__get_cron_tasks',
143 143
 			array(
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates
147 147
 			)
148 148
 		);
149
-		if( $which_to_include === 'all' ) {
149
+		if ($which_to_include === 'all') {
150 150
 			//leave as-is
151
-		}elseif( $which_to_include === 'old' ) {
152
-			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
151
+		}elseif ($which_to_include === 'old') {
152
+			$cron_tasks = array_filter($cron_tasks, function($value) {
153 153
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
154 154
 			});
155
-		}elseif( $which_to_include === 'current' ) {
156
-			$cron_tasks = array_filter( $cron_tasks );
157
-		}elseif( WP_DEBUG ) {
158
-			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
159
-		}else{
155
+		}elseif ($which_to_include === 'current') {
156
+			$cron_tasks = array_filter($cron_tasks);
157
+		}elseif (WP_DEBUG) {
158
+			throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include));
159
+		} else {
160 160
 			//leave as-is
161 161
 		}
162 162
 		return $cron_tasks;
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public static function create_cron_tasks() {
169 169
 
170
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
171
-			if( ! wp_next_scheduled( $hook_name ) ) {
172
-				wp_schedule_event( time(), $frequency, $hook_name );
170
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
171
+			if ( ! wp_next_scheduled($hook_name)) {
172
+				wp_schedule_event(time(), $frequency, $hook_name);
173 173
 			}
174 174
 		}
175 175
 
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * Remove the currently-existing and now-removed cron tasks.
180 180
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
181 181
 	 */
182
-	public static function remove_cron_tasks( $remove_all = true ) {
182
+	public static function remove_cron_tasks($remove_all = true) {
183 183
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
184 184
 		$crons = _get_cron_array();
185
-		$crons = is_array( $crons ) ? $crons : array();
185
+		$crons = is_array($crons) ? $crons : array();
186 186
 		/* reminder that $crons looks like: top-level keys are timestamps,
187 187
 		 * and their values are arrays.
188 188
 		 * The 2nd level arrays have keys with each of the cron task hooknames to run at that time
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 		 *					...
201 201
 		 *      ...
202 202
 		 */
203
-		foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) {
204
-			foreach( $crons as $timestamp => $hooks_to_fire_at_time ) {
205
-				if ( array_key_exists( $hook_name, $hooks_to_fire_at_time ) )  {
206
-					unset( $crons[ $timestamp ][ $hook_name ] );
203
+		foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) {
204
+			foreach ($crons as $timestamp => $hooks_to_fire_at_time) {
205
+				if (array_key_exists($hook_name, $hooks_to_fire_at_time)) {
206
+					unset($crons[$timestamp][$hook_name]);
207 207
 				}
208 208
 			}
209 209
 		}
210
-		_set_cron_array( $crons );
210
+		_set_cron_array($crons);
211 211
 	}
212 212
 
213 213
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public static function CPT_initialization() {
224 224
 		// register Custom Post Types
225
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
225
+		EE_Registry::instance()->load_core('Register_CPTs');
226 226
 		flush_rewrite_rules();
227 227
 	}
228 228
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * 	@return void
241 241
 	 */
242 242
 	public static function reset_and_update_config() {
243
-		do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) );
244
-		add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 );
243
+		do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config'));
244
+		add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3);
245 245
 		//EE_Config::reset();
246 246
 	}
247 247
 
@@ -254,23 +254,23 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public static function load_calendar_config() {
256 256
 		// grab array of all plugin folders and loop thru it
257
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
258
-		if ( empty( $plugins ) ) {
257
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
258
+		if (empty($plugins)) {
259 259
 			return;
260 260
 		}
261
-		foreach ( $plugins as $plugin_path ) {
261
+		foreach ($plugins as $plugin_path) {
262 262
 			// grab plugin folder name from path
263
-			$plugin = basename( $plugin_path );
263
+			$plugin = basename($plugin_path);
264 264
 			// drill down to Espresso plugins
265
-			if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) {
265
+			if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) {
266 266
 				// then to calendar related plugins
267
-				if ( strpos( $plugin, 'calendar' ) !== FALSE ) {
267
+				if (strpos($plugin, 'calendar') !== FALSE) {
268 268
 					// this is what we are looking for
269
-					$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
269
+					$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
270 270
 					// does it exist in this folder ?
271
-					if ( is_readable( $calendar_config )) {
271
+					if (is_readable($calendar_config)) {
272 272
 						// YEAH! let's load it
273
-						require_once( $calendar_config );
273
+						require_once($calendar_config);
274 274
 					}
275 275
 				}
276 276
 			}
@@ -287,21 +287,21 @@  discard block
 block discarded – undo
287 287
 	 * @param \EE_Config $EE_Config
288 288
 	 * @return \stdClass
289 289
 	 */
290
-	public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) {
291
-		$convert_from_array = array( 'addons' );
290
+	public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) {
291
+		$convert_from_array = array('addons');
292 292
 		// in case old settings were saved as an array
293
-		if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
293
+		if (is_array($settings) && in_array($config, $convert_from_array)) {
294 294
 			// convert existing settings to an object
295 295
 			$config_array = $settings;
296 296
 			$settings = new stdClass();
297
-			foreach ( $config_array as $key => $value ){
298
-				if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) {
299
-					$EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
297
+			foreach ($config_array as $key => $value) {
298
+				if ($key == 'calendar' && class_exists('EE_Calendar_Config')) {
299
+					$EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
300 300
 				} else {
301 301
 					$settings->$key = $value;
302 302
 				}
303 303
 			}
304
-			add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' );
304
+			add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true');
305 305
 		}
306 306
 		return $settings;
307 307
 	}
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public static function deactivate_event_espresso() {
319 319
 		// check permissions
320
-		if ( current_user_can( 'activate_plugins' )) {
321
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
320
+		if (current_user_can('activate_plugins')) {
321
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
322 322
 		}
323 323
 	}
324 324
 
@@ -340,79 +340,79 @@  discard block
 block discarded – undo
340 340
 		$critical_pages = array(
341 341
 			array(
342 342
 				'id' =>'reg_page_id',
343
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
343
+				'name' => __('Registration Checkout', 'event_espresso'),
344 344
 				'post' => NULL,
345 345
 				'code' => 'ESPRESSO_CHECKOUT'
346 346
 			),
347 347
 			array(
348 348
 				'id' => 'txn_page_id',
349
-				'name' => __( 'Transactions', 'event_espresso' ),
349
+				'name' => __('Transactions', 'event_espresso'),
350 350
 				'post' => NULL,
351 351
 				'code' => 'ESPRESSO_TXN_PAGE'
352 352
 			),
353 353
 			array(
354 354
 				'id' => 'thank_you_page_id',
355
-				'name' => __( 'Thank You', 'event_espresso' ),
355
+				'name' => __('Thank You', 'event_espresso'),
356 356
 				'post' => NULL,
357 357
 				'code' => 'ESPRESSO_THANK_YOU'
358 358
 			),
359 359
 			array(
360 360
 				'id' => 'cancel_page_id',
361
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
361
+				'name' => __('Registration Cancelled', 'event_espresso'),
362 362
 				'post' => NULL,
363 363
 				'code' => 'ESPRESSO_CANCELLED'
364 364
 			),
365 365
 		);
366 366
 
367
-		foreach ( $critical_pages as $critical_page ) {
367
+		foreach ($critical_pages as $critical_page) {
368 368
 			// is critical page ID set in config ?
369
-			if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) {
369
+			if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) {
370 370
 				// attempt to find post by ID
371
-				$critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] );
371
+				$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']);
372 372
 			}
373 373
 			// no dice?
374
-			if ( $critical_page['post'] == NULL ) {
374
+			if ($critical_page['post'] == NULL) {
375 375
 				// attempt to find post by title
376
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
376
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
377 377
 				// still nothing?
378
-				if ( $critical_page['post'] == NULL ) {
379
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
378
+				if ($critical_page['post'] == NULL) {
379
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
380 380
 					// REALLY? Still nothing ??!?!?
381
-					if ( $critical_page['post'] == NULL ) {
382
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
383
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
381
+					if ($critical_page['post'] == NULL) {
382
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
383
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
384 384
 						break;
385 385
 					}
386 386
 				}
387 387
 			}
388 388
 			// track post_shortcodes
389
-			if ( $critical_page['post'] ) {
390
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
389
+			if ($critical_page['post']) {
390
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
391 391
 			}
392 392
 			// check that Post ID matches critical page ID in config
393
-			if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) {
393
+			if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) {
394 394
 				//update Config with post ID
395 395
 				EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID;
396
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
397
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
398
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
396
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
397
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
398
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
399 399
 				}
400 400
 			}
401 401
 
402
-			$critical_page_problem =  ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem;
402
+			$critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
403 403
 
404 404
 		}
405 405
 
406
-		if ( $critical_page_problem ) {
406
+		if ($critical_page_problem) {
407 407
 			$msg = sprintf(
408
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
409
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
408
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
409
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
410 410
 			);
411
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
411
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
412 412
 		}
413 413
 
414
-		if ( EE_Error::has_notices() ) {
415
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
414
+		if (EE_Error::has_notices()) {
415
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
416 416
 		}
417 417
 
418 418
 	}
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 	 * parameter to the shortcode
426 426
 	 * @return WP_Post or NULl
427 427
 	 */
428
-	public static function get_page_by_ee_shortcode($ee_shortcode){
428
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
429 429
 		global $wpdb;
430 430
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
431 431
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
432
-		if($post_id){
432
+		if ($post_id) {
433 433
 			return get_post($post_id);
434
-		}else{
434
+		} else {
435 435
 			return NULL;
436 436
 		}
437 437
 
@@ -448,32 +448,32 @@  discard block
 block discarded – undo
448 448
 	 * @param array $critical_page
449 449
 	 * @return array
450 450
 	 */
451
-	public static function create_critical_page( $critical_page ) {
451
+	public static function create_critical_page($critical_page) {
452 452
 
453 453
 		$post_args = array(
454 454
 			'post_title' => $critical_page['name'],
455 455
 			'post_status' => 'publish',
456 456
 			'post_type' => 'page',
457 457
 			'comment_status' => 'closed',
458
-			'post_content' => '[' . $critical_page['code'] . ']'
458
+			'post_content' => '['.$critical_page['code'].']'
459 459
 		);
460 460
 
461
-		$post_id = wp_insert_post( $post_args );
462
-		if ( ! $post_id ) {
461
+		$post_id = wp_insert_post($post_args);
462
+		if ( ! $post_id) {
463 463
 			$msg = sprintf(
464
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
464
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
465 465
 				$critical_page['name']
466 466
 			);
467
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
467
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
468 468
 			return $critical_page;
469 469
 		}
470 470
 		// get newly created post's details
471
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
471
+		if ( ! $critical_page['post'] = get_post($post_id)) {
472 472
 			$msg = sprintf(
473
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
473
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
474 474
 				$critical_page['name']
475 475
 			);
476
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
476
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
477 477
 		}
478 478
 
479 479
 		return $critical_page;
@@ -492,34 +492,34 @@  discard block
 block discarded – undo
492 492
 	 * @param array $critical_page
493 493
 	 * @return void
494 494
 	 */
495
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
495
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
496 496
 		// check the goods
497
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
497
+		if ( ! $critical_page['post'] instanceof WP_Post) {
498 498
 			$msg = sprintf(
499
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
499
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
500 500
 				$critical_page['name']
501 501
 			);
502
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
502
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
503 503
 			return;
504 504
 		}
505 505
 		// map shortcode to post
506
-		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
506
+		EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
507 507
 		// and make sure it's NOT added to the WP "Posts Page"
508 508
 		// name of the WP Posts Page
509 509
 		$posts_page = EE_Registry::instance()->CFG->get_page_for_posts();
510
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) {
511
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
510
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) {
511
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]);
512 512
 		}
513
-		if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) {
514
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] );
513
+		if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) {
514
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]);
515 515
 		}
516 516
 		// update post_shortcode CFG
517
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
517
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
518 518
 			$msg = sprintf(
519
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
519
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
520 520
 				$critical_page['name']
521 521
 			);
522
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
522
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
523 523
 		}
524 524
 	}
525 525
 
@@ -537,24 +537,24 @@  discard block
 block discarded – undo
537 537
 	public static function get_default_creator_id() {
538 538
 		global $wpdb;
539 539
 
540
-		if ( ! empty( self::$_default_creator_id ) ) {
540
+		if ( ! empty(self::$_default_creator_id)) {
541 541
 			return self::$_default_creator_id;
542 542
 		}/**/
543 543
 
544
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
544
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
545 545
 
546 546
 		//let's allow pre_filtering for early exits by alternative methods for getting id.  We check for truthy result and if so then exit early.
547
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
548
-		if ( $pre_filtered_id !== false ) {
547
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
548
+		if ($pre_filtered_id !== false) {
549 549
 			return (int) $pre_filtered_id;
550 550
 		}
551 551
 
552
-		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' );
553
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
554
-		$user_id = $wpdb->get_var( $query );
555
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
556
-		 if ( $user_id && intval( $user_id ) ) {
557
-		 	self::$_default_creator_id =  intval( $user_id );
552
+		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities');
553
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
554
+		$user_id = $wpdb->get_var($query);
555
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
556
+		 if ($user_id && intval($user_id)) {
557
+		 	self::$_default_creator_id = intval($user_id);
558 558
 		 	return self::$_default_creator_id;
559 559
 		 } else {
560 560
 		 	return NULL;
@@ -581,29 +581,29 @@  discard block
 block discarded – undo
581 581
 	 * 	@return void
582 582
 	 * @throws EE_Error if there are database errors
583 583
 	 */
584
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) {
585
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
584
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) {
585
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
586 586
 			return;
587 587
 		}
588
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
589
-		if ( ! function_exists( 'dbDelta' )) {
590
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
588
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
589
+		if ( ! function_exists('dbDelta')) {
590
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
591 591
 		}
592 592
 		/** @var WPDB $wpdb */
593 593
 		global $wpdb;
594
-		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
594
+		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
595 595
 		// do we need to first delete an existing version of this table ?
596
-		if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){
596
+		if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) {
597 597
 			// ok, delete the table... but ONLY if it's empty
598
-			$deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name );
598
+			$deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name);
599 599
 			// table is NOT empty, are you SURE you want to delete this table ???
600
-			if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
601
-				EEH_Activation::delete_unused_db_table( $wp_table_name );
602
-			} else if ( ! $deleted_safely ) {
600
+			if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
601
+				EEH_Activation::delete_unused_db_table($wp_table_name);
602
+			} else if ( ! $deleted_safely) {
603 603
 				// so we should be more cautious rather than just dropping tables so easily
604 604
 				EE_Error::add_persistent_admin_notice(
605
-						'bad_table_' . $wp_table_name . '_detected',
606
-						sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
605
+						'bad_table_'.$wp_table_name.'_detected',
606
+						sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
607 607
 								$wp_table_name,
608 608
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
609 609
 								'<b>wp-config.php</b>',
@@ -612,25 +612,25 @@  discard block
 block discarded – undo
612 612
 			}
613 613
 		}
614 614
 		// does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns )
615
-		if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) {
615
+		if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) {
616 616
 			$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
617 617
 			//get $wpdb to echo errors, but buffer them. This way at least WE know an error
618 618
 			//happened. And then we can choose to tell the end user
619
-			$old_show_errors_policy = $wpdb->show_errors( TRUE );
620
-			$old_error_suppression_policy = $wpdb->suppress_errors( FALSE );
619
+			$old_show_errors_policy = $wpdb->show_errors(TRUE);
620
+			$old_error_suppression_policy = $wpdb->suppress_errors(FALSE);
621 621
 			ob_start();
622
-			dbDelta( $SQL );
622
+			dbDelta($SQL);
623 623
 			$output = ob_get_contents();
624 624
 			ob_end_clean();
625
-			$wpdb->show_errors( $old_show_errors_policy );
626
-			$wpdb->suppress_errors( $old_error_suppression_policy );
627
-			if( ! empty( $output ) ){
628
-				throw new EE_Error( $output	);
625
+			$wpdb->show_errors($old_show_errors_policy);
626
+			$wpdb->suppress_errors($old_error_suppression_policy);
627
+			if ( ! empty($output)) {
628
+				throw new EE_Error($output);
629 629
 			}
630 630
 		} else {
631 631
 			throw new EE_Error(
632 632
 				sprintf(
633
-					__( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ),
633
+					__('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'),
634 634
 					'<br />',
635 635
 					$sql
636 636
 				)
@@ -652,15 +652,15 @@  discard block
 block discarded – undo
652 652
 	 * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)'
653 653
 	 * @return bool|int
654 654
 	 */
655
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
656
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
655
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
656
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
657 657
 			return FALSE;
658 658
 		}
659 659
 		global $wpdb;
660
-		$full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
660
+		$full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
661 661
 		$fields = self::get_fields_on_table($table_name);
662
-		if (!in_array($column_name, $fields)){
663
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
662
+		if ( ! in_array($column_name, $fields)) {
663
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
664 664
 			//echo "alter query:$alter_query";
665 665
 			return $wpdb->query($alter_query);
666 666
 		}
@@ -679,15 +679,15 @@  discard block
 block discarded – undo
679 679
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
680 680
 	 * 	@return array of database column names
681 681
 	 */
682
-	public static function get_fields_on_table( $table_name = NULL ) {
682
+	public static function get_fields_on_table($table_name = NULL) {
683 683
 		global $wpdb;
684
-		$table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
685
-		if ( ! empty( $table_name )) {
684
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
685
+		if ( ! empty($table_name)) {
686 686
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
687 687
 			if ($columns !== FALSE) {
688 688
 				$field_array = array();
689
-				foreach($columns as $column ){
690
-					$field_array[] = $column->Field;;
689
+				foreach ($columns as $column) {
690
+					$field_array[] = $column->Field; ;
691 691
 				}
692 692
 				return $field_array;
693 693
 			}
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 	 * @param string $table_name
706 706
 	 * @return bool
707 707
 	 */
708
-	public static function db_table_is_empty( $table_name ) {
708
+	public static function db_table_is_empty($table_name) {
709 709
 		global $wpdb;
710
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
711
-		if ( EEH_Activation::table_exists( $table_name ) ) {
712
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
713
-			return absint( $count ) === 0 ? true : false;
710
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
711
+		if (EEH_Activation::table_exists($table_name)) {
712
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
713
+			return absint($count) === 0 ? true : false;
714 714
 		}
715 715
 		return false;
716 716
 	}
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
 	 * @param string $table_name
726 726
 	 * @return bool | int
727 727
 	 */
728
-	public static function delete_db_table_if_empty( $table_name ) {
729
-		if ( EEH_Activation::db_table_is_empty( $table_name ) ) {
730
-			return EEH_Activation::delete_unused_db_table( $table_name );
728
+	public static function delete_db_table_if_empty($table_name) {
729
+		if (EEH_Activation::db_table_is_empty($table_name)) {
730
+			return EEH_Activation::delete_unused_db_table($table_name);
731 731
 		}
732 732
 		return false;
733 733
 	}
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	 * @param string $table_name
743 743
 	 * @return bool | int
744 744
 	 */
745
-	public static function delete_unused_db_table( $table_name ) {
745
+	public static function delete_unused_db_table($table_name) {
746 746
 		global $wpdb;
747
-		if ( EEH_Activation::table_exists( $table_name ) ) {
748
-			$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
749
-			return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
747
+		if (EEH_Activation::table_exists($table_name)) {
748
+			$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
749
+			return $wpdb->query("DROP TABLE IF EXISTS $table_name");
750 750
 		}
751 751
 		return false;
752 752
 	}
@@ -762,18 +762,18 @@  discard block
 block discarded – undo
762 762
 	 * @param string $index_name
763 763
 	 * @return bool | int
764 764
 	 */
765
-	public static function drop_index( $table_name, $index_name ) {
766
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
765
+	public static function drop_index($table_name, $index_name) {
766
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
767 767
 			return FALSE;
768 768
 		}
769 769
 		global $wpdb;
770
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
770
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
771 771
 		$index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'";
772 772
 		if (
773
-			$wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name
774
-			&& $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name
773
+			$wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name
774
+			&& $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name
775 775
 		) {
776
-			return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" );
776
+			return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name");
777 777
 		}
778 778
 		return TRUE;
779 779
 	}
@@ -789,27 +789,27 @@  discard block
 block discarded – undo
789 789
 	 * @return boolean success (whether database is setup properly or not)
790 790
 	 */
791 791
 	public static function create_database_tables() {
792
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
792
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
793 793
 		//find the migration script that sets the database to be compatible with the code
794 794
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
795
-		if( $dms_name ){
796
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
797
-			$current_data_migration_script->set_migrating( false );
795
+		if ($dms_name) {
796
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
797
+			$current_data_migration_script->set_migrating(false);
798 798
 			$current_data_migration_script->schema_changes_before_migration();
799 799
 			$current_data_migration_script->schema_changes_after_migration();
800
-			if( $current_data_migration_script->get_errors() ){
801
-				if( WP_DEBUG ){
802
-					foreach( $current_data_migration_script->get_errors() as $error ){
803
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
800
+			if ($current_data_migration_script->get_errors()) {
801
+				if (WP_DEBUG) {
802
+					foreach ($current_data_migration_script->get_errors() as $error) {
803
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
804 804
 					}
805
-				}else{
806
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
805
+				} else {
806
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
807 807
 				}
808 808
 				return false;
809 809
 			}
810 810
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
811
-		}else{
812
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
811
+		} else {
812
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
813 813
 			return false;
814 814
 		}
815 815
 		return true;
@@ -829,27 +829,27 @@  discard block
 block discarded – undo
829 829
 	public static function initialize_system_questions() {
830 830
 		// QUESTION GROUPS
831 831
 		global $wpdb;
832
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' );
832
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group');
833 833
 		$SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0";
834 834
 		// what we have
835
-		$question_groups = $wpdb->get_col( $SQL );
835
+		$question_groups = $wpdb->get_col($SQL);
836 836
 		// check the response
837
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
837
+		$question_groups = is_array($question_groups) ? $question_groups : array();
838 838
 		// what we should have
839
-		$QSG_systems = array( 1, 2 );
839
+		$QSG_systems = array(1, 2);
840 840
 		// loop thru what we should have and compare to what we have
841
-		foreach ( $QSG_systems as $QSG_system ) {
841
+		foreach ($QSG_systems as $QSG_system) {
842 842
 			// reset values array
843 843
 			$QSG_values = array();
844 844
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
845
-			if ( ! in_array( "$QSG_system", $question_groups )) {
845
+			if ( ! in_array("$QSG_system", $question_groups)) {
846 846
 				// add it
847
-				switch ( $QSG_system ) {
847
+				switch ($QSG_system) {
848 848
 
849 849
 					case 1:
850 850
 							$QSG_values = array(
851
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
852
-									'QSG_identifier' => 'personal-information-' . time(),
851
+									'QSG_name' => __('Personal Information', 'event_espresso'),
852
+									'QSG_identifier' => 'personal-information-'.time(),
853 853
 									'QSG_desc' => '',
854 854
 									'QSG_order' => 1,
855 855
 									'QSG_show_group_name' => 1,
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 
862 862
 					case 2:
863 863
 							$QSG_values = array(
864
-									'QSG_name' => __( 'Address Information','event_espresso' ),
865
-									'QSG_identifier' => 'address-information-' . time(),
864
+									'QSG_name' => __('Address Information', 'event_espresso'),
865
+									'QSG_identifier' => 'address-information-'.time(),
866 866
 									'QSG_desc' => '',
867 867
 									'QSG_order' => 2,
868 868
 									'QSG_show_group_name' => 1,
@@ -874,14 +874,14 @@  discard block
 block discarded – undo
874 874
 
875 875
 				}
876 876
 				// make sure we have some values before inserting them
877
-				if ( ! empty( $QSG_values )) {
877
+				if ( ! empty($QSG_values)) {
878 878
 					// insert system question
879 879
 					$wpdb->insert(
880 880
 						$table_name,
881 881
 						$QSG_values,
882
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
882
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
883 883
 					);
884
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
884
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
885 885
 				}
886 886
 			}
887 887
 		}
@@ -890,10 +890,10 @@  discard block
 block discarded – undo
890 890
 
891 891
 		// QUESTIONS
892 892
 		global $wpdb;
893
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' );
893
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question');
894 894
 		$SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''";
895 895
 		// what we have
896
-		$questions = $wpdb->get_col( $SQL );
896
+		$questions = $wpdb->get_col($SQL);
897 897
 		// what we should have
898 898
 		$QST_systems = array(
899 899
 			'fname',
@@ -910,22 +910,22 @@  discard block
 block discarded – undo
910 910
 		$order_for_group_1 = 1;
911 911
 		$order_for_group_2 = 1;
912 912
 		// loop thru what we should have and compare to what we have
913
-		foreach ( $QST_systems as $QST_system ) {
913
+		foreach ($QST_systems as $QST_system) {
914 914
 			// reset values array
915 915
 			$QST_values = array();
916 916
 			// if we don't have what we should have
917
-			if ( ! in_array( $QST_system, $questions )) {
917
+			if ( ! in_array($QST_system, $questions)) {
918 918
 				// add it
919
-				switch ( $QST_system ) {
919
+				switch ($QST_system) {
920 920
 
921 921
 					case 'fname':
922 922
 							$QST_values = array(
923
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
924
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
923
+									'QST_display_text' => __('First Name', 'event_espresso'),
924
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
925 925
 									'QST_system' => 'fname',
926 926
 									'QST_type' => 'TEXT',
927 927
 									'QST_required' => 1,
928
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
928
+									'QST_required_text' => __('This field is required', 'event_espresso'),
929 929
 									'QST_order' => 1,
930 930
 									'QST_admin_only' => 0,
931 931
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -935,12 +935,12 @@  discard block
 block discarded – undo
935 935
 
936 936
 					case 'lname':
937 937
 							$QST_values = array(
938
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
939
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
938
+									'QST_display_text' => __('Last Name', 'event_espresso'),
939
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
940 940
 									'QST_system' => 'lname',
941 941
 									'QST_type' => 'TEXT',
942 942
 									'QST_required' => 1,
943
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
943
+									'QST_required_text' => __('This field is required', 'event_espresso'),
944 944
 									'QST_order' => 2,
945 945
 									'QST_admin_only' => 0,
946 946
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -950,12 +950,12 @@  discard block
 block discarded – undo
950 950
 
951 951
 					case 'email':
952 952
 							$QST_values = array(
953
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
954
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
953
+									'QST_display_text' => __('Email Address', 'event_espresso'),
954
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
955 955
 									'QST_system' => 'email',
956 956
 									'QST_type' => 'TEXT',
957 957
 									'QST_required' => 1,
958
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
958
+									'QST_required_text' => __('This field is required', 'event_espresso'),
959 959
 									'QST_order' => 3,
960 960
 									'QST_admin_only' => 0,
961 961
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -965,12 +965,12 @@  discard block
 block discarded – undo
965 965
 
966 966
 					case 'address':
967 967
 							$QST_values = array(
968
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
969
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
968
+									'QST_display_text' => __('Address', 'event_espresso'),
969
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
970 970
 									'QST_system' => 'address',
971 971
 									'QST_type' => 'TEXT',
972 972
 									'QST_required' => 0,
973
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
973
+									'QST_required_text' => __('This field is required', 'event_espresso'),
974 974
 									'QST_order' => 4,
975 975
 									'QST_admin_only' => 0,
976 976
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
 
981 981
 					case 'address2':
982 982
 							$QST_values = array(
983
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
984
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
983
+									'QST_display_text' => __('Address2', 'event_espresso'),
984
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
985 985
 									'QST_system' => 'address2',
986 986
 									'QST_type' => 'TEXT',
987 987
 									'QST_required' => 0,
988
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
988
+									'QST_required_text' => __('This field is required', 'event_espresso'),
989 989
 									'QST_order' => 5,
990 990
 									'QST_admin_only' => 0,
991 991
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -995,12 +995,12 @@  discard block
 block discarded – undo
995 995
 
996 996
 					case 'city':
997 997
 							$QST_values = array(
998
-									'QST_display_text' => __( 'City', 'event_espresso' ),
999
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
998
+									'QST_display_text' => __('City', 'event_espresso'),
999
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
1000 1000
 									'QST_system' => 'city',
1001 1001
 									'QST_type' => 'TEXT',
1002 1002
 									'QST_required' => 0,
1003
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1003
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1004 1004
 									'QST_order' => 6,
1005 1005
 									'QST_admin_only' => 0,
1006 1006
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1010,12 +1010,12 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
 					case 'state':
1012 1012
 							$QST_values = array(
1013
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
1014
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
1013
+									'QST_display_text' => __('State/Province', 'event_espresso'),
1014
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
1015 1015
 									'QST_system' => 'state',
1016 1016
 									'QST_type' => 'STATE',
1017 1017
 									'QST_required' => 0,
1018
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1018
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1019 1019
 									'QST_order' => 7,
1020 1020
 									'QST_admin_only' => 0,
1021 1021
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1025,12 +1025,12 @@  discard block
 block discarded – undo
1025 1025
 
1026 1026
 					case 'country' :
1027 1027
 							$QST_values = array(
1028
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
1029
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
1028
+									'QST_display_text' => __('Country', 'event_espresso'),
1029
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
1030 1030
 									'QST_system' => 'country',
1031 1031
 									'QST_type' => 'COUNTRY',
1032 1032
 									'QST_required' => 0,
1033
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1033
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1034 1034
 									'QST_order' => 8,
1035 1035
 									'QST_admin_only' => 0,
1036 1036
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1040,12 +1040,12 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
 					case 'zip':
1042 1042
 							$QST_values = array(
1043
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
1044
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
1043
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
1044
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
1045 1045
 									'QST_system' => 'zip',
1046 1046
 									'QST_type' => 'TEXT',
1047 1047
 									'QST_required' => 0,
1048
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1048
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1049 1049
 									'QST_order' => 9,
1050 1050
 									'QST_admin_only' => 0,
1051 1051
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
 					case 'phone':
1057 1057
 							$QST_values = array(
1058
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
1059
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
1058
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
1059
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
1060 1060
 									'QST_system' => 'phone',
1061 1061
 									'QST_type' => 'TEXT',
1062 1062
 									'QST_required' => 0,
1063
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1063
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1064 1064
 									'QST_order' => 10,
1065 1065
 									'QST_admin_only' => 0,
1066 1066
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1069,34 +1069,34 @@  discard block
 block discarded – undo
1069 1069
 						break;
1070 1070
 
1071 1071
 				}
1072
-				if ( ! empty( $QST_values )) {
1072
+				if ( ! empty($QST_values)) {
1073 1073
 					// insert system question
1074 1074
 					$wpdb->insert(
1075 1075
 						$table_name,
1076 1076
 						$QST_values,
1077
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
1077
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
1078 1078
 					);
1079 1079
 					$QST_ID = $wpdb->insert_id;
1080 1080
 
1081 1081
 					// QUESTION GROUP QUESTIONS
1082
-					if(  in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) {
1082
+					if (in_array($QST_system, array('fname', 'lname', 'email'))) {
1083 1083
 						$system_question_we_want = EEM_Question_Group::system_personal;
1084 1084
 					} else {
1085 1085
 						$system_question_we_want = EEM_Question_Group::system_address;
1086 1086
 					}
1087
-					if( isset( $QSG_IDs[ $system_question_we_want ] ) ) {
1088
-						$QSG_ID = $QSG_IDs[ $system_question_we_want ];
1087
+					if (isset($QSG_IDs[$system_question_we_want])) {
1088
+						$QSG_ID = $QSG_IDs[$system_question_we_want];
1089 1089
 					} else {
1090
-						$id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) );
1091
-						if( is_array( $id_col ) ) {
1092
-							$QSG_ID = reset( $id_col );
1090
+						$id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want)));
1091
+						if (is_array($id_col)) {
1092
+							$QSG_ID = reset($id_col);
1093 1093
 						} else {
1094 1094
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1095 1095
                                                         EE_Log::instance()->log( 
1096 1096
                                                                 __FILE__, 
1097 1097
                                                                 __FUNCTION__, 
1098 1098
                                                                 sprintf( 
1099
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1099
+                                                                        __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100 1100
                                                                         $QST_ID ), 
1101 1101
                                                                 'error' );
1102 1102
                                                         continue;
@@ -1105,9 +1105,9 @@  discard block
 block discarded – undo
1105 1105
                                         
1106 1106
 					// add system questions to groups
1107 1107
 					$wpdb->insert(
1108
-						EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ),
1109
-						array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ),
1110
-						array( '%d', '%d','%d' )
1108
+						EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'),
1109
+						array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++),
1110
+						array('%d', '%d', '%d')
1111 1111
 					);
1112 1112
 				}
1113 1113
 			}
@@ -1119,11 +1119,11 @@  discard block
 block discarded – undo
1119 1119
 	 * Makes sure the default payment method (Invoice) is active.
1120 1120
 	 * This used to be done automatically as part of constructing the old gateways config
1121 1121
 	 */
1122
-	public static function insert_default_payment_methods(){
1123
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1124
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1125
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1126
-		}else{
1122
+	public static function insert_default_payment_methods() {
1123
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
1124
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
1125
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
1126
+		} else {
1127 1127
 			EEM_Payment_Method::instance()->verify_button_urls();
1128 1128
 		}
1129 1129
 	}
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 
1140 1140
 		global $wpdb;
1141 1141
 
1142
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
1142
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
1143 1143
 
1144 1144
 			$table_name = EEM_Status::instance()->table();
1145 1145
 
@@ -1205,38 +1205,38 @@  discard block
 block discarded – undo
1205 1205
 	 * 	@return boolean success of verifying upload directories exist
1206 1206
 	 */
1207 1207
 	public static function create_upload_directories() {
1208
-		EE_Registry::instance()->load_helper( 'File' );
1208
+		EE_Registry::instance()->load_helper('File');
1209 1209
 		// Create the required folders
1210 1210
 		$folders = array(
1211 1211
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1212 1212
 				EVENT_ESPRESSO_GATEWAY_DIR,
1213
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs/',
1214
-				EVENT_ESPRESSO_UPLOAD_DIR . 'css/',
1215
-				EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/'
1213
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs/',
1214
+				EVENT_ESPRESSO_UPLOAD_DIR.'css/',
1215
+				EVENT_ESPRESSO_UPLOAD_DIR.'tickets/'
1216 1216
 		);
1217
-		foreach ( $folders as $folder ) {
1217
+		foreach ($folders as $folder) {
1218 1218
 			try {
1219
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1220
-				@ chmod( $folder, 0755 );
1221
-			} catch( EE_Error $e ){
1219
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1220
+				@ chmod($folder, 0755);
1221
+			} catch (EE_Error $e) {
1222 1222
 				EE_Error::add_error(
1223 1223
 					sprintf(
1224
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1224
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1225 1225
 						$folder,
1226
-						'<br />' . $e->getMessage()
1226
+						'<br />'.$e->getMessage()
1227 1227
 					),
1228 1228
 					__FILE__, __FUNCTION__, __LINE__
1229 1229
 				);
1230 1230
 				//indicate we'll need to fix this later
1231
-				update_option( EEH_Activation::upload_directories_incomplete_option_name, true );
1231
+				update_option(EEH_Activation::upload_directories_incomplete_option_name, true);
1232 1232
 				return FALSE;
1233 1233
 			}
1234 1234
 		}
1235 1235
 		//just add the .htaccess file to the logs directory to begin with. Even if logging
1236 1236
 		//is disabled, there might be activation errors recorded in there
1237
-		EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' );
1237
+		EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/');
1238 1238
 		//remember EE's folders are all good
1239
-		delete_option( EEH_Activation::upload_directories_incomplete_option_name );
1239
+		delete_option(EEH_Activation::upload_directories_incomplete_option_name);
1240 1240
 		return TRUE;
1241 1241
 	}
1242 1242
 	
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 	 * @return boolean
1250 1250
 	 */
1251 1251
 	public static function upload_directories_incomplete() {
1252
-		return get_option( EEH_Activation::upload_directories_incomplete_option_name, false );
1252
+		return get_option(EEH_Activation::upload_directories_incomplete_option_name, false);
1253 1253
 	}
1254 1254
 
1255 1255
 
@@ -1268,16 +1268,16 @@  discard block
 block discarded – undo
1268 1268
 		$installed_messengers = $default_messengers = array();
1269 1269
 
1270 1270
 		//include our helper
1271
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1271
+		EE_Registry::instance()->load_helper('MSG_Template');
1272 1272
 
1273 1273
 		//get all installed messenger objects
1274 1274
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1275 1275
 
1276 1276
 		//let's setup the $installed messengers in an array AND the messengers that are set to be activated on install.
1277
-		foreach ( $installed['messengers'] as $msgr ) {
1278
-			if ( $msgr instanceof EE_messenger ) {
1277
+		foreach ($installed['messengers'] as $msgr) {
1278
+			if ($msgr instanceof EE_messenger) {
1279 1279
 				$installed_messengers[$msgr->name] = $msgr;
1280
-				if ( $msgr->activate_on_install ) {
1280
+				if ($msgr->activate_on_install) {
1281 1281
 					$default_messengers[] = $msgr->name;
1282 1282
 				}
1283 1283
 			}
@@ -1287,36 +1287,36 @@  discard block
 block discarded – undo
1287 1287
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1288 1288
 
1289 1289
 		//things that have already been activated before
1290
-		$has_activated = get_option( 'ee_has_activated_messenger' );
1290
+		$has_activated = get_option('ee_has_activated_messenger');
1291 1291
 
1292 1292
 		//do an initial loop to determine if we need to continue
1293 1293
 		$def_ms = array();
1294
-		foreach ( $default_messengers as $msgr ) {
1295
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1294
+		foreach ($default_messengers as $msgr) {
1295
+			if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue;
1296 1296
 			$def_ms[] = $msgr;
1297 1297
 		}
1298 1298
 
1299 1299
 		//setup the $installed_mts in an array
1300
-		foreach ( $installed['message_types'] as $imt ) {
1301
-			if ( $imt instanceof EE_message_type ) {
1300
+		foreach ($installed['message_types'] as $imt) {
1301
+			if ($imt instanceof EE_message_type) {
1302 1302
 				$installed_mts[$imt->name] = $imt;
1303 1303
 			}
1304 1304
 		}
1305 1305
 
1306 1306
 		//loop through default array for default messengers (if present)
1307
-		if ( ! empty( $def_ms ) ) {
1308
-			foreach ( $def_ms as $messenger ) {
1307
+		if ( ! empty($def_ms)) {
1308
+			foreach ($def_ms as $messenger) {
1309 1309
 				//all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger.
1310
-				if ( ! isset( $installed_messengers[$messenger] )) {
1310
+				if ( ! isset($installed_messengers[$messenger])) {
1311 1311
 					continue;
1312 1312
 				}
1313 1313
 				/** @var EE_messenger[] $installed_messengers  */
1314 1314
 				$default_mts = $installed_messengers[$messenger]->get_default_message_types();
1315 1315
 				$active_messengers[$messenger]['obj'] = $installed_messengers[$messenger];
1316
-				foreach ( $default_mts as $index => $mt ) {
1316
+				foreach ($default_mts as $index => $mt) {
1317 1317
 					//is there an installed_mt matching the default string?  If not then nothing to do here.
1318
-					if ( ! isset( $installed_mts[$mt] ) ) {
1319
-						unset( $default_mts[$index] );
1318
+					if ( ! isset($installed_mts[$mt])) {
1319
+						unset($default_mts[$index]);
1320 1320
 						continue;
1321 1321
 					}
1322 1322
 
@@ -1325,41 +1325,41 @@  discard block
 block discarded – undo
1325 1325
 					/** @var EE_message_type[] $installed_mts */
1326 1326
 					$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1327 1327
 					$settings = array();
1328
-					if ( is_array( $settings_fields ) ) {
1329
-						foreach ( $settings_fields as $field => $values ) {
1330
-							if ( isset( $values['default'] ) ) {
1328
+					if (is_array($settings_fields)) {
1329
+						foreach ($settings_fields as $field => $values) {
1330
+							if (isset($values['default'])) {
1331 1331
 								$settings[$field] = $values['default'];
1332 1332
 							}
1333 1333
 						}
1334 1334
 					}
1335 1335
 
1336
-					$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1336
+					$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1337 1337
 					$has_activated[$messenger][] = $mt;
1338 1338
 				}
1339 1339
 
1340 1340
 				//setup any initial settings for the messenger
1341 1341
 				$msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields();
1342 1342
 
1343
-				if ( !empty( $msgr_settings ) ) {
1344
-					foreach ( $msgr_settings as $field => $value ) {
1343
+				if ( ! empty($msgr_settings)) {
1344
+					foreach ($msgr_settings as $field => $value) {
1345 1345
 						$active_messengers[$messenger]['settings'][$field] = $value;
1346 1346
 					}
1347 1347
 				}
1348 1348
 
1349 1349
 				//now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate.
1350
-				EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1350
+				EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1351 1351
 
1352 1352
 				//let's generate all the templates but only if the messenger has default_mts (otherwise its just activated).
1353
-				if ( !empty( $default_mts ) ) {
1354
-					$success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE );
1353
+				if ( ! empty($default_mts)) {
1354
+					$success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE);
1355 1355
 				}
1356 1356
 			}
1357 1357
 		} //end check for empty( $def_ms )
1358 1358
 
1359 1359
 		//still need to see if there are any message types to activate for active messengers
1360
-		foreach ( $active_messengers as $messenger => $settings ) {
1360
+		foreach ($active_messengers as $messenger => $settings) {
1361 1361
 			$msg_obj = $settings['obj'];
1362
-			if ( ! $msg_obj instanceof EE_messenger ) {
1362
+			if ( ! $msg_obj instanceof EE_messenger) {
1363 1363
 				continue;
1364 1364
 			}
1365 1365
 
@@ -1367,45 +1367,45 @@  discard block
 block discarded – undo
1367 1367
 			$new_default_mts = array();
1368 1368
 
1369 1369
 			//loop through each default mt reported by the messenger and make sure its set in its active db entry.
1370
-			foreach( $all_default_mts as $index => $mt ) {
1370
+			foreach ($all_default_mts as $index => $mt) {
1371 1371
 				//already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated).
1372
-				if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ||  EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) {
1372
+				if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) {
1373 1373
 					continue;
1374 1374
 				}
1375 1375
 
1376 1376
 				//is there an installed_mt matching the default string?  If not then nothing to do here.
1377
-				if ( ! isset( $installed_mts[$mt] ) ) {
1378
-					unset( $all_default_mts[$mt] );
1377
+				if ( ! isset($installed_mts[$mt])) {
1378
+					unset($all_default_mts[$mt]);
1379 1379
 					continue;
1380 1380
 				}
1381 1381
 
1382 1382
 				$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1383 1383
 				$settings = array();
1384
-				if ( is_array( $settings_fields ) ) {
1385
-					foreach ( $settings_fields as $field => $values ) {
1386
-						if ( isset( $values['default'] ) ) {
1384
+				if (is_array($settings_fields)) {
1385
+					foreach ($settings_fields as $field => $values) {
1386
+						if (isset($values['default'])) {
1387 1387
 							$settings[$field] = $values['default'];
1388 1388
 						}
1389 1389
 					}
1390 1390
 				}
1391 1391
 
1392
-				$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1392
+				$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1393 1393
 				$new_default_mts[] = $mt;
1394 1394
 				$has_activated[$messenger][] = $mt;
1395 1395
 			}
1396 1396
 
1397 1397
 
1398
-			if ( ! empty( $new_default_mts ) ) {
1399
-				$success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE );
1398
+			if ( ! empty($new_default_mts)) {
1399
+				$success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE);
1400 1400
 			}
1401 1401
 
1402 1402
 		}
1403 1403
 
1404 1404
 		//now let's save the settings for this messenger!
1405
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1405
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1406 1406
 
1407 1407
 		//update $has_activated record
1408
-		update_option( 'ee_has_activated_messenger', $has_activated );
1408
+		update_option('ee_has_activated_messenger', $has_activated);
1409 1409
 
1410 1410
 		//that's it!
1411 1411
 		return $success;
@@ -1425,47 +1425,47 @@  discard block
 block discarded – undo
1425 1425
 	 */
1426 1426
 	public static function validate_messages_system() {
1427 1427
 		//include our helper
1428
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1428
+		EE_Registry::instance()->load_helper('MSG_Template');
1429 1429
 
1430 1430
 		//get active and installed  messengers/message types.
1431 1431
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1432 1432
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1433 1433
 		$installed_messengers = $installed_mts = array();
1434 1434
 		//set up the arrays so they can be handled easier.
1435
-		foreach( $installed['messengers'] as $im ) {
1436
-			if ( $im instanceof EE_messenger ) {
1435
+		foreach ($installed['messengers'] as $im) {
1436
+			if ($im instanceof EE_messenger) {
1437 1437
 				$installed_messengers[$im->name] = $im;
1438 1438
 			}
1439 1439
 		}
1440
-		foreach( $installed['message_types'] as $imt ) {
1441
-			if ( $imt instanceof EE_message_type ) {
1440
+		foreach ($installed['message_types'] as $imt) {
1441
+			if ($imt instanceof EE_message_type) {
1442 1442
 				$installed_mts[$imt->name] = $imt;
1443 1443
 			}
1444 1444
 		}
1445 1445
 
1446 1446
 		//now let's loop through the active array and validate
1447
-		foreach( $active_messengers as $messenger => $active_details ) {
1447
+		foreach ($active_messengers as $messenger => $active_details) {
1448 1448
 			//first let's see if this messenger is installed.
1449
-			if ( ! isset( $installed_messengers[$messenger] ) ) {
1449
+			if ( ! isset($installed_messengers[$messenger])) {
1450 1450
 				//not set so let's just remove from actives and make sure templates are inactive.
1451
-				unset( $active_messengers[$messenger] );
1452
-				EEH_MSG_Template::update_to_inactive( $messenger );
1451
+				unset($active_messengers[$messenger]);
1452
+				EEH_MSG_Template::update_to_inactive($messenger);
1453 1453
 				continue;
1454 1454
 			}
1455 1455
 
1456 1456
 			//messenger is active, so let's just make sure that any active message types not installed are deactivated.
1457
-			$mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array();
1458
-			foreach ( $mts as $mt_name => $mt ) {
1459
-				if ( ! isset( $installed_mts[$mt_name] )  ) {
1460
-					unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] );
1461
-					EEH_MSG_Template::update_to_inactive( $messenger, $mt_name );
1457
+			$mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array();
1458
+			foreach ($mts as $mt_name => $mt) {
1459
+				if ( ! isset($installed_mts[$mt_name])) {
1460
+					unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]);
1461
+					EEH_MSG_Template::update_to_inactive($messenger, $mt_name);
1462 1462
 				}
1463 1463
 			}
1464 1464
 		}
1465 1465
 
1466 1466
 		//all done! let's update the active_messengers.
1467
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1468
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1467
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1468
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1469 1469
 		return;
1470 1470
 	}
1471 1471
 
@@ -1479,12 +1479,12 @@  discard block
 block discarded – undo
1479 1479
 	 * 	@static
1480 1480
 	 * 	@return void
1481 1481
 	 */
1482
-	public static function create_no_ticket_prices_array(){
1482
+	public static function create_no_ticket_prices_array() {
1483 1483
 		// this creates an array for tracking events that have no active ticket prices created
1484 1484
 		// this allows us to warn admins of the situation so that it can be corrected
1485
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1486
-		if ( ! $espresso_no_ticket_prices ) {
1487
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1485
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1486
+		if ( ! $espresso_no_ticket_prices) {
1487
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1488 1488
 		}
1489 1489
 	}
1490 1490
 
@@ -1506,24 +1506,24 @@  discard block
 block discarded – undo
1506 1506
 	 * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/
1507 1507
 	 * @global wpdb $wpdb
1508 1508
 	 */
1509
-	public static function delete_all_espresso_cpt_data(){
1509
+	public static function delete_all_espresso_cpt_data() {
1510 1510
 		global $wpdb;
1511 1511
 		//get all the CPT post_types
1512 1512
 		$ee_post_types = array();
1513
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1514
-			if ( method_exists( $model_name, 'instance' )) {
1515
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1516
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1517
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1513
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1514
+			if (method_exists($model_name, 'instance')) {
1515
+				$model_obj = call_user_func(array($model_name, 'instance'));
1516
+				if ($model_obj instanceof EEM_CPT_Base) {
1517
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1518 1518
 				}
1519 1519
 			}
1520 1520
 		}
1521 1521
 		//get all our CPTs
1522
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1522
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1523 1523
 		$cpt_ids = $wpdb->get_col($query);
1524 1524
 		//delete each post meta and term relations too
1525
-		foreach($cpt_ids as $post_id){
1526
-			wp_delete_post($post_id,true);
1525
+		foreach ($cpt_ids as $post_id) {
1526
+			wp_delete_post($post_id, true);
1527 1527
 		}
1528 1528
 	}
1529 1529
 
@@ -1537,18 +1537,18 @@  discard block
 block discarded – undo
1537 1537
 	 * @param bool $remove_all
1538 1538
 	 * @return void
1539 1539
 	 */
1540
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1540
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1541 1541
 		global $wpdb;
1542 1542
 		$undeleted_tables = array();
1543 1543
 
1544 1544
 		// load registry
1545
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1546
-			if ( method_exists( $model_name, 'instance' )) {
1547
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1548
-				if ( $model_obj instanceof EEM_Base ) {
1549
-					foreach ( $model_obj->get_tables() as $table ) {
1550
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1551
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1545
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1546
+			if (method_exists($model_name, 'instance')) {
1547
+				$model_obj = call_user_func(array($model_name, 'instance'));
1548
+				if ($model_obj instanceof EEM_Base) {
1549
+					foreach ($model_obj->get_tables() as $table) {
1550
+						if (strpos($table->get_table_name(), 'esp_')) {
1551
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1552 1552
 								case false :
1553 1553
 									$undeleted_tables[] = $table->get_table_name();
1554 1554
 								break;
@@ -1573,8 +1573,8 @@  discard block
 block discarded – undo
1573 1573
 			'esp_promotion_rule',
1574 1574
 			'esp_rule'
1575 1575
 		);
1576
-		foreach( $tables_without_models as $table ){
1577
-			EEH_Activation::delete_db_table_if_empty( $table );
1576
+		foreach ($tables_without_models as $table) {
1577
+			EEH_Activation::delete_db_table_if_empty($table);
1578 1578
 		}
1579 1579
 
1580 1580
 
@@ -1611,58 +1611,58 @@  discard block
 block discarded – undo
1611 1611
 			'ee_pers_admin_notices' => true,
1612 1612
 			'ee_upload_directories_incomplete' => true,
1613 1613
 		);
1614
-		if( is_main_site() ) {
1615
-			$wp_options_to_delete[ 'ee_network_config' ] = true;
1614
+		if (is_main_site()) {
1615
+			$wp_options_to_delete['ee_network_config'] = true;
1616 1616
 		}
1617 1617
 
1618 1618
 		$undeleted_options = array();
1619
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1619
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1620 1620
 
1621
-			if( $no_wildcard ){
1622
-				if( ! delete_option( $option_name ) ){
1621
+			if ($no_wildcard) {
1622
+				if ( ! delete_option($option_name)) {
1623 1623
 					$undeleted_options[] = $option_name;
1624 1624
 				}
1625
-			}else{
1626
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1627
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1628
-					if( ! delete_option( $option_name_from_wildcard ) ){
1625
+			} else {
1626
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1627
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1628
+					if ( ! delete_option($option_name_from_wildcard)) {
1629 1629
 						$undeleted_options[] = $option_name_from_wildcard;
1630 1630
 					}
1631 1631
 				}
1632 1632
 			}
1633 1633
 		}
1634 1634
                 //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1635
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1635
+                remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10);
1636 1636
 
1637
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1637
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1638 1638
 			$db_update_sans_ee4 = array();
1639
-			foreach($espresso_db_update as $version => $times_activated){
1640
-				if( $version[0] =='3'){//if its NON EE4
1639
+			foreach ($espresso_db_update as $version => $times_activated) {
1640
+				if ($version[0] == '3') {//if its NON EE4
1641 1641
 					$db_update_sans_ee4[$version] = $times_activated;
1642 1642
 				}
1643 1643
 			}
1644
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1644
+			update_option('espresso_db_update', $db_update_sans_ee4);
1645 1645
 		}
1646 1646
 
1647 1647
 		$errors = '';
1648
-		if ( ! empty( $undeleted_tables )) {
1648
+		if ( ! empty($undeleted_tables)) {
1649 1649
 			$errors .= sprintf(
1650
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1650
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1651 1651
 				'<br/>',
1652
-				implode( ',<br/>', $undeleted_tables )
1652
+				implode(',<br/>', $undeleted_tables)
1653 1653
 			);
1654 1654
 		}
1655
-		if ( ! empty( $undeleted_options )) {
1656
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1655
+		if ( ! empty($undeleted_options)) {
1656
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1657 1657
 			$errors .= sprintf(
1658
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1658
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1659 1659
 				'<br/>',
1660
-				implode( ',<br/>', $undeleted_options )
1660
+				implode(',<br/>', $undeleted_options)
1661 1661
 			);
1662 1662
 
1663 1663
 		}
1664
-		if ( $errors != '' ) {
1665
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1664
+		if ($errors != '') {
1665
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1666 1666
 		}
1667 1667
 	}
1668 1668
 
@@ -1672,23 +1672,23 @@  discard block
 block discarded – undo
1672 1672
 	 * @param string $table_name with or without $wpdb->prefix
1673 1673
 	 * @return boolean
1674 1674
 	 */
1675
-	public static function table_exists( $table_name ){
1675
+	public static function table_exists($table_name) {
1676 1676
 		global $wpdb, $EZSQL_ERROR;
1677
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
1677
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
1678 1678
 		//ignore if this causes an sql error
1679 1679
 		$old_error = $wpdb->last_error;
1680 1680
 		$old_suppress_errors = $wpdb->suppress_errors();
1681
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1681
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1682 1682
 		$ezsql_error_cache = $EZSQL_ERROR;
1683
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1684
-		$wpdb->show_errors( $old_show_errors_value );
1685
-		$wpdb->suppress_errors( $old_suppress_errors );
1683
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1684
+		$wpdb->show_errors($old_show_errors_value);
1685
+		$wpdb->suppress_errors($old_suppress_errors);
1686 1686
 		$new_error = $wpdb->last_error;
1687 1687
 		$wpdb->last_error = $old_error;
1688 1688
 		$EZSQL_ERROR = $ezsql_error_cache;
1689
-		if( empty( $new_error ) ){
1689
+		if (empty($new_error)) {
1690 1690
 			return TRUE;
1691
-		}else{
1691
+		} else {
1692 1692
 			return FALSE;
1693 1693
 		}
1694 1694
 	}
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 	/**
1697 1697
 	 * Resets the cache on EEH_Activation
1698 1698
 	 */
1699
-	public static function reset(){
1699
+	public static function reset() {
1700 1700
 		self::$_default_creator_id = NULL;
1701 1701
 		self::$_initialized_db_content_already_in_this_request = false;
1702 1702
 	}
Please login to merge, or discard this patch.
core/EE_Config.core.php 2 patches
Spacing   +400 added lines, -400 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public static function instance() {
130 130
 		// check if class object is instantiated, and instantiated properly
131
-		if ( ! self::$_instance instanceof EE_Config ) {
131
+		if ( ! self::$_instance instanceof EE_Config) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
 	 * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode)
146 146
 	 * @return EE_Config
147 147
 	 */
148
-	public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){
149
-		if ( $hard_reset ) {
148
+	public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) {
149
+		if ($hard_reset) {
150 150
 			self::$_instance->_config_option_names = array();
151 151
 			self::$_instance->_initialize_config();
152 152
 			self::$_instance->update_espresso_config();
153 153
 		}
154
-		if( self::$_instance instanceof EE_Config ){
154
+		if (self::$_instance instanceof EE_Config) {
155 155
 			self::$_instance->shutdown();
156 156
 		}
157 157
 		self::$_instance = NULL;
158 158
 		//we don't need to reset the static properties imo because those should
159 159
 		//only change when a module is added or removed. Currently we don't
160 160
 		//support removing a module during a request when it previously existed
161
-		if( $reinstantiate ){
161
+		if ($reinstantiate) {
162 162
 			return self::instance();
163
-		}else{
163
+		} else {
164 164
 			return NULL;
165 165
 		}
166 166
 	}
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @return \EE_Config
175 175
 	 */
176 176
 	private function __construct() {
177
-		do_action( 'AHEE__EE_Config__construct__begin',$this );
178
-		$this->_config_option_names = get_option( 'ee_config_option_names', array() );
177
+		do_action('AHEE__EE_Config__construct__begin', $this);
178
+		$this->_config_option_names = get_option('ee_config_option_names', array());
179 179
 		// setup empty config classes
180 180
 		$this->_initialize_config();
181 181
 		// load existing EE site settings
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 		// confirm everything loaded correctly and set filtered defaults if not
184 184
 		$this->_verify_config();
185 185
 		//  register shortcodes and modules
186
-		add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 );
186
+		add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999);
187 187
 		//  initialize shortcodes and modules
188
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ));
188
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
189 189
 		// register widgets
190
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
190
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
191 191
 		// shutdown
192
-		add_action( 'shutdown', array( $this, 'shutdown' ), 10 );
192
+		add_action('shutdown', array($this, 'shutdown'), 10);
193 193
 		// construct__end hook
194
-		do_action( 'AHEE__EE_Config__construct__end',$this );
194
+		do_action('AHEE__EE_Config__construct__end', $this);
195 195
 		// hardcoded hack
196 196
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
197 197
 	}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @return string current theme set.
205 205
 	 */
206 206
 	public static function get_current_theme() {
207
-		return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
207
+		return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
208 208
 	}
209 209
 
210 210
 
@@ -238,27 +238,27 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	private function _load_core_config() {
240 240
 		// load_core_config__start hook
241
-		do_action( 'AHEE__EE_Config___load_core_config__start', $this );
241
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
242 242
 		$espresso_config = $this->get_espresso_config();
243
-		foreach ( $espresso_config as $config => $settings ) {
243
+		foreach ($espresso_config as $config => $settings) {
244 244
 			// load_core_config__start hook
245
-			$settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this );
246
-			if ( is_object( $settings ) && property_exists( $this, $config ) ) {
247
-				$this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
245
+			$settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this);
246
+			if (is_object($settings) && property_exists($this, $config)) {
247
+				$this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
248 248
 				//call configs populate method to ensure any defaults are set for empty values.
249
-				if ( method_exists( $settings, 'populate' ) ) {
249
+				if (method_exists($settings, 'populate')) {
250 250
 					$this->$config->populate();
251 251
 				}
252
-				if ( method_exists( $settings, 'do_hooks' ) ) {
252
+				if (method_exists($settings, 'do_hooks')) {
253 253
 					$this->$config->do_hooks();
254 254
 				}
255 255
 			}
256 256
 		}
257
-		if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) {
257
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) {
258 258
 			$this->update_espresso_config();
259 259
 		}
260 260
 		// load_core_config__end hook
261
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
261
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
262 262
 	}
263 263
 
264 264
 
@@ -272,40 +272,40 @@  discard block
 block discarded – undo
272 272
 	protected function _verify_config() {
273 273
 
274 274
 		$this->core = $this->core instanceof EE_Core_Config
275
-			? $this->core  : new EE_Core_Config();
276
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core );
275
+			? $this->core : new EE_Core_Config();
276
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
277 277
 
278 278
 		$this->organization = $this->organization instanceof EE_Organization_Config
279
-			? $this->organization  : new EE_Organization_Config();
280
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization );
279
+			? $this->organization : new EE_Organization_Config();
280
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization);
281 281
 
282 282
 		$this->currency = $this->currency instanceof EE_Currency_Config
283 283
 			? $this->currency : new EE_Currency_Config();
284
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency );
284
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
285 285
 
286 286
 		$this->registration = $this->registration instanceof EE_Registration_Config
287 287
 			? $this->registration : new EE_Registration_Config();
288
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration );
288
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration);
289 289
 
290 290
 		$this->admin = $this->admin instanceof EE_Admin_Config
291 291
 			? $this->admin : new EE_Admin_Config();
292
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin );
292
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
293 293
 
294 294
 		$this->template_settings = $this->template_settings instanceof EE_Template_Config
295 295
 			? $this->template_settings : new EE_Template_Config();
296
-		$this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings );
296
+		$this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings);
297 297
 
298 298
 		$this->map_settings = $this->map_settings instanceof EE_Map_Config
299 299
 			? $this->map_settings : new EE_Map_Config();
300
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings );
300
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings);
301 301
 
302 302
 		$this->environment = $this->environment instanceof EE_Environment_Config
303 303
 			? $this->environment : new EE_Environment_Config();
304
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment );
304
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment);
305 305
 
306 306
 		$this->gateway = $this->gateway instanceof EE_Gateway_Config
307 307
 			? $this->gateway : new EE_Gateway_Config();
308
-		$this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway );
308
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
309 309
 
310 310
 	}
311 311
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	public function get_espresso_config() {
321 321
 		// grab espresso configuration
322
-		return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() ));
322
+		return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array()));
323 323
 	}
324 324
 
325 325
 
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	 * @param        $old_value
333 333
 	 * @param        $value
334 334
 	 */
335
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
335
+	public function double_check_config_comparison($option = '', $old_value, $value) {
336 336
 		// make sure we're checking the ee config
337
-		if ( $option == 'ee_config' ) {
337
+		if ($option == 'ee_config') {
338 338
 			// run a loose comparison of the old value against the new value for type and properties,
339 339
 			// but NOT exact instance like WP update_option does
340
-			if ( $value != $old_value ) {
340
+			if ($value != $old_value) {
341 341
 				// if they are NOT the same, then remove the hook,
342 342
 				// which means the subsequent update results will be based solely on the update query results
343 343
 				// the reason we do this is because, as stated above,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				// the string it sees in the db looks the same as the new one it has been passed!!!
353 353
 				// This results in the query returning an "affected rows" value of ZERO,
354 354
 				// which gets returned immediately by WP update_option and looks like an error.
355
-				remove_action( 'update_option', array( $this, 'check_config_updated' ));
355
+				remove_action('update_option', array($this, 'check_config_updated'));
356 356
 			}
357 357
 		}
358 358
 	}
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
 	 */
368 368
 	protected function  _reset_espresso_addon_config() {
369 369
 		$this->_config_option_names = array();
370
-		foreach( $this->addons as $addon_name => $addon_config_obj ) {
371
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
372
-			$config_class = get_class( $addon_config_obj );
373
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
374
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE );
370
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
371
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
372
+			$config_class = get_class($addon_config_obj);
373
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
374
+				$this->update_config('addons', $addon_name, $addon_config_obj, FALSE);
375 375
 			}
376 376
 			$this->addons->$addon_name = NULL;
377 377
 		}
@@ -387,17 +387,17 @@  discard block
 block discarded – undo
387 387
 	 * @param   bool $add_error
388 388
 	 * @return   bool
389 389
 	 */
390
-	public function  update_espresso_config( $add_success = FALSE, $add_error = TRUE ) {
390
+	public function  update_espresso_config($add_success = FALSE, $add_error = TRUE) {
391 391
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
392 392
 		//$clone = clone( self::$_instance );
393 393
 		//self::$_instance = NULL;
394
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this );
394
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
395 395
 		$this->_reset_espresso_addon_config();
396 396
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
397 397
 		// but BEFORE the actual update occurs
398
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
398
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
399 399
 		// now update "ee_config"
400
-		$saved = update_option( 'ee_config', $this );
400
+		$saved = update_option('ee_config', $this);
401 401
 		// if not saved... check if the hook we just added still exists;
402 402
 		// if it does, it means one of two things:
403 403
 		// 		that update_option bailed at the ( $value === $old_value ) conditional,
@@ -408,25 +408,25 @@  discard block
 block discarded – undo
408 408
 		// but just means no update occurred, so don't display an error to the user.
409 409
 		// BUT... if update_option returns FALSE, AND the hook is missing,
410 410
 		// then it means that something truly went wrong
411
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved;
411
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
412 412
 		// remove our action since we don't want it in the system anymore
413
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
414
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
413
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
414
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
415 415
 		//self::$_instance = $clone;
416 416
 		//unset( $clone );
417 417
 		// if config remains the same or was updated successfully
418
-		if ( $saved ) {
419
-			if ( $add_success ) {
418
+		if ($saved) {
419
+			if ($add_success) {
420 420
 				EE_Error::add_success(
421
-					__( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ),
421
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
422 422
 					__FILE__, __FUNCTION__, __LINE__
423 423
 				);
424 424
 			}
425 425
 			return TRUE;
426 426
 		} else {
427
-			if ( $add_error ) {
427
+			if ($add_error) {
428 428
 				EE_Error::add_error(
429
-					__( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ),
429
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
430 430
 					__FILE__, __FUNCTION__, __LINE__
431 431
 				);
432 432
 			}
@@ -452,20 +452,20 @@  discard block
 block discarded – undo
452 452
 		$name = '',
453 453
 		$config_class = '',
454 454
 		$config_obj = NULL,
455
-		$tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ),
455
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
456 456
 		$display_errors = TRUE
457 457
 	) {
458 458
 		try {
459
-			foreach ( $tests_to_run as $test ) {
460
-				switch ( $test ) {
459
+			foreach ($tests_to_run as $test) {
460
+				switch ($test) {
461 461
 
462 462
 					// TEST #1 : check that section was set
463 463
 					case 1 :
464
-						if ( empty( $section ) ) {
465
-							if ( $display_errors ) {
464
+						if (empty($section)) {
465
+							if ($display_errors) {
466 466
 								throw new EE_Error(
467 467
 									sprintf(
468
-										__( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ),
468
+										__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'),
469 469
 										$config_class
470 470
 									)
471 471
 								);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 					// TEST #2 : check that settings section exists
478 478
 					case 2 :
479
-						if ( ! isset( $this->{$section} ) ) {
480
-							if ( $display_errors ) {
479
+						if ( ! isset($this->{$section} )) {
480
+							if ($display_errors) {
481 481
 								throw new EE_Error(
482
-									sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ),
483
-											 $section )
482
+									sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'),
483
+											 $section)
484 484
 								);
485 485
 							}
486 486
 							return false;
@@ -490,12 +490,12 @@  discard block
 block discarded – undo
490 490
 					// TEST #3 : check that section is the proper format
491 491
 					case 3 :
492 492
 						if (
493
-							! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )
493
+							! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
494 494
 						) {
495
-							if ( $display_errors ) {
495
+							if ($display_errors) {
496 496
 								throw new EE_Error(
497 497
 									sprintf(
498
-										__( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ),
498
+										__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'),
499 499
 										$section
500 500
 									)
501 501
 								);
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
 
507 507
 					// TEST #4 : check that config section name has been set
508 508
 					case 4 :
509
-						if ( empty( $name ) ) {
510
-							if ( $display_errors ) {
509
+						if (empty($name)) {
510
+							if ($display_errors) {
511 511
 								throw new EE_Error(
512
-									__( 'No name has been provided for the specific configuration section.', 'event_espresso' )
512
+									__('No name has been provided for the specific configuration section.', 'event_espresso')
513 513
 								);
514 514
 							}
515 515
 							return false;
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 
519 519
 					// TEST #5 : check that a config class name has been set
520 520
 					case 5 :
521
-						if ( empty( $config_class ) ) {
522
-							if ( $display_errors ) {
521
+						if (empty($config_class)) {
522
+							if ($display_errors) {
523 523
 								throw new EE_Error(
524
-									__( 'No class name has been provided for the specific configuration section.', 'event_espresso' )
524
+									__('No class name has been provided for the specific configuration section.', 'event_espresso')
525 525
 								);
526 526
 							}
527 527
 							return false;
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 
531 531
 					// TEST #6 : verify config class is accessible
532 532
 					case 6 :
533
-						if ( ! class_exists( $config_class ) ) {
534
-							if ( $display_errors ) {
533
+						if ( ! class_exists($config_class)) {
534
+							if ($display_errors) {
535 535
 								throw new EE_Error(
536 536
 									sprintf(
537
-										__( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ),
537
+										__('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'),
538 538
 										$config_class
539 539
 									)
540 540
 								);
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 
546 546
 					// TEST #7 : check that config has even been set
547 547
 					case 7 :
548
-						if ( ! isset( $this->{$section}->{$name} ) ) {
549
-							if ( $display_errors ) {
548
+						if ( ! isset($this->{$section}->{$name} )) {
549
+							if ($display_errors) {
550 550
 								throw new EE_Error(
551 551
 									sprintf(
552
-										__( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ),
552
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
553 553
 										$section,
554 554
 										$name
555 555
 									)
@@ -558,17 +558,17 @@  discard block
 block discarded – undo
558 558
 							return false;
559 559
 						} else {
560 560
 							// and make sure it's not serialized
561
-							$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
561
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
562 562
 						}
563 563
 						break;
564 564
 
565 565
 					// TEST #8 : check that config is the requested type
566 566
 					case 8 :
567
-						if ( ! $this->{$section}->{$name} instanceof $config_class ) {
568
-							if ( $display_errors ) {
567
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
568
+							if ($display_errors) {
569 569
 								throw new EE_Error(
570 570
 									sprintf(
571
-										__( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ),
571
+										__('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'),
572 572
 										$section,
573 573
 										$name,
574 574
 										$config_class
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 
582 582
 					// TEST #9 : verify config object
583 583
 					case 9 :
584
-						if ( ! $config_obj instanceof EE_Config_Base ) {
585
-							if ( $display_errors ) {
584
+						if ( ! $config_obj instanceof EE_Config_Base) {
585
+							if ($display_errors) {
586 586
 								throw new EE_Error(
587 587
 									sprintf(
588
-										__( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ),
589
-										print_r( $config_obj, true )
588
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
589
+										print_r($config_obj, true)
590 590
 									)
591 591
 								);
592 592
 							}
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 				}
598 598
 			}
599 599
 
600
-		} catch( EE_Error $e ) {
600
+		} catch (EE_Error $e) {
601 601
 			$e->get_error();
602 602
 		}
603 603
 		// you have successfully run the gauntlet
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
 	 * @param        string          $name
615 615
 	 * @return        string
616 616
 	 */
617
-	private function _generate_config_option_name( $section = '', $name = '' ) {
618
-		return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) );
617
+	private function _generate_config_option_name($section = '', $name = '') {
618
+		return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
619 619
 	}
620 620
 
621 621
 
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
 	 * @param 	string $name
630 630
 	 * @return 	string
631 631
 	 */
632
-	private function _set_config_class( $config_class = '', $name = '' ) {
633
-		return ! empty( $config_class )
632
+	private function _set_config_class($config_class = '', $name = '') {
633
+		return ! empty($config_class)
634 634
 			? $config_class
635
-			: str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config';
635
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
636 636
 	}
637 637
 
638 638
 
@@ -646,34 +646,34 @@  discard block
 block discarded – undo
646 646
 	 * @param 	EE_Config_Base $config_obj
647 647
 	 * @return 	EE_Config_Base
648 648
 	 */
649
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) {
649
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) {
650 650
 		// ensure config class is set to something
651
-		$config_class = $this->_set_config_class( $config_class, $name );
651
+		$config_class = $this->_set_config_class($config_class, $name);
652 652
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
653
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) {
653
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
654 654
 			return null;
655 655
 		}
656
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
656
+		$config_option_name = $this->_generate_config_option_name($section, $name);
657 657
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
658
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
659
-			$this->_config_option_names[ $config_option_name ] = $config_class;
658
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
659
+			$this->_config_option_names[$config_option_name] = $config_class;
660 660
 		}
661 661
 		// verify the incoming config object but suppress errors
662
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) {
662
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
663 663
 			$config_obj = new $config_class();
664 664
 		}
665
-		if ( get_option( $config_option_name ) ) {
666
-			update_option( $config_option_name, $config_obj );
665
+		if (get_option($config_option_name)) {
666
+			update_option($config_option_name, $config_obj);
667 667
 			$this->{$section}->{$name} = $config_obj;
668 668
 			return $this->{$section}->{$name};
669 669
 		} else {
670 670
 			// create a wp-option for this config
671
-			if ( add_option( $config_option_name, $config_obj, '', 'no' )) {
672
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
671
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
672
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
673 673
 				return $this->{$section}->{$name};
674 674
 			} else {
675 675
 				EE_Error::add_error(
676
-					sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ),
676
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
677 677
 					__FILE__, __FUNCTION__, __LINE__
678 678
 				);
679 679
 				return null;
@@ -694,37 +694,37 @@  discard block
 block discarded – undo
694 694
 	 * @param 	bool 					$throw_errors
695 695
 	 * @return 	bool
696 696
 	 */
697
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) {
698
-		$config_obj = maybe_unserialize( $config_obj );
697
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) {
698
+		$config_obj = maybe_unserialize($config_obj);
699 699
 		// get class name of the incoming object
700
-		$config_class = get_class( $config_obj );
700
+		$config_class = get_class($config_obj);
701 701
 		// run tests 1-5 and 9 to verify config
702
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) {
702
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) {
703 703
 			return false;
704 704
 		}
705
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
705
+		$config_option_name = $this->_generate_config_option_name($section, $name);
706 706
 		// check if config object has been added to db by seeing if config option name is in $this->_config_option_names array
707
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
707
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
708 708
 			// save new config to db
709
-			return $this->set_config( $section, $name, $config_class, $config_obj );
709
+			return $this->set_config($section, $name, $config_class, $config_obj);
710 710
 		} else {
711 711
 			// first check if the record already exists
712
-			$existing_config = get_option( $config_option_name );
713
-			$config_obj = serialize( $config_obj );
712
+			$existing_config = get_option($config_option_name);
713
+			$config_obj = serialize($config_obj);
714 714
 			// just return if db record is already up to date
715
-			if ( $existing_config == $config_obj ) {
715
+			if ($existing_config == $config_obj) {
716 716
 				$this->{$section}->{$name} = $config_obj;
717 717
 				return true;
718
-			} else if ( update_option( $config_option_name, $config_obj )) {
718
+			} else if (update_option($config_option_name, $config_obj)) {
719 719
 				// update wp-option for this config class
720 720
 				$this->{$section}->{$name} = $config_obj;
721 721
 				return true;
722
-			} elseif ( $throw_errors ) {
722
+			} elseif ($throw_errors) {
723 723
 				EE_Error::add_error(
724 724
 					sprintf(
725
-						__( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ),
725
+						__('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'),
726 726
 						$config_class,
727
-						'EE_Config->' . $section . '->' . $name
727
+						'EE_Config->'.$section.'->'.$name
728 728
 					),
729 729
 					__FILE__, __FUNCTION__, __LINE__
730 730
 				);
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param 	string 	$config_class
745 745
 	 * @return 	mixed EE_Config_Base | NULL
746 746
 	 */
747
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
747
+	public function get_config($section = '', $name = '', $config_class = '') {
748 748
 		// ensure config class is set to something
749
-		$config_class = $this->_set_config_class( $config_class, $name );
749
+		$config_class = $this->_set_config_class($config_class, $name);
750 750
 		// run tests 1-4, 6 and 7 to verify that all params have been set
751
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) {
751
+		if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) {
752 752
 			return NULL;
753 753
 		}
754 754
 		// now test if the requested config object exists, but suppress errors
755
-		if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) {
755
+		if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) {
756 756
 			// config already exists, so pass it back
757 757
 			return $this->{$section}->{$name};
758 758
 		}
759 759
 		// load config option from db if it exists
760
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ));
760
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
761 761
 		// verify the newly retrieved config object, but suppress errors
762
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) {
762
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) {
763 763
 			// config is good, so set it and pass it back
764 764
 			$this->{$section}->{$name} = $config_obj;
765 765
 			return $this->{$section}->{$name};
766 766
 		}
767 767
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
768
-		$config_obj =$this->set_config( $section, $name, $config_class );
768
+		$config_obj = $this->set_config($section, $name, $config_class);
769 769
 		// verify the newly created config object
770
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) {
770
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
771 771
 			return $this->{$section}->{$name};
772 772
 		} else {
773 773
 			EE_Error::add_error(
774
-				sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ),
774
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
775 775
 				__FILE__, __FUNCTION__, __LINE__
776 776
 			);
777 777
 		}
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	 * @param 	string 	$config_option_name
787 787
 	 * @return 	mixed EE_Config_Base | FALSE
788 788
 	 */
789
-	public function get_config_option( $config_option_name = '' ) {
789
+	public function get_config_option($config_option_name = '') {
790 790
 		// retrieve the wp-option for this config class.
791
-		return maybe_unserialize( get_option( $config_option_name ));
791
+		return maybe_unserialize(get_option($config_option_name));
792 792
 	}
793 793
 
794 794
 
@@ -801,45 +801,45 @@  discard block
 block discarded – undo
801 801
 	 * @param $page_for_posts
802 802
 	 * @return    void
803 803
 	 */
804
-	public function update_post_shortcodes( $page_for_posts = '' ) {
804
+	public function update_post_shortcodes($page_for_posts = '') {
805 805
 		// make sure page_for_posts is set
806
-		$page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts();
806
+		$page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts();
807 807
 		// critical page shortcodes that we do NOT want added to the Posts page (blog)
808 808
 		$critical_shortcodes = $this->core->get_critical_pages_shortcodes_array();
809 809
 		// allow others to mess stuff up :D
810
-		do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts );
810
+		do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts);
811 811
 		// verify that post_shortcodes is set
812
-		$this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array();
812
+		$this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array();
813 813
 		// cycle thru post_shortcodes
814
-		foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){
814
+		foreach ($this->core->post_shortcodes as $post_name => $shortcodes) {
815 815
 			// are there any shortcodes to track ?
816
-			if ( ! empty( $shortcodes )) {
816
+			if ( ! empty($shortcodes)) {
817 817
 				// loop thru list of tracked shortcodes
818
-				foreach( $shortcodes as $shortcode => $post_id ) {
818
+				foreach ($shortcodes as $shortcode => $post_id) {
819 819
 					// if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode
820
-					if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) {
820
+					if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) {
821 821
 						// then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog)
822
-						unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] );
822
+						unset($this->core->post_shortcodes[$post_name][$shortcode]);
823 823
 					}
824 824
 					// skip the posts page, because we want all shortcodes registered for it
825
-					if ( $post_name == $page_for_posts ) {
825
+					if ($post_name == $page_for_posts) {
826 826
 						continue;
827 827
 					}
828 828
 					// make sure post still exists
829
-					$post = get_post( $post_id );
830
-					if ( $post ) {
829
+					$post = get_post($post_id);
830
+					if ($post) {
831 831
 						// check that the post name matches what we have saved
832
-						if ( $post->post_name == $post_name ) {
832
+						if ($post->post_name == $post_name) {
833 833
 							// if so, then break before hitting the unset below
834 834
 							continue;
835 835
 						}
836 836
 					}
837 837
 					// we don't like missing posts around here >:(
838
-					unset( $this->core->post_shortcodes[ $post_name ] );
838
+					unset($this->core->post_shortcodes[$post_name]);
839 839
 				}
840 840
 			} else {
841 841
 				// you got no shortcodes to keep track of !
842
-				unset( $this->core->post_shortcodes[ $post_name ] );
842
+				unset($this->core->post_shortcodes[$post_name]);
843 843
 			}
844 844
 		}
845 845
 		//only show errors
@@ -858,14 +858,14 @@  discard block
 block discarded – undo
858 858
 	 *  @return 	string
859 859
 	 */
860 860
 	public static function get_page_for_posts() {
861
-		$page_for_posts = get_option( 'page_for_posts' );
862
-		if ( ! $page_for_posts ) {
861
+		$page_for_posts = get_option('page_for_posts');
862
+		if ( ! $page_for_posts) {
863 863
 			return 'posts';
864 864
 		}
865 865
 		/** @type WPDB $wpdb */
866 866
 		global $wpdb;
867 867
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
868
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ));
868
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
869 869
 	}
870 870
 
871 871
 
@@ -881,11 +881,11 @@  discard block
 block discarded – undo
881 881
 	 *  @return 	void
882 882
 	 */
883 883
 	public function register_shortcodes_and_modules() {
884
-		if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) {
884
+		if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) {
885 885
 			return;
886 886
 		}
887 887
 		// allow shortcodes to register with WP and to set hooks for the rest of the system
888
-		EE_Registry::instance()->shortcodes =$this->_register_shortcodes();
888
+		EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
889 889
 		// allow modules to set hooks for the rest of the system
890 890
 		EE_Registry::instance()->modules = $this->_register_modules();
891 891
 	}
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	 *  @return 	void
900 900
 	 */
901 901
 	public function initialize_shortcodes_and_modules() {
902
-		if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) {
902
+		if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) {
903 903
 			return;
904 904
 		}
905 905
 		// allow shortcodes to set hooks for the rest of the system
@@ -918,26 +918,26 @@  discard block
 block discarded – undo
918 918
 	 * 	@return void
919 919
 	 */
920 920
 	public function widgets_init() {
921
-		if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) {
921
+		if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) {
922 922
 			return;
923 923
 		}
924 924
 		//only init widgets on admin pages when not in complete maintenance, and
925 925
 		//on frontend when not in any maintenance mode
926
-		if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance)  || ! EE_Maintenance_Mode::instance()->level() ) {
926
+		if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) {
927 927
 			// grab list of installed widgets
928
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
928
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
929 929
 			// filter list of modules to register
930
-			$widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register );
930
+			$widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register);
931 931
 
932
-			if ( ! empty( $widgets_to_register ) ) {
932
+			if ( ! empty($widgets_to_register)) {
933 933
 				// cycle thru widget folders
934
-				foreach ( $widgets_to_register as $widget_path ) {
934
+				foreach ($widgets_to_register as $widget_path) {
935 935
 					// add to list of installed widget modules
936
-					EE_Config::register_ee_widget( $widget_path );
936
+					EE_Config::register_ee_widget($widget_path);
937 937
 				}
938 938
 			}
939 939
 			// filter list of installed modules
940
-			EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets );
940
+			EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets);
941 941
 		}
942 942
 	}
943 943
 
@@ -950,54 +950,54 @@  discard block
 block discarded – undo
950 950
 	 *  @param 	string 	$widget_path - full path up to and including widget folder
951 951
 	 *  @return 	void
952 952
 	 */
953
-	public static function register_ee_widget( $widget_path = NULL ) {
954
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
953
+	public static function register_ee_widget($widget_path = NULL) {
954
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
955 955
 		$widget_ext = '.widget.php';
956 956
 		// make all separators match
957
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
957
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
958 958
 		// does the file path INCLUDE the actual file name as part of the path ?
959
-		if ( strpos( $widget_path, $widget_ext ) !== FALSE ) {
959
+		if (strpos($widget_path, $widget_ext) !== FALSE) {
960 960
 			// grab and shortcode file name from directory name and break apart at dots
961
-			$file_name = explode( '.', basename( $widget_path ));
961
+			$file_name = explode('.', basename($widget_path));
962 962
 			// take first segment from file name pieces and remove class prefix if it exists
963
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
963
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
964 964
 			// sanitize shortcode directory name
965
-			$widget = sanitize_key( $widget );
965
+			$widget = sanitize_key($widget);
966 966
 			// now we need to rebuild the shortcode path
967
-			$widget_path = explode( DS, $widget_path );
967
+			$widget_path = explode(DS, $widget_path);
968 968
 			// remove last segment
969
-			array_pop( $widget_path );
969
+			array_pop($widget_path);
970 970
 			// glue it back together
971
-			$widget_path = implode( DS, $widget_path );
971
+			$widget_path = implode(DS, $widget_path);
972 972
 		} else {
973 973
 			// grab and sanitize widget directory name
974
-			$widget = sanitize_key( basename( $widget_path ));
974
+			$widget = sanitize_key(basename($widget_path));
975 975
 		}
976 976
 		// create classname from widget directory name
977
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget )));
977
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
978 978
 		// add class prefix
979
-		$widget_class = 'EEW_' . $widget;
979
+		$widget_class = 'EEW_'.$widget;
980 980
 		// does the widget exist ?
981
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) {
981
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
982 982
 			$msg = sprintf(
983
-				__( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ),
983
+				__('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'),
984 984
 				$widget_class,
985
-				$widget_path . DS . $widget_class . $widget_ext
985
+				$widget_path.DS.$widget_class.$widget_ext
986 986
 			);
987
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
987
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
988 988
 			return;
989 989
 		}
990 990
 		// load the widget class file
991
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
991
+		require_once($widget_path.DS.$widget_class.$widget_ext);
992 992
 		// verify that class exists
993
-		if ( ! class_exists( $widget_class )) {
994
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
995
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
993
+		if ( ! class_exists($widget_class)) {
994
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
995
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
996 996
 			return;
997 997
 		}
998
-		register_widget( $widget_class );
998
+		register_widget($widget_class);
999 999
 		// add to array of registered widgets
1000
-		EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext;
1000
+		EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext;
1001 1001
 	}
1002 1002
 
1003 1003
 
@@ -1010,18 +1010,18 @@  discard block
 block discarded – undo
1010 1010
 	 */
1011 1011
 	private function _register_shortcodes() {
1012 1012
 		// grab list of installed shortcodes
1013
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
1013
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
1014 1014
 		// filter list of modules to register
1015
-		$shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register );
1016
-		if ( ! empty( $shortcodes_to_register ) ) {
1015
+		$shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register);
1016
+		if ( ! empty($shortcodes_to_register)) {
1017 1017
 			// cycle thru shortcode folders
1018
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
1018
+			foreach ($shortcodes_to_register as $shortcode_path) {
1019 1019
 				// add to list of installed shortcode modules
1020
-				EE_Config::register_shortcode( $shortcode_path );
1020
+				EE_Config::register_shortcode($shortcode_path);
1021 1021
 			}
1022 1022
 		}
1023 1023
 		// filter list of installed modules
1024
-		return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes );
1024
+		return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes);
1025 1025
 	}
1026 1026
 
1027 1027
 
@@ -1033,56 +1033,56 @@  discard block
 block discarded – undo
1033 1033
 	 *  @param 	string 		$shortcode_path - full path up to and including shortcode folder
1034 1034
 	 *  @return 	bool
1035 1035
 	 */
1036
-	public static function register_shortcode( $shortcode_path = NULL ) {
1037
-		do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path );
1036
+	public static function register_shortcode($shortcode_path = NULL) {
1037
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
1038 1038
 		$shortcode_ext = '.shortcode.php';
1039 1039
 		// make all separators match
1040
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
1040
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
1041 1041
 		// does the file path INCLUDE the actual file name as part of the path ?
1042
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) {
1042
+		if (strpos($shortcode_path, $shortcode_ext) !== FALSE) {
1043 1043
 			// grab shortcode file name from directory name and break apart at dots
1044
-			$shortcode_file = explode( '.', basename( $shortcode_path ));
1044
+			$shortcode_file = explode('.', basename($shortcode_path));
1045 1045
 			// take first segment from file name pieces and remove class prefix if it exists
1046
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0];
1046
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0];
1047 1047
 			// sanitize shortcode directory name
1048
-			$shortcode = sanitize_key( $shortcode );
1048
+			$shortcode = sanitize_key($shortcode);
1049 1049
 			// now we need to rebuild the shortcode path
1050
-			$shortcode_path = explode( DS, $shortcode_path );
1050
+			$shortcode_path = explode(DS, $shortcode_path);
1051 1051
 			// remove last segment
1052
-			array_pop( $shortcode_path );
1052
+			array_pop($shortcode_path);
1053 1053
 			// glue it back together
1054
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
1054
+			$shortcode_path = implode(DS, $shortcode_path).DS;
1055 1055
 		} else {
1056 1056
 			// we need to generate the filename based off of the folder name
1057 1057
 			// grab and sanitize shortcode directory name
1058
-			$shortcode = sanitize_key( basename( $shortcode_path ));
1059
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
1058
+			$shortcode = sanitize_key(basename($shortcode_path));
1059
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
1060 1060
 		}
1061 1061
 		// create classname from shortcode directory or file name
1062
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode )));
1062
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
1063 1063
 		// add class prefix
1064
-		$shortcode_class = 'EES_' . $shortcode;
1064
+		$shortcode_class = 'EES_'.$shortcode;
1065 1065
 		// does the shortcode exist ?
1066
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) {
1066
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1067 1067
 			$msg = sprintf(
1068
-				__( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ),
1068
+				__('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'),
1069 1069
 				$shortcode_class,
1070
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1070
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
1071 1071
 			);
1072
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1072
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1073 1073
 			return FALSE;
1074 1074
 		}
1075 1075
 		// load the shortcode class file
1076
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
1076
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1077 1077
 		// verify that class exists
1078
-		if ( ! class_exists( $shortcode_class )) {
1079
-			$msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class );
1080
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1078
+		if ( ! class_exists($shortcode_class)) {
1079
+			$msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class);
1080
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1081 1081
 			return FALSE;
1082 1082
 		}
1083
-		$shortcode = strtoupper( $shortcode );
1083
+		$shortcode = strtoupper($shortcode);
1084 1084
 		// add to array of registered shortcodes
1085
-		EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext;
1085
+		EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext;
1086 1086
 		return TRUE;
1087 1087
 	}
1088 1088
 
@@ -1097,23 +1097,23 @@  discard block
 block discarded – undo
1097 1097
 	 */
1098 1098
 	private function _register_modules() {
1099 1099
 		// grab list of installed modules
1100
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1100
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1101 1101
 		// filter list of modules to register
1102
-		$modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register );
1102
+		$modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register);
1103 1103
 
1104 1104
 
1105
-		if ( ! empty( $modules_to_register ) ) {
1105
+		if ( ! empty($modules_to_register)) {
1106 1106
 			// loop through folders
1107
-			foreach ( $modules_to_register as $module_path ) {
1107
+			foreach ($modules_to_register as $module_path) {
1108 1108
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1109
-				if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) {
1109
+				if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') {
1110 1110
 					// add to list of installed modules
1111
-					EE_Config::register_module( $module_path );
1111
+					EE_Config::register_module($module_path);
1112 1112
 				}
1113 1113
 			}
1114 1114
 		}
1115 1115
 		// filter list of installed modules
1116
-		return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules );
1116
+		return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules);
1117 1117
 	}
1118 1118
 
1119 1119
 
@@ -1126,54 +1126,54 @@  discard block
 block discarded – undo
1126 1126
 	 *  @param 	string 		$module_path - full path up to and including module folder
1127 1127
 	 *  @return 	bool
1128 1128
 	 */
1129
-	public static function register_module( $module_path = NULL ) {
1130
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1129
+	public static function register_module($module_path = NULL) {
1130
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1131 1131
 		$module_ext = '.module.php';
1132 1132
 		// make all separators match
1133
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1133
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1134 1134
 		// does the file path INCLUDE the actual file name as part of the path ?
1135
-		if ( strpos( $module_path, $module_ext ) !== FALSE ) {
1135
+		if (strpos($module_path, $module_ext) !== FALSE) {
1136 1136
 			// grab and shortcode file name from directory name and break apart at dots
1137
-			$module_file = explode( '.', basename( $module_path ));
1137
+			$module_file = explode('.', basename($module_path));
1138 1138
 			// now we need to rebuild the shortcode path
1139
-			$module_path = explode( DS, $module_path );
1139
+			$module_path = explode(DS, $module_path);
1140 1140
 			// remove last segment
1141
-			array_pop( $module_path );
1141
+			array_pop($module_path);
1142 1142
 			// glue it back together
1143
-			$module_path = implode( DS, $module_path ) . DS;
1143
+			$module_path = implode(DS, $module_path).DS;
1144 1144
 			// take first segment from file name pieces and sanitize it
1145
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1145
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1146 1146
 			// ensure class prefix is added
1147
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1147
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1148 1148
 		} else {
1149 1149
 			// we need to generate the filename based off of the folder name
1150 1150
 			// grab and sanitize module name
1151
-			$module = strtolower( basename( $module_path ));
1152
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module);
1151
+			$module = strtolower(basename($module_path));
1152
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1153 1153
 			// like trailingslashit()
1154
-			$module_path = rtrim( $module_path, DS ) . DS;
1154
+			$module_path = rtrim($module_path, DS).DS;
1155 1155
 			// create classname from module directory name
1156
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module )));
1156
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1157 1157
 			// add class prefix
1158
-			$module_class = 'EED_' . $module;
1158
+			$module_class = 'EED_'.$module;
1159 1159
 		}
1160 1160
 		// does the module exist ?
1161
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) {
1162
-			$msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
1163
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1161
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1162
+			$msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
1163
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1164 1164
 			return FALSE;
1165 1165
 		}
1166 1166
 		// load the module class file
1167
-		require_once( $module_path . $module_class . $module_ext );
1167
+		require_once($module_path.$module_class.$module_ext);
1168 1168
 		// verify that class exists
1169
-		if ( ! class_exists( $module_class )) {
1170
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1171
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1169
+		if ( ! class_exists($module_class)) {
1170
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1171
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1172 1172
 			return FALSE;
1173 1173
 		}
1174 1174
 		// add to array of registered modules
1175
-		EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext;
1176
-		do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class );
1175
+		EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext;
1176
+		do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class);
1177 1177
 		return TRUE;
1178 1178
 	}
1179 1179
 
@@ -1187,23 +1187,23 @@  discard block
 block discarded – undo
1187 1187
 	 */
1188 1188
 	private function _initialize_shortcodes() {
1189 1189
 		// cycle thru shortcode folders
1190
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1190
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1191 1191
 			// add class prefix
1192
-			$shortcode_class = 'EES_' . $shortcode;
1192
+			$shortcode_class = 'EES_'.$shortcode;
1193 1193
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1194 1194
 			// which set hooks ?
1195
-			if ( is_admin() ) {
1195
+			if (is_admin()) {
1196 1196
 				// fire immediately
1197
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ));
1197
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1198 1198
 			} else {
1199 1199
 				// delay until other systems are online
1200
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' ));
1200
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks'));
1201 1201
 				// convert classname to UPPERCASE and create WP shortcode.
1202
-				$shortcode_tag = strtoupper( $shortcode );
1202
+				$shortcode_tag = strtoupper($shortcode);
1203 1203
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1204
-				if ( ! shortcode_exists( $shortcode_tag )) {
1204
+				if ( ! shortcode_exists($shortcode_tag)) {
1205 1205
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1206
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ));
1206
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1207 1207
 				}
1208 1208
 			}
1209 1209
 		}
@@ -1220,15 +1220,15 @@  discard block
 block discarded – undo
1220 1220
 	 */
1221 1221
 	private function _initialize_modules() {
1222 1222
 		// cycle thru shortcode folders
1223
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1223
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1224 1224
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1225 1225
 			// which set hooks ?
1226
-			if ( is_admin() ) {
1226
+			if (is_admin()) {
1227 1227
 				// fire immediately
1228
-				call_user_func( array( $module_class, 'set_hooks_admin' ));
1228
+				call_user_func(array($module_class, 'set_hooks_admin'));
1229 1229
 			} else {
1230 1230
 				// delay until other systems are online
1231
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' ));
1231
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks'));
1232 1232
 			}
1233 1233
 		}
1234 1234
 	}
@@ -1246,26 +1246,26 @@  discard block
 block discarded – undo
1246 1246
 	 *  @param 	string 		$key - url param key indicating a route is being called
1247 1247
 	 *  @return 	bool
1248 1248
 	 */
1249
-	public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) {
1250
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1251
-		$module = str_replace( 'EED_', '', $module );
1252
-		$module_class = 'EED_' . $module;
1253
-		if ( ! isset( EE_Registry::instance()->modules->$module_class )) {
1254
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1255
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1249
+	public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') {
1250
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1251
+		$module = str_replace('EED_', '', $module);
1252
+		$module_class = 'EED_'.$module;
1253
+		if ( ! isset(EE_Registry::instance()->modules->$module_class)) {
1254
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1255
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return FALSE;
1257 1257
 		}
1258
-		if ( empty( $route )) {
1259
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1260
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1258
+		if (empty($route)) {
1259
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1260
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1261 1261
 			return FALSE;
1262 1262
 		}
1263
-		if ( ! method_exists ( 'EED_' . $module, $method_name )) {
1264
-			$msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route );
1265
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1263
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1264
+			$msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route);
1265
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1266 1266
 			return FALSE;
1267 1267
 		}
1268
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1268
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1269 1269
 		return TRUE;
1270 1270
 	}
1271 1271
 
@@ -1279,11 +1279,11 @@  discard block
 block discarded – undo
1279 1279
 	 *  @param 	string 		$key - url param key indicating a route is being called
1280 1280
 	 *  @return 	string
1281 1281
 	 */
1282
-	public static function get_route( $route = NULL, $key = 'ee' ) {
1283
-		do_action( 'AHEE__EE_Config__get_route__begin',$route );
1284
-		$route = apply_filters( 'FHEE__EE_Config__get_route',$route );
1285
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) {
1286
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1282
+	public static function get_route($route = NULL, $key = 'ee') {
1283
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1284
+		$route = apply_filters('FHEE__EE_Config__get_route', $route);
1285
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1286
+			return EE_Config::$_module_route_map[$key][$route];
1287 1287
 		}
1288 1288
 		return NULL;
1289 1289
 	}
@@ -1312,35 +1312,35 @@  discard block
 block discarded – undo
1312 1312
 	 * @param    string 		$key - url param key indicating a route is being called
1313 1313
 	 * @return    bool
1314 1314
 	 */
1315
-	public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) {
1316
-		do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward );
1317
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1318
-			$msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route );
1319
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1315
+	public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') {
1316
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1317
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1318
+			$msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route);
1319
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1320 1320
 			return FALSE;
1321 1321
 		}
1322
-		if ( empty( $forward )) {
1323
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1324
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1322
+		if (empty($forward)) {
1323
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1324
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1325 1325
 			return FALSE;
1326 1326
 		}
1327
-		if ( is_array( $forward )) {
1328
-			if ( ! isset( $forward[1] )) {
1329
-				$msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route );
1330
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1327
+		if (is_array($forward)) {
1328
+			if ( ! isset($forward[1])) {
1329
+				$msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route);
1330
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1331 1331
 				return FALSE;
1332 1332
 			}
1333
-			if ( ! method_exists( $forward[0], $forward[1] )) {
1334
-				$msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route );
1335
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1333
+			if ( ! method_exists($forward[0], $forward[1])) {
1334
+				$msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route);
1335
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1336 1336
 				return FALSE;
1337 1337
 			}
1338
-		} else if ( ! function_exists( $forward )) {
1339
-			$msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route );
1340
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1338
+		} else if ( ! function_exists($forward)) {
1339
+			$msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route);
1340
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1341 1341
 			return FALSE;
1342 1342
 		}
1343
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1343
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1344 1344
 		return TRUE;
1345 1345
 	}
1346 1346
 
@@ -1355,10 +1355,10 @@  discard block
 block discarded – undo
1355 1355
 	 *  @param    string 		$key - url param key indicating a route is being called
1356 1356
 	 *  @return 	string
1357 1357
 	 */
1358
-	public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) {
1359
-		do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status );
1360
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) {
1361
-			return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status );
1358
+	public static function get_forward($route = NULL, $status = 0, $key = 'ee') {
1359
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1360
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1361
+			return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status);
1362 1362
 		}
1363 1363
 		return NULL;
1364 1364
 	}
@@ -1375,19 +1375,19 @@  discard block
 block discarded – undo
1375 1375
 	 * @param    string 		$key - url param key indicating a route is being called
1376 1376
 	 * @return    bool
1377 1377
 	 */
1378
-	public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) {
1379
-		do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view );
1380
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1381
-			$msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route );
1382
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1378
+	public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') {
1379
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1380
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1381
+			$msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route);
1382
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1383 1383
 			return FALSE;
1384 1384
 		}
1385
-		if ( ! is_readable( $view )) {
1386
-			$msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view );
1387
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1385
+		if ( ! is_readable($view)) {
1386
+			$msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view);
1387
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1388 1388
 			return FALSE;
1389 1389
 		}
1390
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1390
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1391 1391
 		return TRUE;
1392 1392
 	}
1393 1393
 
@@ -1404,10 +1404,10 @@  discard block
 block discarded – undo
1404 1404
 	 *  @param    string 		$key - url param key indicating a route is being called
1405 1405
 	 *  @return 	string
1406 1406
 	 */
1407
-	public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) {
1408
-		do_action( 'AHEE__EE_Config__get_view__begin',$route,$status );
1409
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) {
1410
-			return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status );
1407
+	public static function get_view($route = NULL, $status = 0, $key = 'ee') {
1408
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1409
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1410
+			return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status);
1411 1411
 		}
1412 1412
 		return NULL;
1413 1413
 	}
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 
1416 1416
 
1417 1417
 	public function shutdown() {
1418
-		update_option( 'ee_config_option_names', $this->_config_option_names );
1418
+		update_option('ee_config_option_names', $this->_config_option_names);
1419 1419
 	}
1420 1420
 
1421 1421
 
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
  * magic functions in use, except we'll allow them to magically set and get stuff...
1432 1432
  * basically, they should just be well-defined stdClasses
1433 1433
  */
1434
-class EE_Config_Base{
1434
+class EE_Config_Base {
1435 1435
 
1436 1436
 	/**
1437 1437
 	 * Utility function for escaping the value of a property and returning.
@@ -1440,13 +1440,13 @@  discard block
 block discarded – undo
1440 1440
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1441 1441
 	 * @throws \EE_Error
1442 1442
 	 */
1443
-	public function get_pretty( $property ) {
1444
-		if ( ! property_exists( $this, $property ) ) {
1445
-			throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) );
1443
+	public function get_pretty($property) {
1444
+		if ( ! property_exists($this, $property)) {
1445
+			throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property));
1446 1446
 		}
1447 1447
 		//just handling escaping of strings for now.
1448
-		if ( is_string( $this->$property ) ) {
1449
-			return stripslashes( $this->$property );
1448
+		if (is_string($this->$property)) {
1449
+			return stripslashes($this->$property);
1450 1450
 		}
1451 1451
 		return $this->$property;
1452 1452
 	}
@@ -1455,19 +1455,19 @@  discard block
 block discarded – undo
1455 1455
 
1456 1456
 	public function populate() {
1457 1457
 		//grab defaults via a new instance of this class.
1458
-		$class_name = get_class( $this );
1458
+		$class_name = get_class($this);
1459 1459
 		$defaults = new $class_name;
1460 1460
 
1461 1461
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1462 1462
 		//default from our $defaults object.
1463
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1464
-			if ( is_null( $this->$property ) ) {
1463
+		foreach (get_object_vars($defaults) as $property => $value) {
1464
+			if (is_null($this->$property)) {
1465 1465
 				$this->$property = $value;
1466 1466
 			}
1467 1467
 		}
1468 1468
 
1469 1469
 		//cleanup
1470
-		unset( $defaults );
1470
+		unset($defaults);
1471 1471
 	}
1472 1472
 
1473 1473
 
@@ -1559,12 +1559,12 @@  discard block
 block discarded – undo
1559 1559
 	 */
1560 1560
 	public function __construct() {
1561 1561
 		$current_network_main_site = is_multisite() ? get_current_site() : NULL;
1562
-		$current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1562
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1563 1563
 		// set default organization settings
1564 1564
 		$this->current_blog_id = get_current_blog_id();
1565 1565
 		$this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id;
1566
-		$this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE );
1567
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE;
1566
+		$this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE);
1567
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE;
1568 1568
 		$this->post_shortcodes = array();
1569 1569
 		$this->module_route_map = array();
1570 1570
 		$this->module_forward_map = array();
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
 		$this->event_cpt_slug = __('events', 'event_espresso');
1584 1584
 
1585 1585
 		//ueip constant check
1586
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1586
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1587 1587
 			$this->ee_ueip_optin = FALSE;
1588 1588
 			$this->ee_ueip_has_notified = TRUE;
1589 1589
 		}
@@ -1623,8 +1623,8 @@  discard block
 block discarded – undo
1623 1623
 	 *  @return 	string
1624 1624
 	 */
1625 1625
 	public function reg_page_url() {
1626
-		if ( ! $this->reg_page_url ) {
1627
-			$this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout';
1626
+		if ( ! $this->reg_page_url) {
1627
+			$this->reg_page_url = get_permalink($this->reg_page_id).'#checkout';
1628 1628
 		}
1629 1629
 		return $this->reg_page_url;
1630 1630
 	}
@@ -1637,12 +1637,12 @@  discard block
 block discarded – undo
1637 1637
 	 *  @return 	string
1638 1638
 	 */
1639 1639
 	public function txn_page_url($query_args = array()) {
1640
-		if ( ! $this->txn_page_url ) {
1641
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1640
+		if ( ! $this->txn_page_url) {
1641
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1642 1642
 		}
1643
-		if($query_args){
1644
-			return add_query_arg($query_args,$this->txn_page_url);
1645
-		}else{
1643
+		if ($query_args) {
1644
+			return add_query_arg($query_args, $this->txn_page_url);
1645
+		} else {
1646 1646
 			return $this->txn_page_url;
1647 1647
 		}
1648 1648
 	}
@@ -1654,12 +1654,12 @@  discard block
 block discarded – undo
1654 1654
 	 *  @return 	string
1655 1655
 	 */
1656 1656
 	public function thank_you_page_url($query_args = array()) {
1657
-		if ( ! $this->thank_you_page_url ) {
1658
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1657
+		if ( ! $this->thank_you_page_url) {
1658
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1659 1659
 		}
1660
-		if($query_args){
1661
-			return add_query_arg($query_args,$this->thank_you_page_url);
1662
-		}else{
1660
+		if ($query_args) {
1661
+			return add_query_arg($query_args, $this->thank_you_page_url);
1662
+		} else {
1663 1663
 			return $this->thank_you_page_url;
1664 1664
 		}
1665 1665
 	}
@@ -1670,8 +1670,8 @@  discard block
 block discarded – undo
1670 1670
 	 *  @return 	string
1671 1671
 	 */
1672 1672
 	public function cancel_page_url() {
1673
-		if ( ! $this->cancel_page_url ) {
1674
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1673
+		if ( ! $this->cancel_page_url) {
1674
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1675 1675
 		}
1676 1676
 		return $this->cancel_page_url;
1677 1677
 	}
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
 		//reset all url properties
1700 1700
 		$this->_reset_urls();
1701 1701
 		//return what to save to db
1702
-		return array_keys( get_object_vars( $this ) );
1702
+		return array_keys(get_object_vars($this));
1703 1703
 	}
1704 1704
 
1705 1705
 }
@@ -1931,39 +1931,39 @@  discard block
 block discarded – undo
1931 1931
 	 * @param null $CNT_ISO
1932 1932
 	 * @return \EE_Currency_Config
1933 1933
 	 */
1934
-	public function __construct( $CNT_ISO = NULL ) {
1934
+	public function __construct($CNT_ISO = NULL) {
1935 1935
 
1936 1936
 		// get country code from organization settings or use default
1937
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1937
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1938 1938
 		// but override if requested
1939
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
1940
-		EE_Registry::instance()->load_helper( 'Activation' );
1939
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
1940
+		EE_Registry::instance()->load_helper('Activation');
1941 1941
 		// so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
1942
-		if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) {
1942
+		if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) {
1943 1943
 			// retrieve the country settings from the db, just in case they have been customized
1944
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
1945
-			if ( $country instanceof EE_Country ) {
1946
-				$this->code = $country->currency_code(); 	// currency code: USD, CAD, EUR
1947
-				$this->name = $country->currency_name_single();	// Dollar
1948
-				$this->plural = $country->currency_name_plural(); 	// Dollars
1949
-				$this->sign =  $country->currency_sign(); 			// currency sign: $
1950
-				$this->sign_b4 = $country->currency_sign_before(); 		// currency sign before or after: $TRUE  or  FALSE$
1951
-				$this->dec_plc = $country->currency_decimal_places();	// decimal places: 2 = 0.00  3 = 0.000
1952
-				$this->dec_mrk = $country->currency_decimal_mark();	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1953
-				$this->thsnds = $country->currency_thousands_separator();	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1944
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
1945
+			if ($country instanceof EE_Country) {
1946
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
1947
+				$this->name = $country->currency_name_single(); // Dollar
1948
+				$this->plural = $country->currency_name_plural(); // Dollars
1949
+				$this->sign = $country->currency_sign(); // currency sign: $
1950
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
1951
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
1952
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1953
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1954 1954
 			}
1955 1955
 		}
1956 1956
 		// fallback to hardcoded defaults, in case the above failed
1957
-		if ( empty( $this->code )) {
1957
+		if (empty($this->code)) {
1958 1958
 			// set default currency settings
1959
-			$this->code = 'USD'; 	// currency code: USD, CAD, EUR
1960
-			$this->name = __( 'Dollar', 'event_espresso' ); 	// Dollar
1961
-			$this->plural = __( 'Dollars', 'event_espresso' ); 	// Dollars
1962
-			$this->sign =  '$'; 	// currency sign: $
1963
-			$this->sign_b4 = TRUE; 	// currency sign before or after: $TRUE  or  FALSE$
1964
-			$this->dec_plc = 2; 	// decimal places: 2 = 0.00  3 = 0.000
1965
-			$this->dec_mrk = '.'; 	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1966
-			$this->thsnds = ','; 	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1959
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
1960
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
1961
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
1962
+			$this->sign = '$'; // currency sign: $
1963
+			$this->sign_b4 = TRUE; // currency sign before or after: $TRUE  or  FALSE$
1964
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
1965
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1966
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1967 1967
 		}
1968 1968
 	}
1969 1969
 }
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
 	 * @since 4.8.8.rc.019
2104 2104
 	 */
2105 2105
 	public function do_hooks() {
2106
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ));
2106
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2107 2107
 	}
2108 2108
 
2109 2109
 
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
 	 * @return void
2112 2112
 	 */
2113 2113
 	public function set_default_reg_status_on_EEM_Event() {
2114
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2114
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2115 2115
 	}
2116 2116
 
2117 2117
 
@@ -2216,10 +2216,10 @@  discard block
 block discarded – undo
2216 2216
 	 * @param bool $reset
2217 2217
 	 * @return string
2218 2218
 	 */
2219
-	public function log_file_name( $reset = FALSE ) {
2220
-		if ( empty( $this->log_file_name ) || $reset ) {
2221
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt';
2222
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2219
+	public function log_file_name($reset = FALSE) {
2220
+		if (empty($this->log_file_name) || $reset) {
2221
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt';
2222
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2223 2223
 		}
2224 2224
 		return $this->log_file_name;
2225 2225
 	}
@@ -2231,10 +2231,10 @@  discard block
 block discarded – undo
2231 2231
 	 * @param bool $reset
2232 2232
 	 * @return string
2233 2233
 	 */
2234
-	public function debug_file_name( $reset = FALSE ) {
2235
-		if ( empty( $this->debug_file_name ) || $reset ) {
2236
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt';
2237
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2234
+	public function debug_file_name($reset = FALSE) {
2235
+		if (empty($this->debug_file_name) || $reset) {
2236
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt';
2237
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2238 2238
 		}
2239 2239
 		return $this->debug_file_name;
2240 2240
 	}
@@ -2407,21 +2407,21 @@  discard block
 block discarded – undo
2407 2407
 		// set default map settings
2408 2408
 		$this->use_google_maps = TRUE;
2409 2409
 		// for event details pages (reg page)
2410
-		$this->event_details_map_width = 585; 			// ee_map_width_single
2411
-		$this->event_details_map_height = 362; 			// ee_map_height_single
2412
-		$this->event_details_map_zoom = 14; 			// ee_map_zoom_single
2413
-		$this->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
2414
-		$this->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
2415
-		$this->event_details_control_type = 'default'; 		// ee_map_type_control_single
2416
-		$this->event_details_map_align = 'center'; 			// ee_map_align_single
2410
+		$this->event_details_map_width = 585; // ee_map_width_single
2411
+		$this->event_details_map_height = 362; // ee_map_height_single
2412
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2413
+		$this->event_details_display_nav = TRUE; // ee_map_nav_display_single
2414
+		$this->event_details_nav_size = FALSE; // ee_map_nav_size_single
2415
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2416
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2417 2417
 		// for event list pages
2418
-		$this->event_list_map_width = 300; 			// ee_map_width
2419
-		$this->event_list_map_height = 185; 		// ee_map_height
2420
-		$this->event_list_map_zoom = 12; 			// ee_map_zoom
2421
-		$this->event_list_display_nav = FALSE; 		// ee_map_nav_display
2422
-		$this->event_list_nav_size = TRUE; 			// ee_map_nav_size
2423
-		$this->event_list_control_type = 'dropdown'; 		// ee_map_type_control
2424
-		$this->event_list_map_align = 'center'; 			// ee_map_align
2418
+		$this->event_list_map_width = 300; // ee_map_width
2419
+		$this->event_list_map_height = 185; // ee_map_height
2420
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2421
+		$this->event_list_display_nav = FALSE; // ee_map_nav_display
2422
+		$this->event_list_nav_size = TRUE; // ee_map_nav_size
2423
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2424
+		$this->event_list_map_align = 'center'; // ee_map_align
2425 2425
 	}
2426 2426
 
2427 2427
 }
@@ -2432,7 +2432,7 @@  discard block
 block discarded – undo
2432 2432
 /**
2433 2433
  * stores Events_Archive settings
2434 2434
  */
2435
-class EE_Events_Archive_Config extends EE_Config_Base{
2435
+class EE_Events_Archive_Config extends EE_Config_Base {
2436 2436
 
2437 2437
 	public $display_status_banner;
2438 2438
 	public $display_description;
@@ -2451,7 +2451,7 @@  discard block
 block discarded – undo
2451 2451
 	/**
2452 2452
 	 *	class constructor
2453 2453
 	 */
2454
-	public function __construct(){
2454
+	public function __construct() {
2455 2455
 		$this->display_status_banner = 0;
2456 2456
 		$this->display_description = 1;
2457 2457
 		$this->display_ticket_selector = 0;
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 /**
2472 2472
  * Stores Event_Single_Config settings
2473 2473
  */
2474
-class EE_Event_Single_Config extends EE_Config_Base{
2474
+class EE_Event_Single_Config extends EE_Config_Base {
2475 2475
 
2476 2476
 	public $display_status_banner_single;
2477 2477
 	public $display_venue;
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
 /**
2501 2501
  * Stores Ticket_Selector_Config settings
2502 2502
  */
2503
-class EE_Ticket_Selector_Config extends EE_Config_Base{
2503
+class EE_Ticket_Selector_Config extends EE_Config_Base {
2504 2504
 	public $show_ticket_sale_columns;
2505 2505
 	public $show_ticket_details;
2506 2506
 	public $show_expired_tickets;
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
 	 * @return void
2555 2555
 	 */
2556 2556
 	protected function _set_php_values() {
2557
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2557
+		$this->php->max_input_vars = ini_get('max_input_vars');
2558 2558
 		$this->php->version = phpversion();
2559 2559
 	}
2560 2560
 
@@ -2573,8 +2573,8 @@  discard block
 block discarded – undo
2573 2573
 	 *         @type string $msg 		Any message to be displayed.
2574 2574
 	 * }
2575 2575
 	 */
2576
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2577
-		if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) {
2576
+	public function max_input_vars_limit_check($input_count = 0) {
2577
+		if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) {
2578 2578
 			return  __('The number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso');
2579 2579
 		} else {
2580 2580
 			return '';
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
  * stores payment gateway info
2611 2611
  * @deprecated
2612 2612
  */
2613
-class EE_Gateway_Config extends EE_Config_Base{
2613
+class EE_Gateway_Config extends EE_Config_Base {
2614 2614
 
2615 2615
 	/**
2616 2616
 	 * Array with keys that are payment gateways slugs, and values are arrays
@@ -2632,9 +2632,9 @@  discard block
 block discarded – undo
2632 2632
 	 *	class constructor
2633 2633
 	 * @deprecated
2634 2634
 	 */
2635
-	public function __construct(){
2635
+	public function __construct() {
2636 2636
 		$this->payment_settings = array();
2637
-		$this->active_gateways = array( 'Invoice' => FALSE );
2637
+		$this->active_gateways = array('Invoice' => FALSE);
2638 2638
 	}
2639 2639
 }
2640 2640
 
Please login to merge, or discard this patch.
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author				Event Espresso
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link					http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EE_Config
17
- *
18
- * @package			Event Espresso
19
- * @subpackage		core/
20
- * @author				Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author				Event Espresso
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+	 * @ link					http://www.eventespresso.com
12
+	 * @ version		 	4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * EE_Config
17
+	 *
18
+	 * @package			Event Espresso
19
+	 * @subpackage		core/
20
+	 * @author				Brent Christensen
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 final class EE_Config {
25 25
 
26 26
 
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	public $map_settings = null;
90 90
 
91 91
 	/**
92
-	*
93
-	* @deprecated
94
-	* @var EE_Gateway_Config
95
-	*/
92
+	 *
93
+	 * @deprecated
94
+	 * @var EE_Gateway_Config
95
+	 */
96 96
 	public $gateway = null;
97 97
 
98 98
 	/**
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 
583 583
 	/**
584 584
 	 *    update_config
585
-         * Important: the config object must ALREADY be set, otherwise this will produce an error.
585
+	 * Important: the config object must ALREADY be set, otherwise this will produce an error.
586 586
 	 *
587 587
 	 * @access    public
588 588
 	 * @param    string                 $section
@@ -1606,51 +1606,51 @@  discard block
 block discarded – undo
1606 1606
 class EE_Organization_Config extends EE_Config_Base {
1607 1607
 
1608 1608
 	/**
1609
-	* @var string  $name
1610
-	* eg EE4.1
1611
-	*/
1609
+	 * @var string  $name
1610
+	 * eg EE4.1
1611
+	 */
1612 1612
 	public $name;
1613 1613
 
1614 1614
 	/**
1615
-	* @var string $address_1
1616
-	* eg 123 Onna Road
1617
-	*/
1615
+	 * @var string $address_1
1616
+	 * eg 123 Onna Road
1617
+	 */
1618 1618
 	public $address_1;
1619 1619
 
1620 1620
 	/**
1621
-	* @var string $address_2
1622
-	* eg PO Box 123
1623
-	*/
1621
+	 * @var string $address_2
1622
+	 * eg PO Box 123
1623
+	 */
1624 1624
 	public $address_2;
1625 1625
 
1626 1626
 	/**
1627
-	* @var string $city
1628
-	* eg Inna City
1629
-	*/
1627
+	 * @var string $city
1628
+	 * eg Inna City
1629
+	 */
1630 1630
 	public $city;
1631 1631
 
1632 1632
 	/**
1633
-	* @var int $STA_ID
1634
-	* eg 4
1635
-	*/
1633
+	 * @var int $STA_ID
1634
+	 * eg 4
1635
+	 */
1636 1636
 	public $STA_ID;
1637 1637
 
1638 1638
 	/**
1639
-	* @var string  $CNT_ISO
1640
-	* eg US
1641
-	*/
1639
+	 * @var string  $CNT_ISO
1640
+	 * eg US
1641
+	 */
1642 1642
 	public $CNT_ISO;
1643 1643
 
1644 1644
 	/**
1645
-	* @var string $zip
1646
-	* eg 12345  or V1A 2B3
1647
-	*/
1645
+	 * @var string $zip
1646
+	 * eg 12345  or V1A 2B3
1647
+	 */
1648 1648
 	public $zip;
1649 1649
 
1650 1650
 	/**
1651
-	* @var string  $email
1652
-	* eg [email protected]
1653
-	*/
1651
+	 * @var string  $email
1652
+	 * eg [email protected]
1653
+	 */
1654 1654
 	public $email;
1655 1655
 
1656 1656
 
@@ -1669,9 +1669,9 @@  discard block
 block discarded – undo
1669 1669
 	public $vat;
1670 1670
 
1671 1671
 	/**
1672
-	* @var string  $logo_url
1673
-	* eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
1674
-	*/
1672
+	 * @var string  $logo_url
1673
+	 * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
1674
+	 */
1675 1675
 	public $logo_url;
1676 1676
 
1677 1677
 
@@ -1765,55 +1765,55 @@  discard block
 block discarded – undo
1765 1765
 class EE_Currency_Config extends EE_Config_Base {
1766 1766
 
1767 1767
 	/**
1768
-	* @var string  $code
1769
-	* eg 'US'
1770
-	*/
1768
+	 * @var string  $code
1769
+	 * eg 'US'
1770
+	 */
1771 1771
 	public $code;
1772 1772
 
1773 1773
 	/**
1774
-	* @var string $name
1775
-	* eg 'Dollar'
1776
-	*/
1774
+	 * @var string $name
1775
+	 * eg 'Dollar'
1776
+	 */
1777 1777
 	public $name;
1778 1778
 
1779 1779
 	/**
1780
-	* plural name
1781
-	* @var string $plural
1782
-	* eg 'Dollars'
1783
-	*/
1780
+	 * plural name
1781
+	 * @var string $plural
1782
+	 * eg 'Dollars'
1783
+	 */
1784 1784
 	public $plural;
1785 1785
 
1786 1786
 	/**
1787
-	* currency sign
1788
-	* @var string  $sign
1789
-	* eg '$'
1790
-	*/
1787
+	 * currency sign
1788
+	 * @var string  $sign
1789
+	 * eg '$'
1790
+	 */
1791 1791
 	public $sign;
1792 1792
 
1793 1793
 	/**
1794
-	* Whether the currency sign should come before the number or not
1795
-	* @var boolean $sign_b4
1796
-	*/
1794
+	 * Whether the currency sign should come before the number or not
1795
+	 * @var boolean $sign_b4
1796
+	 */
1797 1797
 	public $sign_b4;
1798 1798
 
1799 1799
 	/**
1800
-	* How many digits should come after the decimal place
1801
-	* @var int $dec_plc
1802
-	*/
1800
+	 * How many digits should come after the decimal place
1801
+	 * @var int $dec_plc
1802
+	 */
1803 1803
 	public $dec_plc;
1804 1804
 
1805 1805
 	/**
1806
-	* Symbol to use for decimal mark
1807
-	* @var string $dec_mrk
1808
-	* eg '.'
1809
-	*/
1806
+	 * Symbol to use for decimal mark
1807
+	 * @var string $dec_mrk
1808
+	 * eg '.'
1809
+	 */
1810 1810
 	public $dec_mrk;
1811 1811
 
1812 1812
 	/**
1813
-	* Symbol to use for thousands
1814
-	* @var string $thsnds
1815
-	* eg ','
1816
-	*/
1813
+	 * Symbol to use for thousands
1814
+	 * @var string $thsnds
1815
+	 * eg ','
1816
+	 */
1817 1817
 	public $thsnds;
1818 1818
 
1819 1819
 
@@ -1881,13 +1881,13 @@  discard block
 block discarded – undo
1881 1881
 	 * 	whether or not to show alternate payment options during the reg process if payment status is pending
1882 1882
 	 * @var boolean $show_pending_payment_options
1883 1883
 	 */
1884
-      public $show_pending_payment_options;
1884
+	  public $show_pending_payment_options;
1885 1885
 
1886 1886
 	/**
1887 1887
 	 * Whether to skip the registration confirmation page
1888 1888
 	 * @var boolean $skip_reg_confirmation
1889 1889
 	 */
1890
-      public $skip_reg_confirmation;
1890
+	  public $skip_reg_confirmation;
1891 1891
 
1892 1892
 	/**
1893 1893
 	 * an array of SPCO reg steps where:
@@ -1898,64 +1898,64 @@  discard block
 block discarded – undo
1898 1898
 	 * 			"slug" => the URL param used to trigger the reg step
1899 1899
 	 * @var array $reg_steps
1900 1900
 	 */
1901
-      public $reg_steps;
1901
+	  public $reg_steps;
1902 1902
 
1903 1903
 	/**
1904 1904
 	 * Whether registration confirmation should be the last page of SPCO
1905 1905
 	 * @var boolean $reg_confirmation_last
1906 1906
 	 */
1907
-      public $reg_confirmation_last;
1907
+	  public $reg_confirmation_last;
1908 1908
 
1909 1909
 	  /**
1910 1910
 	   * Whether or not to enable the EE Bot Trap
1911 1911
 	   * @var boolean $use_bot_trap
1912 1912
 	   */
1913
-      public $use_bot_trap;
1913
+	  public $use_bot_trap;
1914 1914
 
1915 1915
 	  /**
1916 1916
 	   * Whether or not to encrypt some data sent by the EE Bot Trap
1917 1917
 	   * @var boolean $use_encryption
1918 1918
 	   */
1919
-      public $use_encryption;
1919
+	  public $use_encryption;
1920 1920
 
1921 1921
 	  /**
1922 1922
 	   * Whether or not to use ReCaptcha
1923 1923
 	   * @var boolean $use_captcha
1924 1924
 	   */
1925
-      public $use_captcha;
1925
+	  public $use_captcha;
1926 1926
 
1927 1927
 	  /**
1928 1928
 	   * ReCaptcha Theme
1929 1929
 	   * @var string $recaptcha_theme
1930 1930
 	   * 	options: 'dark	', 'light'
1931 1931
 	   */
1932
-      public $recaptcha_theme;
1932
+	  public $recaptcha_theme;
1933 1933
 
1934 1934
 	  /**
1935 1935
 	   * ReCaptcha Type
1936 1936
 	   * @var string $recaptcha_type
1937 1937
 	   * 	options: 'audio', 'image'
1938 1938
 	   */
1939
-      public $recaptcha_type;
1939
+	  public $recaptcha_type;
1940 1940
 
1941 1941
 	  /**
1942 1942
 	   * ReCaptcha language
1943 1943
 	   * @var string $recaptcha_language
1944 1944
 	   * eg 'en'
1945 1945
 	   */
1946
-      public $recaptcha_language;
1946
+	  public $recaptcha_language;
1947 1947
 
1948 1948
 	  /**
1949 1949
 	   * ReCaptcha public key
1950 1950
 	   * @var string $recaptcha_publickey
1951 1951
 	   */
1952
-      public $recaptcha_publickey;
1952
+	  public $recaptcha_publickey;
1953 1953
 
1954 1954
 	  /**
1955 1955
 	   * ReCaptcha private key
1956 1956
 	   * @var string $recaptcha_privatekey
1957 1957
 	   */
1958
-      public $recaptcha_privatekey;
1958
+	  public $recaptcha_privatekey;
1959 1959
 
1960 1960
 	/**
1961 1961
 	 * ReCaptcha width
@@ -2021,58 +2021,58 @@  discard block
 block discarded – undo
2021 2021
 class EE_Admin_Config extends EE_Config_Base {
2022 2022
 
2023 2023
 	/**
2024
-	* @var boolean $use_personnel_manager
2025
-	*/
2024
+	 * @var boolean $use_personnel_manager
2025
+	 */
2026 2026
 	public $use_personnel_manager;
2027 2027
 
2028 2028
 	/**
2029
-	* @var boolean $use_dashboard_widget
2030
-	*/
2029
+	 * @var boolean $use_dashboard_widget
2030
+	 */
2031 2031
 	public $use_dashboard_widget;
2032 2032
 
2033 2033
 	/**
2034
-	* @var int $events_in_dashboard
2035
-	*/
2034
+	 * @var int $events_in_dashboard
2035
+	 */
2036 2036
 	public $events_in_dashboard;
2037 2037
 
2038 2038
 	/**
2039
-	* @var boolean $use_event_timezones
2040
-	*/
2039
+	 * @var boolean $use_event_timezones
2040
+	 */
2041 2041
 	public $use_event_timezones;
2042 2042
 
2043 2043
 	/**
2044
-	* @var boolean $use_full_logging
2045
-	*/
2044
+	 * @var boolean $use_full_logging
2045
+	 */
2046 2046
 	public $use_full_logging;
2047 2047
 
2048 2048
 	/**
2049
-	* @var string $log_file_name
2050
-	*/
2049
+	 * @var string $log_file_name
2050
+	 */
2051 2051
 	public $log_file_name;
2052 2052
 
2053 2053
 	/**
2054
-	* @var string $debug_file_name
2055
-	*/
2054
+	 * @var string $debug_file_name
2055
+	 */
2056 2056
 	public $debug_file_name;
2057 2057
 
2058 2058
 	/**
2059
-	* @var boolean $use_remote_logging
2060
-	*/
2059
+	 * @var boolean $use_remote_logging
2060
+	 */
2061 2061
 	public $use_remote_logging;
2062 2062
 
2063 2063
 	/**
2064
-	* @var string $remote_logging_url
2065
-	*/
2064
+	 * @var string $remote_logging_url
2065
+	 */
2066 2066
 	public $remote_logging_url;
2067 2067
 
2068 2068
 	/**
2069
-	* @var boolean $show_reg_footer
2070
-	*/
2069
+	 * @var boolean $show_reg_footer
2070
+	 */
2071 2071
 	public $show_reg_footer;
2072 2072
 
2073 2073
 	/**
2074
-	* @var string $affiliate_id
2075
-	*/
2074
+	 * @var string $affiliate_id
2075
+	 */
2076 2076
 	public $affiliate_id;
2077 2077
 
2078 2078
 
@@ -2146,43 +2146,43 @@  discard block
 block discarded – undo
2146 2146
 class EE_Template_Config extends EE_Config_Base {
2147 2147
 
2148 2148
 	/**
2149
-	* @var boolean $enable_default_style
2150
-	*/
2149
+	 * @var boolean $enable_default_style
2150
+	 */
2151 2151
 	public $enable_default_style;
2152 2152
 
2153 2153
 	/**
2154
-	* @var string $custom_style_sheet
2155
-	*/
2154
+	 * @var string $custom_style_sheet
2155
+	 */
2156 2156
 	public $custom_style_sheet;
2157 2157
 
2158 2158
 	/**
2159
-	* @var boolean $display_address_in_regform
2160
-	*/
2159
+	 * @var boolean $display_address_in_regform
2160
+	 */
2161 2161
 	public $display_address_in_regform;
2162 2162
 
2163 2163
 	/**
2164
-	* @var int $display_description_on_multi_reg_page
2165
-	*/
2164
+	 * @var int $display_description_on_multi_reg_page
2165
+	 */
2166 2166
 	public $display_description_on_multi_reg_page;
2167 2167
 
2168 2168
 	/**
2169
-	* @var boolean $use_custom_templates
2170
-	*/
2169
+	 * @var boolean $use_custom_templates
2170
+	 */
2171 2171
 	public $use_custom_templates;
2172 2172
 
2173 2173
 	/**
2174
-	* @var string $current_espresso_theme
2175
-	*/
2174
+	 * @var string $current_espresso_theme
2175
+	 */
2176 2176
 	public $current_espresso_theme;
2177 2177
 
2178 2178
 	/**
2179
-	* @var EE_Event_Single_Config $EED_Event_Single
2180
-	*/
2179
+	 * @var EE_Event_Single_Config $EED_Event_Single
2180
+	 */
2181 2181
 	public $EED_Event_Single;
2182 2182
 
2183 2183
 	/**
2184
-	* @var EE_Events_Archive_Config $EED_Events_Archive
2185
-	*/
2184
+	 * @var EE_Events_Archive_Config $EED_Events_Archive
2185
+	 */
2186 2186
 	public $EED_Events_Archive;
2187 2187
 
2188 2188
 
@@ -2215,78 +2215,78 @@  discard block
 block discarded – undo
2215 2215
 class EE_Map_Config extends EE_Config_Base {
2216 2216
 
2217 2217
 	/**
2218
-	* @var boolean $use_google_maps
2219
-	*/
2218
+	 * @var boolean $use_google_maps
2219
+	 */
2220 2220
 	public $use_google_maps;
2221 2221
 
2222 2222
 	/**
2223
-	* @var int $event_details_map_width
2224
-	*/
2223
+	 * @var int $event_details_map_width
2224
+	 */
2225 2225
 	public $event_details_map_width;
2226 2226
 
2227 2227
 	/**
2228
-	* @var int $event_details_map_height
2229
-	*/
2228
+	 * @var int $event_details_map_height
2229
+	 */
2230 2230
 	public $event_details_map_height;
2231 2231
 
2232 2232
 	/**
2233
-	* @var int $event_details_map_zoom
2234
-	*/
2233
+	 * @var int $event_details_map_zoom
2234
+	 */
2235 2235
 	public $event_details_map_zoom;
2236 2236
 
2237 2237
 	/**
2238
-	* @var boolean $event_details_display_nav
2239
-	*/
2238
+	 * @var boolean $event_details_display_nav
2239
+	 */
2240 2240
 	public $event_details_display_nav;
2241 2241
 
2242 2242
 	/**
2243
-	* @var boolean $event_details_nav_size
2244
-	*/
2243
+	 * @var boolean $event_details_nav_size
2244
+	 */
2245 2245
 	public $event_details_nav_size;
2246 2246
 
2247 2247
 	/**
2248
-	* @var string $event_details_control_type
2249
-	*/
2248
+	 * @var string $event_details_control_type
2249
+	 */
2250 2250
 	public $event_details_control_type;
2251 2251
 
2252 2252
 	/**
2253
-	* @var string $event_details_map_align
2254
-	*/
2253
+	 * @var string $event_details_map_align
2254
+	 */
2255 2255
 	public $event_details_map_align;
2256 2256
 
2257 2257
 	/**
2258
-	* @var int $event_list_map_width
2259
-	*/
2258
+	 * @var int $event_list_map_width
2259
+	 */
2260 2260
 	public $event_list_map_width;
2261 2261
 
2262 2262
 	/**
2263
-	* @var int $event_list_map_height
2264
-	*/
2263
+	 * @var int $event_list_map_height
2264
+	 */
2265 2265
 	public $event_list_map_height;
2266 2266
 
2267 2267
 	/**
2268
-	* @var int $event_list_map_zoom
2269
-	*/
2268
+	 * @var int $event_list_map_zoom
2269
+	 */
2270 2270
 	public $event_list_map_zoom;
2271 2271
 
2272 2272
 	/**
2273
-	* @var boolean $event_list_display_nav
2274
-	*/
2273
+	 * @var boolean $event_list_display_nav
2274
+	 */
2275 2275
 	public $event_list_display_nav;
2276 2276
 
2277 2277
 	/**
2278
-	* @var boolean $event_list_nav_size
2279
-	*/
2278
+	 * @var boolean $event_list_nav_size
2279
+	 */
2280 2280
 	public $event_list_nav_size;
2281 2281
 
2282 2282
 	/**
2283
-	* @var string $event_list_control_type
2284
-	*/
2283
+	 * @var string $event_list_control_type
2284
+	 */
2285 2285
 	public $event_list_control_type;
2286 2286
 
2287 2287
 	/**
2288
-	* @var string $event_list_map_align
2289
-	*/
2288
+	 * @var string $event_list_map_align
2289
+	 */
2290 2290
 	public $event_list_map_align;
2291 2291
 
2292 2292
 
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Config.lib.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 	 *                       		}
43 43
 	 * @return void
44 44
 	 */
45
-	public static function register( $config_class = NULL, $setup_args = array() ) {
45
+	public static function register($config_class = NULL, $setup_args = array()) {
46 46
 
47
-		$setup_args['config_name'] = isset( $setup_args['config_name'] ) && ! empty( $setup_args['config_name'] ) ? $setup_args['config_name'] : $config_class;
48
-		$setup_args['config_section'] = isset( $setup_args['config_section'] ) && ! empty( $setup_args['config_section'] ) ? $setup_args['config_section'] : 'addons';
47
+		$setup_args['config_name'] = isset($setup_args['config_name']) && ! empty($setup_args['config_name']) ? $setup_args['config_name'] : $config_class;
48
+		$setup_args['config_section'] = isset($setup_args['config_section']) && ! empty($setup_args['config_section']) ? $setup_args['config_section'] : 'addons';
49 49
 
50 50
 		//required fields MUST be present, so let's make sure they are.
51
-		if ( empty( $config_class ) || ! is_array( $setup_args ) || empty( $setup_args['config_name'] )) {
52
-			throw new EE_Error( __( 'In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})', 'event_espresso' ));
51
+		if (empty($config_class) || ! is_array($setup_args) || empty($setup_args['config_name'])) {
52
+			throw new EE_Error(__('In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})', 'event_espresso'));
53 53
 		}
54 54
 
55 55
 		//make sure we don't register twice
56
-		if( isset( self::$_ee_config_registry[ $config_class ] ) ){
56
+		if (isset(self::$_ee_config_registry[$config_class])) {
57 57
 			return;
58 58
 		}
59 59
 
60 60
 
61 61
 		//first find out if this happened too late.
62
-		if ( did_action( 'AHEE__EE_System__load_core_configuration__begin' ) ) {
62
+		if (did_action('AHEE__EE_System__load_core_configuration__begin')) {
63 63
 			EE_Error::doing_it_wrong(
64 64
 				__METHOD__,
65 65
 				sprintf(
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 				);
71 71
 		}
72 72
 		//add incoming stuff to our registry property
73
-		self::$_ee_config_registry[ $config_class ] = array(
73
+		self::$_ee_config_registry[$config_class] = array(
74 74
 			'section' => $setup_args['config_section'],
75 75
 			'name' => $setup_args['config_name']
76 76
 		);
77 77
 
78
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( 'EE_Register_Config', 'set_config' ), 15, 1 );
79
-		add_action( 'AHEE__EE_Config__update_espresso_config__end', array( 'EE_Register_Config', 'set_config' ), 15, 1 );
78
+		add_action('AHEE__EE_Config___load_core_config__end', array('EE_Register_Config', 'set_config'), 15, 1);
79
+		add_action('AHEE__EE_Config__update_espresso_config__end', array('EE_Register_Config', 'set_config'), 15, 1);
80 80
 	}
81 81
 
82 82
 
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
 	 * @param \EE_Config $EE_Config
91 91
 	 * @return \StdClass
92 92
 	 */
93
-	public static function set_config( EE_Config $EE_Config ) {
94
-		foreach ( self::$_ee_config_registry as $config_class => $settings ) {
93
+	public static function set_config(EE_Config $EE_Config) {
94
+		foreach (self::$_ee_config_registry as $config_class => $settings) {
95 95
 			//first some validation of our incoming class_name.  We'll throw an error early if its' not registered correctly
96
-			if ( ! class_exists( $config_class )) {
96
+			if ( ! class_exists($config_class)) {
97 97
 				throw new EE_Error(
98 98
 					sprintf(
99
-						__( 'The "%s" config class can not be registered with EE_Config because it does not exist.  Verify that an autoloader has been set for this class', 'event_espresso' ),
99
+						__('The "%s" config class can not be registered with EE_Config because it does not exist.  Verify that an autoloader has been set for this class', 'event_espresso'),
100 100
 						$config_class
101 101
 					)
102 102
 				 );
103 103
 			}
104
-			$EE_Config->get_config( $settings['section'], $settings['name'], $config_class );
104
+			$EE_Config->get_config($settings['section'], $settings['name'], $config_class);
105 105
 		}
106 106
 	}
107 107
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	/**
112 112
 	 * @param mixed $config_class_name
113 113
 	 */
114
-	public static function deregister( $config_class_name = NULL ) {
115
-		if ( ! empty( self::$_ee_config_registry[ $config_class_name ] ))
116
-    			unset( self::$_ee_config_registry[ $config_class_name ] );
114
+	public static function deregister($config_class_name = NULL) {
115
+		if ( ! empty(self::$_ee_config_registry[$config_class_name]))
116
+    			unset(self::$_ee_config_registry[$config_class_name]);
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,6 +113,6 @@
 block discarded – undo
113 113
 	 */
114 114
 	public static function deregister( $config_class_name = NULL ) {
115 115
 		if ( ! empty( self::$_ee_config_registry[ $config_class_name ] ))
116
-    			unset( self::$_ee_config_registry[ $config_class_name ] );
116
+				unset( self::$_ee_config_registry[ $config_class_name ] );
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
core/libraries/batch/Helpers/JobParameters.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	/**
215 215
 	 * Gets a single item from the request data
216 216
 	 * @param string $key
217
-	 * @param string|array $default
217
+	 * @param string $default
218 218
 	 * @return string|array
219 219
 	 */
220 220
 	function request_datum( $key, $default = '' ) {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * Gets a single item from the extra data
232 232
 	 * @param string $key
233 233
 	 * @param string|array $default
234
-	 * @return string|array
234
+	 * @return string
235 235
 	 */
236 236
 	function extra_datum( $key, $default = '' ) {
237 237
 		if( isset( $this->_extra_data[ $key ] ) ) {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	/**
247 247
 	 * Adds an extra piece of extra data that we're going to want later during the job
248 248
 	 * @param string $key
249
-	 * @param string|int|array|null $value almost any extra data you want to store
249
+	 * @param string $value almost any extra data you want to store
250 250
 	 */
251 251
 	function add_extra_data( $key, $value ) {
252 252
 		$this->_extra_data[ $key ] = $value;
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	 * @param array $request_data
97 97
 	 * @param array $extra_data
98 98
 	 */
99
-	function __construct( $job_id, $classname, $request_data, $extra_data = array() ) {
100
-		$this->set_job_id( $job_id );
101
-		$this->set_classname( $classname );
102
-		$this->set_request_data( $request_data );
103
-		$this->set_extra_data( $extra_data );
104
-		$this->set_status( JobParameters::status_continue );
99
+	function __construct($job_id, $classname, $request_data, $extra_data = array()) {
100
+		$this->set_job_id($job_id);
101
+		$this->set_classname($classname);
102
+		$this->set_request_data($request_data);
103
+		$this->set_extra_data($extra_data);
104
+		$this->set_status(JobParameters::status_continue);
105 105
 	}
106 106
 
107 107
 
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 * @param boolean $first
127 127
 	 * @return boolean success
128 128
 	 */
129
-	function save( $first = false ) {
130
-		$object_vars = wp_json_encode( get_object_vars( $this ) );
131
-		if( $first ) {
132
-			return add_option( $this->option_name(), $object_vars, null, 'no' );
133
-		} else{
134
-			return update_option( $this->option_name(), $object_vars );
129
+	function save($first = false) {
130
+		$object_vars = wp_json_encode(get_object_vars($this));
131
+		if ($first) {
132
+			return add_option($this->option_name(), $object_vars, null, 'no');
133
+		} else {
134
+			return update_option($this->option_name(), $object_vars);
135 135
 		}
136 136
 	}
137 137
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return boolean
144 144
 	 */
145 145
 	function delete() {
146
-		return delete_option( $this->option_name() );
146
+		return delete_option($this->option_name());
147 147
 	}
148 148
 
149 149
 
@@ -154,26 +154,26 @@  discard block
 block discarded – undo
154 154
 	 * @return JobParameters
155 155
 	 * @throws BatchRequestException
156 156
 	 */
157
-	static function load( $job_id ) {
158
-		$job_parameter_vars = json_decode( get_option( JobParameters::wp_option_prefix . $job_id ), true );
159
-		if(
160
-			! is_array( $job_parameter_vars ) ||
161
-			! isset( $job_parameter_vars[ '_classname' ] ) ||
162
-			! isset( $job_parameter_vars[ '_request_data' ] )
157
+	static function load($job_id) {
158
+		$job_parameter_vars = json_decode(get_option(JobParameters::wp_option_prefix.$job_id), true);
159
+		if (
160
+			! is_array($job_parameter_vars) ||
161
+			! isset($job_parameter_vars['_classname']) ||
162
+			! isset($job_parameter_vars['_request_data'])
163 163
 		) {
164 164
 			throw new BatchRequestException(
165 165
 				sprintf( 
166 166
 					__('Could not retrieve job %1$s from the Wordpress options table, and so the job could not continue. The wordpress option was %2$s', 'event_espresso'),
167 167
 					$job_id,
168
-					get_option( JobParameters::wp_option_prefix . $job_id )
168
+					get_option(JobParameters::wp_option_prefix.$job_id)
169 169
 				)
170 170
 			);
171 171
 		}
172 172
 		$job_parameters = new JobParameters( 
173 173
 				$job_id, 
174
-				$job_parameter_vars[ '_classname' ], 
175
-				$job_parameter_vars[ '_request_data'] );
176
-		foreach( $job_parameter_vars as $key => $value ) {
174
+				$job_parameter_vars['_classname'], 
175
+				$job_parameter_vars['_request_data'] );
176
+		foreach ($job_parameter_vars as $key => $value) {
177 177
 			$job_parameters->$key = $value;
178 178
 		}
179 179
 		return $job_parameters;
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param string|array $default
218 218
 	 * @return string|array
219 219
 	 */
220
-	function request_datum( $key, $default = '' ) {
221
-		if( isset( $this->_request_data[ $key ] ) ) {
222
-			return $this->_request_data[ $key ];
220
+	function request_datum($key, $default = '') {
221
+		if (isset($this->_request_data[$key])) {
222
+			return $this->_request_data[$key];
223 223
 		} else {
224 224
 			return $default;
225 225
 		}
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 	 * @param string|array $default
234 234
 	 * @return string|array
235 235
 	 */
236
-	function extra_datum( $key, $default = '' ) {
237
-		if( isset( $this->_extra_data[ $key ] ) ) {
238
-			return $this->_extra_data[ $key ];
236
+	function extra_datum($key, $default = '') {
237
+		if (isset($this->_extra_data[$key])) {
238
+			return $this->_extra_data[$key];
239 239
 		} else {
240 240
 			return $default;
241 241
 		}
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param string $key
249 249
 	 * @param string|int|array|null $value almost any extra data you want to store
250 250
 	 */
251
-	function add_extra_data( $key, $value ) {
252
-		$this->_extra_data[ $key ] = $value;
251
+	function add_extra_data($key, $value) {
252
+		$this->_extra_data[$key] = $value;
253 253
 	}
254 254
 
255 255
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * Sets the job size. You decide what units to use
279 279
 	 * @param int $size
280 280
 	 */
281
-	function set_job_size( $size ) {
281
+	function set_job_size($size) {
282 282
 		$this->_job_size = $size;
283 283
 	}
284 284
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @param int $newly_processed
300 300
 	 * @return int updated units processed
301 301
 	 */
302
-	function mark_processed( $newly_processed ) {
302
+	function mark_processed($newly_processed) {
303 303
 		$this->_units_processed += $newly_processed;
304 304
 		return $this->_units_processed;
305 305
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * Sets the total count of units processed. You might prefer to use mark_processed
311 311
 	 * @param int $total_units_processed
312 312
 	 */
313
-	function set_units_processed( $total_units_processed ) {
313
+	function set_units_processed($total_units_processed) {
314 314
 		$this->_units_processed = $total_units_processed;
315 315
 	}
316 316
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * Sets the job's ID
321 321
 	 * @param string $job_id
322 322
 	 */
323
-	function set_job_id( $job_id ) {
323
+	function set_job_id($job_id) {
324 324
 		$this->_job_id = $job_id;
325 325
 	}
326 326
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * sets the classname
331 331
 	 * @param string $classname
332 332
 	 */
333
-	function set_classname( $classname ) {
333
+	function set_classname($classname) {
334 334
 		$this->_classname = $classname;
335 335
 	}
336 336
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 * Sets the request data
341 341
 	 * @param array $request_data
342 342
 	 */
343
-	function set_request_data( $request_data ) {
343
+	function set_request_data($request_data) {
344 344
 		$this->_request_data = $request_data;
345 345
 	}
346 346
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * Sets the array of extra data we want to store on this request
351 351
 	 * @param array $extra_data
352 352
 	 */
353
-	function set_extra_data( $extra_data ) {
353
+	function set_extra_data($extra_data) {
354 354
 		$this->_extra_data = $extra_data;
355 355
 	}
356 356
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @return string
362 362
 	 */
363 363
 	function option_name() {
364
-		return JobParameters::wp_option_prefix . $this->job_id();
364
+		return JobParameters::wp_option_prefix.$this->job_id();
365 365
 	}
366 366
 
367 367
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @param string $status on eof JobParameters::valid_stati()
382 382
 	 */
383
-	public function set_status( $status ) {
383
+	public function set_status($status) {
384 384
 		$this->_status = $status;
385 385
 	}
386 386
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- *
4
- * Class JobParameters
5
- *
6
- * Class for storing information about a job. Takes care of serializing the
7
- * data for storing in a wordpress option
8
- *
9
- * @package         Event Espresso
10
- * @subpackage    batch
11
- * @author				Mike Nelson
12
- * @since		 	   4.8.26
13
- *
14
- */
3
+	 *
4
+	 * Class JobParameters
5
+	 *
6
+	 * Class for storing information about a job. Takes care of serializing the
7
+	 * data for storing in a wordpress option
8
+	 *
9
+	 * @package         Event Espresso
10
+	 * @subpackage    batch
11
+	 * @author				Mike Nelson
12
+	 * @since		 	   4.8.26
13
+	 *
14
+	 */
15 15
 namespace EventEspressoBatchRequest\Helpers;
16 16
 
17 17
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/AttendeesReport.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -87,6 +87,11 @@
 block discarded – undo
87 87
 	public function count_units_to_process() {
88 88
 		return \EEM_Attendee::instance()->count();
89 89
 	}
90
+
91
+	/**
92
+	 * @param integer $offset
93
+	 * @param integer $limit
94
+	 */
90 95
 	public function get_csv_data( $offset, $limit ) {
91 96
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
92 97
 				array( 
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use EventEspressoBatchRequest\Helpers\JobParameters;
19 19
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
20 20
 
21
-if (!defined('EVENT_ESPRESSO_VERSION')) {
21
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
22 22
 	exit('No direct script access allowed');
23 23
 }
24 24
 
@@ -27,83 +27,83 @@  discard block
 block discarded – undo
27 27
 	
28 28
 	
29 29
 	public function create_job(JobParameters $job_parameters) {
30
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) {
30
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) {
31 31
 			throw new BatchRequestException(
32
-				__( 'You do not have permission to view contacts', 'event_espresso')
32
+				__('You do not have permission to view contacts', 'event_espresso')
33 33
 			);
34 34
 		}
35 35
 		$filepath = $this->create_file_from_job_with_name(
36 36
 			$job_parameters->job_id(),
37 37
 			__('contact-list-report.csv', 'event_espresso')
38 38
 		);
39
-		$job_parameters->add_extra_data( 'filepath', $filepath );
40
-		$job_parameters->set_job_size( $this->count_units_to_process() );
39
+		$job_parameters->add_extra_data('filepath', $filepath);
40
+		$job_parameters->set_job_size($this->count_units_to_process());
41 41
 		//we should also set the header columns
42
-		$csv_data_for_row = $this->get_csv_data( 0, 1 );
43
-		\EE_Registry::instance()->load_helper( 'Export' );
44
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
42
+		$csv_data_for_row = $this->get_csv_data(0, 1);
43
+		\EE_Registry::instance()->load_helper('Export');
44
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
45 45
 		//if we actually processed a row there, record it
46
-		if( $job_parameters->job_size() ) {
47
-			$job_parameters->mark_processed( 1 );
46
+		if ($job_parameters->job_size()) {
47
+			$job_parameters->mark_processed(1);
48 48
 		}
49 49
 		return new JobStepResponse(
50 50
 			$job_parameters,
51
-			__( 'Contacts report started successfully...', 'event_espresso' )
51
+			__('Contacts report started successfully...', 'event_espresso')
52 52
 		);
53 53
 	}
54 54
 	
55 55
 
56 56
 	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
57
-		$csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size );
58
-		\EE_Registry::instance()->load_helper( 'Export' );
59
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
60
-		$units_processed = count( $csv_data );
61
-		$job_parameters->mark_processed( $units_processed );
57
+		$csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size);
58
+		\EE_Registry::instance()->load_helper('Export');
59
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
60
+		$units_processed = count($csv_data);
61
+		$job_parameters->mark_processed($units_processed);
62 62
 		$extra_response_data = array(
63 63
 			'file_url' => ''
64 64
 		);
65
-		if( $units_processed < $batch_size ) {
66
-			$job_parameters->set_status( JobParameters::status_complete );
67
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
65
+		if ($units_processed < $batch_size) {
66
+			$job_parameters->set_status(JobParameters::status_complete);
67
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
68 68
 		}
69 69
 		return new JobStepResponse(
70 70
 				$job_parameters,
71 71
 				sprintf(
72
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
73
-					count( $csv_data ) ),
72
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
73
+					count($csv_data) ),
74 74
 				$extra_response_data );
75 75
 	}
76 76
 
77 77
 	
78 78
 	public function cleanup_job(JobParameters $job_parameters) {
79 79
 		$this->_file_helper->delete(
80
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
80
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
81 81
 			true,
82 82
 			'd'
83 83
 		);
84
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
84
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
85 85
 	}
86 86
 	
87 87
 	public function count_units_to_process() {
88 88
 		return \EEM_Attendee::instance()->count();
89 89
 	}
90
-	public function get_csv_data( $offset, $limit ) {
90
+	public function get_csv_data($offset, $limit) {
91 91
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
92 92
 				array( 
93
-					'limit' => array( $offset, $limit ),
94
-					'force_join' => array( 'State', 'Country' ) ) );
93
+					'limit' => array($offset, $limit),
94
+					'force_join' => array('State', 'Country') ) );
95 95
 		$csv_data = array();
96
-		foreach( $attendee_rows as $attendee_row ){
96
+		foreach ($attendee_rows as $attendee_row) {
97 97
 			$csv_row = array();
98
-			foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
99
-				if( $field_name == 'STA_ID' ){
100
-					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
101
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
102
-				}elseif( $field_name == 'CNT_ISO' ){
103
-					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
104
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
105
-				}else{
106
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
98
+			foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
99
+				if ($field_name == 'STA_ID') {
100
+					$state_name_field = \EEM_State::instance()->field_settings_for('STA_name');
101
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
102
+				}elseif ($field_name == 'CNT_ISO') {
103
+					$country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name');
104
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
105
+				} else {
106
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
107 107
 				}
108 108
 			}
109 109
 			$csv_data[] = $csv_row;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,10 +99,10 @@
 block discarded – undo
99 99
 				if( $field_name == 'STA_ID' ){
100 100
 					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
101 101
 					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
102
-				}elseif( $field_name == 'CNT_ISO' ){
102
+				} elseif( $field_name == 'CNT_ISO' ){
103 103
 					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
104 104
 					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
105
-				}else{
105
+				} else{
106 106
 					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
107 107
 				}
108 108
 			}
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/RegistrationsReport.php 3 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,6 +115,10 @@  discard block
 block discarded – undo
115 115
 				$extra_response_data );
116 116
 	}
117 117
 
118
+	/**
119
+	 * @param integer $offset
120
+	 * @param integer $limit
121
+	 */
118 122
 	function get_csv_data_for( $event_id, $offset, $limit ) {
119 123
 		\EE_Registry::instance()->load_helper( 'Export' );
120 124
 		$reg_fields_to_include = array(
@@ -382,7 +386,7 @@  discard block
 block discarded – undo
382 386
 	 * Performs any clean-up logic when we know the job is completed.
383 387
 	 * In this case, we delete the temporary file
384 388
 	 * @param JobParameters $job_parameters
385
-	 * @return boolean
389
+	 * @return JobStepResponse
386 390
 	 */
387 391
 	public function cleanup_job( JobParameters $job_parameters ){
388 392
 		$this->_file_helper->delete(
Please login to merge, or discard this patch.
Spacing   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 use EventEspressoBatchRequest\Helpers\JobParameters;
20 20
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
21 21
 
22
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
23
-	exit( 'No direct script access allowed' );
22
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
23
+	exit('No direct script access allowed');
24 24
 }
25 25
 
26 26
 
@@ -35,30 +35,30 @@  discard block
 block discarded – undo
35 35
 	 * @throws BatchRequestException
36 36
 	 * @return JobStepResponse
37 37
 	 */
38
-	public function create_job( JobParameters $job_parameters ) {
39
-		$event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) );
40
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) {
38
+	public function create_job(JobParameters $job_parameters) {
39
+		$event_id = intval($job_parameters->request_datum('EVT_ID', '0'));
40
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) {
41 41
 			throw new BatchRequestException(
42
-				__( 'You do not have permission to view registrations', 'event_espresso')
42
+				__('You do not have permission to view registrations', 'event_espresso')
43 43
 			);
44 44
 		}
45 45
 		$filepath = $this->create_file_from_job_with_name(
46 46
 			$job_parameters->job_id(),
47
-			$this->get_filename_from_event( $event_id )
47
+			$this->get_filename_from_event($event_id)
48 48
 		);
49
-		$job_parameters->add_extra_data( 'filepath', $filepath );
50
-		$job_parameters->set_job_size( $this->count_units_to_process( $event_id ) );
49
+		$job_parameters->add_extra_data('filepath', $filepath);
50
+		$job_parameters->set_job_size($this->count_units_to_process($event_id));
51 51
 		//we should also set the header columns
52
-		$csv_data_for_row = $this->get_csv_data_for( $event_id, 0, 1 );
53
-		\EE_Registry::instance()->load_helper( 'Export' );
54
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
52
+		$csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1);
53
+		\EE_Registry::instance()->load_helper('Export');
54
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
55 55
 		//if we actually processed a row there, record it
56
-		if( $job_parameters->job_size() ) {
57
-			$job_parameters->mark_processed( 1 );
56
+		if ($job_parameters->job_size()) {
57
+			$job_parameters->mark_processed(1);
58 58
 		}
59 59
 		return new JobStepResponse(
60 60
 			$job_parameters,
61
-			__( 'Registrations report started successfully...', 'event_espresso' )
61
+			__('Registrations report started successfully...', 'event_espresso')
62 62
 		);
63 63
 	}
64 64
 
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
 	 * @param int $event_id
70 70
 	 * @return string
71 71
 	 */
72
-	protected function get_filename_from_event( $event_id ) {
73
-		if( $event_id ){
74
-			$event_slug =  \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
75
-			if( ! $event_slug ) {
76
-				$event_slug = __( 'unknown', 'event_espresso' );
72
+	protected function get_filename_from_event($event_id) {
73
+		if ($event_id) {
74
+			$event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
75
+			if ( ! $event_slug) {
76
+				$event_slug = __('unknown', 'event_espresso');
77 77
 			}
78
-		}else{
79
-			$event_slug = __( 'all', 'event_espresso' );
78
+		} else {
79
+			$event_slug = __('all', 'event_espresso');
80 80
 		}
81
-		return sprintf( "registrations-for-%s.csv", $event_slug );
81
+		return sprintf("registrations-for-%s.csv", $event_slug);
82 82
 	}
83 83
 
84 84
 
@@ -94,29 +94,29 @@  discard block
 block discarded – undo
94 94
 	 * } and anything more we want to add
95 95
 	 * @throws
96 96
 	 */
97
-	public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) {
98
-		$csv_data = $this->get_csv_data_for( $job_parameters->request_datum( 'EVT_ID', '0'), $job_parameters->units_processed(), $batch_size );
99
-		\EE_Registry::instance()->load_helper( 'Export' );
100
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
101
-		$units_processed = count( $csv_data );
102
-		$job_parameters->mark_processed( $units_processed );
97
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
98
+		$csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'), $job_parameters->units_processed(), $batch_size);
99
+		\EE_Registry::instance()->load_helper('Export');
100
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
101
+		$units_processed = count($csv_data);
102
+		$job_parameters->mark_processed($units_processed);
103 103
 		$extra_response_data = array(
104 104
 			'file_url' => ''
105 105
 		);
106
-		if( $units_processed < $batch_size ) {
107
-			$job_parameters->set_status( JobParameters::status_complete );
108
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
106
+		if ($units_processed < $batch_size) {
107
+			$job_parameters->set_status(JobParameters::status_complete);
108
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
109 109
 		}
110 110
 		return new JobStepResponse(
111 111
 				$job_parameters,
112 112
 				sprintf(
113
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
114
-					count( $csv_data ) ),
113
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
114
+					count($csv_data) ),
115 115
 				$extra_response_data );
116 116
 	}
117 117
 
118
-	function get_csv_data_for( $event_id, $offset, $limit ) {
119
-		\EE_Registry::instance()->load_helper( 'Export' );
118
+	function get_csv_data_for($event_id, $offset, $limit) {
119
+		\EE_Registry::instance()->load_helper('Export');
120 120
 		$reg_fields_to_include = array(
121 121
 				'TXN_ID',
122 122
 				'ATT_ID',
@@ -148,171 +148,171 @@  discard block
 block discarded – undo
148 148
 				array(
149 149
 					'OR' => array(
150 150
 						//don't include registrations from failed or abandoned transactions...
151
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
151
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
152 152
 						//unless the registration is approved, in which case include it regardless of transaction status
153 153
 						'STS_ID' => \EEM_Registration::status_id_approved
154 154
 						),
155
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
155
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
156 156
 					),
157
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
158
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
159
-				'limit' => array( $offset, $limit ),
157
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
158
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
159
+				'limit' => array($offset, $limit),
160 160
 			),
161 161
 			$event_id
162 162
 		);
163
-		if( $event_id ){
164
-			$query_params[0]['EVT_ID'] =  $event_id;
165
-		}else{
166
-			$query_params[ 'force_join' ][] = 'Event';
163
+		if ($event_id) {
164
+			$query_params[0]['EVT_ID'] = $event_id;
165
+		} else {
166
+			$query_params['force_join'][] = 'Event';
167 167
 		}
168
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
168
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
169 169
 		//get all questions which relate to someone in this group
170 170
 		$registration_ids = array();
171
-		foreach( $registration_rows as $reg_row ) {
172
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
171
+		foreach ($registration_rows as $reg_row) {
172
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
173 173
 		}
174 174
 //		EEM_Question::instance()->show_next_x_db_queries();
175
-		if( $event_id ) {
176
-			$questions_for_these_regs_rows = \EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.Registration.EVT_ID'=> $event_id ) ) );
175
+		if ($event_id) {
176
+			$questions_for_these_regs_rows = \EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.Registration.EVT_ID'=> $event_id)));
177 177
 		} else {
178
-			$questions_for_these_regs_rows = \EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.ANS_ID'=> array( 'IS_NOT_NULL' ) ) ) );
178
+			$questions_for_these_regs_rows = \EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.ANS_ID'=> array('IS_NOT_NULL'))));
179 179
 		}
180 180
 
181
-		foreach($registration_rows as $reg_row){
182
-			if ( is_array( $reg_row ) ) {
181
+		foreach ($registration_rows as $reg_row) {
182
+			if (is_array($reg_row)) {
183 183
 				$reg_csv_array = array();
184
-				if( ! $event_id ){
184
+				if ( ! $event_id) {
185 185
 					//get the event's name and Id
186
-					$reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] );
186
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
187 187
 				}
188
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
188
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
189 189
 				/*@var $reg_row EE_Registration */
190
-				foreach($reg_fields_to_include as $field_name){
190
+				foreach ($reg_fields_to_include as $field_name) {
191 191
 					$field = $reg_model->field_settings_for($field_name);
192
-					if($field_name == 'REG_final_price'){
193
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
194
-					}elseif( $field_name == 'REG_count' ){
195
-						$value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
196
-					}elseif( $field_name == 'REG_date' ) {
197
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
198
-					}else{
199
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
192
+					if ($field_name == 'REG_final_price') {
193
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
194
+					}elseif ($field_name == 'REG_count') {
195
+						$value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size']));
196
+					}elseif ($field_name == 'REG_date') {
197
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
198
+					} else {
199
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
200 200
 					}
201 201
 					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
202
-					if($field_name == 'REG_final_price'){
202
+					if ($field_name == 'REG_final_price') {
203 203
 						//add a column named Currency after the final price
204 204
 						$reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
205 205
 					}
206 206
 				}
207 207
 				//get pretty status
208
-				$stati = \EEM_Status::instance()->localized_status( array(
209
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
210
-					$reg_row[ 'Transaction.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
208
+				$stati = \EEM_Status::instance()->localized_status(array(
209
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
210
+					$reg_row['Transaction.STS_ID'] => __('unknown', 'event_espresso') ),
211 211
 						FALSE,
212
-						'sentence' );
213
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
212
+						'sentence');
213
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
214 214
 				//get pretty transaction status
215
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'Transaction.STS_ID' ] ];
216
-				$reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'Transaction.TXN_total' ], 'localized_float' ) : '0.00';
217
-				$reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'Transaction.TXN_paid' ], 'localized_float' ) : '0.00';
215
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['Transaction.STS_ID']];
216
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['Transaction.TXN_total'], 'localized_float') : '0.00';
217
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['Transaction.TXN_paid'], 'localized_float') : '0.00';
218 218
 				$payment_methods = array();
219 219
 				$gateway_txn_ids_etc = array();
220 220
 				$payment_times = array();
221
-				if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){
221
+				if ($is_primary_reg && $reg_row['Transaction.TXN_ID']) {
222 222
 					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(
223 223
 							array(
224 224
 								array(
225
-									'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ],
225
+									'TXN_ID' => $reg_row['Transaction.TXN_ID'],
226 226
 									'STS_ID' => \EEM_Payment::status_id_approved
227 227
 								),
228
-								'force_join' => array( 'Payment_Method' ),
228
+								'force_join' => array('Payment_Method'),
229 229
 
230 230
 							),
231 231
 							ARRAY_A,
232 232
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
233 233
 
234
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
235
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
236
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
237
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
234
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
235
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
236
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
237
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
238 238
 					}
239 239
 
240 240
 				}
241
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
242
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
243
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
241
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
242
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
243
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
244 244
 
245 245
 				//get whether or not the user has checked in
246
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
246
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
247 247
 				//get ticket of registration and its price
248 248
 				$ticket_model = \EE_Registry::instance()->load_model('Ticket');
249
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
250
-					$ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
249
+				if ($reg_row['Ticket.TKT_ID']) {
250
+					$ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
251 251
 					$datetimes_strings = array();
252
-					foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){
253
-						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
252
+					foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) {
253
+						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
254 254
 					}
255 255
 
256 256
 				} else {
257
-					$ticket_name = __( 'Unknown', 'event_espresso' );
258
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
257
+					$ticket_name = __('Unknown', 'event_espresso');
258
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
259 259
 				}
260 260
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
261 261
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
262 262
 				//get datetime(s) of registration
263 263
 
264 264
 				//add attendee columns
265
-				foreach($att_fields_to_include as $att_field_name){
265
+				foreach ($att_fields_to_include as $att_field_name) {
266 266
 					$field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
267
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
268
-						if($att_field_name == 'STA_ID'){
269
-							$value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
270
-						}elseif($att_field_name == 'CNT_ISO'){
271
-							$value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
272
-						}else{
273
-							$value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
267
+					if ($reg_row['Attendee_CPT.ID']) {
268
+						if ($att_field_name == 'STA_ID') {
269
+							$value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
270
+						}elseif ($att_field_name == 'CNT_ISO') {
271
+							$value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
272
+						} else {
273
+							$value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
274 274
 						}
275
-					}else{
275
+					} else {
276 276
 						$value = '';
277 277
 					}
278 278
 
279
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value;
279
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
280 280
 				}
281 281
 
282 282
 				//make sure each registration has the same questions in the same order
283
-				foreach($questions_for_these_regs_rows as $question_row){
284
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
285
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
283
+				foreach ($questions_for_these_regs_rows as $question_row) {
284
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
285
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
286 286
 					}
287 287
 				}
288 288
 				$answers = \EEM_Answer::instance()->get_all_wpdb_results(
289 289
 					array(
290
-						array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ),
291
-						'force_join' => array( 'Question' )
290
+						array('REG_ID' => $reg_row['Registration.REG_ID']),
291
+						'force_join' => array('Question')
292 292
 					)
293 293
 				);
294 294
 				//now fill out the questions THEY answered
295
-				foreach( $answers as $answer_row ){
296
-					if( $answer_row[ 'Question.QST_ID' ] ){
295
+				foreach ($answers as $answer_row) {
296
+					if ($answer_row['Question.QST_ID']) {
297 297
 						$question_label = \EEH_Export::prepare_value_from_db_for_display(
298 298
 							\EEM_Question::instance(),
299 299
 							'QST_admin_label',
300
-							$answer_row[ 'Question.QST_admin_label' ]
300
+							$answer_row['Question.QST_admin_label']
301 301
 						);
302 302
 					} else {
303
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
303
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
304 304
 					}
305
-					if ( isset( $answer_row[ 'Question.QST_type' ] )
306
-						 && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state
305
+					if (isset($answer_row['Question.QST_type'])
306
+						 && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
307 307
 					) {
308
-						$reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID(
309
-							$answer_row[ 'Answer.ANS_value' ]
308
+						$reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID(
309
+							$answer_row['Answer.ANS_value']
310 310
 						);
311 311
 					} else {
312
-						$reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display(
312
+						$reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display(
313 313
 							\EEM_Answer::instance(),
314 314
 							'ANS_value',
315
-							$answer_row[ 'Answer.ANS_value' ]
315
+							$answer_row['Answer.ANS_value']
316 316
 						);
317 317
 					}
318 318
 				}
@@ -323,17 +323,17 @@  discard block
 block discarded – undo
323 323
 			}
324 324
 		}
325 325
 		//if we couldn't export anything, we want to at least show the column headers
326
-		if ( empty( $registrations_csv_ready_array ) ) {
326
+		if (empty($registrations_csv_ready_array)) {
327 327
 			$reg_csv_array = array();
328 328
 			$model_and_fields_to_include = array(
329 329
 				'Registration' => $reg_fields_to_include,
330 330
 				'Attendee'     => $att_fields_to_include
331 331
 			);
332
-			foreach ( $model_and_fields_to_include as $model_name => $field_list ) {
333
-				$model = \EE_Registry::instance()->load_model( $model_name );
334
-				foreach ( $field_list as $field_name ) {
335
-					$field = $model->field_settings_for( $field_name );
336
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null;
332
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
333
+				$model = \EE_Registry::instance()->load_model($model_name);
334
+				foreach ($field_list as $field_name) {
335
+					$field = $model->field_settings_for($field_name);
336
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
337 337
 				}
338 338
 			}
339 339
 			$registrations_csv_ready_array[] = $reg_csv_array;
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 * @param int $event_id
350 350
 	 * @return int
351 351
 	 */
352
-	public function count_units_to_process( $event_id ) {
352
+	public function count_units_to_process($event_id) {
353 353
 		//use the legacy filter
354 354
 		$query_params = apply_filters(
355 355
 			'FHEE__EE_Export__report_registration_for_event',
@@ -357,23 +357,23 @@  discard block
 block discarded – undo
357 357
 				array(
358 358
 					'OR' => array(
359 359
 						//don't include registrations from failed or abandoned transactions...
360
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
360
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
361 361
 						//unless the registration is approved, in which case include it regardless of transaction status
362 362
 						'STS_ID' => \EEM_Registration::status_id_approved
363 363
 						),
364
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
364
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
365 365
 					),
366
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
367
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' )
366
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
367
+				'force_join' => array('Transaction', 'Ticket', 'Attendee')
368 368
 			),
369 369
 			$event_id
370 370
 		);
371
-		if( $event_id ){
372
-			$query_params[0]['EVT_ID'] =  $event_id;
371
+		if ($event_id) {
372
+			$query_params[0]['EVT_ID'] = $event_id;
373 373
 		} else {
374
-			$query_params[ 'force_join' ][] = 'Event';
374
+			$query_params['force_join'][] = 'Event';
375 375
 		}
376
-		return \EEM_Registration::instance()->count( $query_params );
376
+		return \EEM_Registration::instance()->count($query_params);
377 377
 	}
378 378
 
379 379
 
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
384 384
 	 * @param JobParameters $job_parameters
385 385
 	 * @return boolean
386 386
 	 */
387
-	public function cleanup_job( JobParameters $job_parameters ){
387
+	public function cleanup_job(JobParameters $job_parameters) {
388 388
 		$this->_file_helper->delete(
389
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
389
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
390 390
 			true,
391 391
 			'd'
392 392
 		);
393
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
393
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
394 394
 	}
395 395
 }
396 396
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			if( ! $event_slug ) {
76 76
 				$event_slug = __( 'unknown', 'event_espresso' );
77 77
 			}
78
-		}else{
78
+		} else{
79 79
 			$event_slug = __( 'all', 'event_espresso' );
80 80
 		}
81 81
 		return sprintf( "registrations-for-%s.csv", $event_slug );
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		);
163 163
 		if( $event_id ){
164 164
 			$query_params[0]['EVT_ID'] =  $event_id;
165
-		}else{
165
+		} else{
166 166
 			$query_params[ 'force_join' ][] = 'Event';
167 167
 		}
168 168
 		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 					$field = $reg_model->field_settings_for($field_name);
192 192
 					if($field_name == 'REG_final_price'){
193 193
 						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
194
-					}elseif( $field_name == 'REG_count' ){
194
+					} elseif( $field_name == 'REG_count' ){
195 195
 						$value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
196
-					}elseif( $field_name == 'REG_date' ) {
196
+					} elseif( $field_name == 'REG_date' ) {
197 197
 						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
198
-					}else{
198
+					} else{
199 199
 						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
200 200
 					}
201 201
 					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 					if( $reg_row[ 'Attendee_CPT.ID' ]){
268 268
 						if($att_field_name == 'STA_ID'){
269 269
 							$value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
270
-						}elseif($att_field_name == 'CNT_ISO'){
270
+						} elseif($att_field_name == 'CNT_ISO'){
271 271
 							$value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
272
-						}else{
272
+						} else{
273 273
 							$value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
274 274
 						}
275
-					}else{
275
+					} else{
276 276
 						$value = '';
277 277
 					}
278 278
 
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 1 patch
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Admin_Page $admin_page
58 58
 	 * @return EE_Registrations_List_Table
59 59
 	 */
60
-	function __construct( $admin_page ){
60
+	function __construct($admin_page) {
61 61
 
62
-		if ( ! empty( $_GET['event_id'] ) ) {
62
+		if ( ! empty($_GET['event_id'])) {
63 63
 			$extra_query_args = array();
64
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
65
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
64
+			foreach ($admin_page->get_views() as $key => $view_details) {
65
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
66 66
 			}
67
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
67
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
68 68
 		}
69 69
 
70 70
 		parent::__construct($admin_page);
71 71
 		$this->_status = $this->_admin_page->get_registration_status_array();
72 72
 
73
-		EE_Registry::instance()->load_helper( 'Template' );
73
+		EE_Registry::instance()->load_helper('Template');
74 74
 	}
75 75
 
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @return void
82 82
 	 */
83 83
 	protected function _setup_data() {
84
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
85
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
84
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
85
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
86 86
 	}
87 87
 
88 88
 
@@ -101,45 +101,45 @@  discard block
 block discarded – undo
101 101
 			);
102 102
 
103 103
 
104
-		if ( isset( $_GET['event_id'] )) {
104
+		if (isset($_GET['event_id'])) {
105 105
 			$this->_columns = array(
106 106
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
107
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
108
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
107
+				'_REG_ID' => __('ID', 'event_espresso'),
108
+				'ATT_fname' => __('Name', 'event_espresso'),
109 109
 				'ATT_email' =>  __('Email', 'event_espresso'),
110
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
111
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
112
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
113
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
110
+				'_REG_date' => __('Reg Date', 'event_espresso'),
111
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
112
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
113
+				'TXN_total' => __('Total Txn', 'event_espresso'),
114 114
 				'TXN_paid' => __('Paid', 'event_espresso'),
115
-				'actions' => __( 'Actions', 'event_espresso' )
115
+				'actions' => __('Actions', 'event_espresso')
116 116
 				);
117 117
 			$this->_bottom_buttons = array(
118 118
 					'report'=> array(
119 119
 					'route' => 'registrations_report',
120 120
 					'extra_request' =>  
121 121
 						array( 
122
-							'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, 
123
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) 
122
+							'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, 
123
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) 
124 124
 				),
125 125
 			);
126 126
 		} else {
127 127
 			$this->_columns = array(
128 128
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
129
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
130
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
131
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
132
-				'event_name' => __( 'Event', 'event_espresso' ),
133
-					'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
134
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
135
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
136
-				'actions' => __( 'Actions', 'event_espresso' )
129
+				'_REG_ID' => __('ID', 'event_espresso'),
130
+				'ATT_fname' => __('Name', 'event_espresso'),
131
+				'_REG_date' => __('TXN Date', 'event_espresso'),
132
+				'event_name' => __('Event', 'event_espresso'),
133
+					'DTT_EVT_start' => __('Event Date', 'event_espresso'),
134
+				'_REG_final_price' => __('Price', 'event_espresso'),
135
+				'_REG_paid' => __('Paid', 'event_espresso'),
136
+				'actions' => __('Actions', 'event_espresso')
137 137
 			);
138 138
 			$this->_bottom_buttons = array(
139 139
 				'report_all'=> array(
140 140
 				'route' => 'registrations_report',
141 141
 				'extra_request' => array( 
142
-					'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) )
142
+					'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
143 143
 				),
144 144
 			);
145 145
 		}
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 		$this->_primary_column = '_REG_ID';
148 148
 
149 149
 		$this->_sortable_columns = array(
150
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
151
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
152
-			'event_name' => array( 'event_name' => FALSE ),
153
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
154
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
150
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
151
+			'ATT_fname' => array('ATT_fname' => FALSE),
152
+			'event_name' => array('event_name' => FALSE),
153
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
154
+			'_REG_ID' => array('_REG_ID' => FALSE),
155 155
 		);
156 156
 
157 157
 		$this->_hidden_columns = array();
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 
161 161
 
162 162
 
163
-	protected function _get_row_class( $item ) {
164
-		$class = parent::_get_row_class( $item );
163
+	protected function _get_row_class($item) {
164
+		$class = parent::_get_row_class($item);
165 165
 		//add status class
166
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
167
-		if ( $this->_has_checkbox_column ) {
166
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
167
+		if ($this->_has_checkbox_column) {
168 168
 			$class .= ' has-checkbox-column';
169 169
 		}
170 170
 		return $class;
@@ -177,15 +177,15 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @param EE_Registration $registration
179 179
 	 */
180
-	protected function _set_related_details( EE_Registration $registration ) {
180
+	protected function _set_related_details(EE_Registration $registration) {
181 181
 
182
-		$transaction = $registration->get_first_related( 'Transaction' );
182
+		$transaction = $registration->get_first_related('Transaction');
183 183
 		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code;
184 184
 		$this->_transaction_details = array(
185 185
 			'transaction' => $transaction,
186 186
 			'status' => $status,
187 187
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
188
-			'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
188
+			'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
189 189
 			);
190 190
 
191 191
 		$event = $registration->event();
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 			'event' => $event,
195 195
 			'status' => $status,
196 196
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
197
-			'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
197
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
198 198
 			);
199 199
 	}
200 200
 
@@ -209,26 +209,26 @@  discard block
 block discarded – undo
209 209
 		$filters = array();
210 210
 
211 211
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
212
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
212
+		EE_Registry::instance()->load_helper('Form_Fields');
213 213
 
214
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
215
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
216
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
214
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
215
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
216
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
217 217
 
218
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
219
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
218
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
219
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
220 220
 
221 221
 		$status = array();
222
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
223
-		foreach ( $this->_status as $key => $value ) {
224
-			$status[] = array( 'id' => $key, 'text' => $value );
222
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
223
+		foreach ($this->_status as $key => $value) {
224
+			$status[] = array('id' => $key, 'text' => $value);
225 225
 		}
226
-		if ( $this->_view != 'incomplete' ) {
227
-			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' );
226
+		if ($this->_view != 'incomplete') {
227
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : '');
228 228
 		}
229 229
 
230
-		if ( isset( $this->_req_data['event_id'] ) ) {
231
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
230
+		if (isset($this->_req_data['event_id'])) {
231
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
232 232
 		}
233 233
 
234 234
 		return $filters;
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 		$this->_views['all']['count'] = $this->_total_registrations();
246 246
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
247 247
 		$this->_views['today']['count'] = $this->_total_registrations_today();
248
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
249
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
250
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
248
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
249
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
250
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
251 251
 		}
252 252
 	}
253 253
 
@@ -259,23 +259,23 @@  discard block
 block discarded – undo
259 259
 	 * @param string $view
260 260
 	 * @return int
261 261
 	 */
262
-	protected function _total_registrations( $view = '' ){
262
+	protected function _total_registrations($view = '') {
263 263
 		$_where = array();
264
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
265
-		if( $EVT_ID ) {
264
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
265
+		if ($EVT_ID) {
266 266
 			$_where['EVT_ID'] = $EVT_ID;
267 267
 		}
268
-		switch ( $view ) {
268
+		switch ($view) {
269 269
 			case 'trash' :
270
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
270
+				return EEM_Registration::instance()->count_deleted(array($_where));
271 271
 				break;
272 272
 			case 'incomplete' :
273 273
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
274 274
 				break;
275 275
 			default :
276
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
276
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
277 277
 		}
278
-		return EEM_Registration::instance()->count( array( $_where ));
278
+		return EEM_Registration::instance()->count(array($_where));
279 279
 	}
280 280
 
281 281
 
@@ -285,24 +285,24 @@  discard block
 block discarded – undo
285 285
 	 * @access protected
286 286
 	 * @return int
287 287
 	 */
288
-	protected function _total_registrations_this_month(){
289
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
290
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
288
+	protected function _total_registrations_this_month() {
289
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
290
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
291 291
 		$this_year_r = date('Y', current_time('timestamp'));
292 292
 		$time_start = ' 00:00:00';
293 293
 		$time_end = ' 23:59:59';
294 294
 		$this_month_r = date('m', current_time('timestamp'));
295
-		$days_this_month = date( 't', current_time('timestamp') );
295
+		$days_this_month = date('t', current_time('timestamp'));
296 296
 		//setup date query.
297
-		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' );
298
-		$end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' );
299
-		$_where['REG_date']= array('BETWEEN',
297
+		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s');
298
+		$end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s');
299
+		$_where['REG_date'] = array('BETWEEN',
300 300
 			array(
301 301
 				$beginning_string,
302 302
 				$end_string
303 303
 		));
304
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
305
-		return EEM_Registration::instance()->count(array( $_where ) );
304
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
305
+		return EEM_Registration::instance()->count(array($_where));
306 306
 	}
307 307
 
308 308
 
@@ -312,20 +312,20 @@  discard block
 block discarded – undo
312 312
 	 * @access protected
313 313
 	 * @return int
314 314
 	 */
315
-	protected function _total_registrations_today(){
315
+	protected function _total_registrations_today() {
316 316
 
317
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
318
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
317
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
318
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
319 319
 		$current_date = date('Y-m-d', current_time('timestamp'));
320 320
 		$time_start = ' 00:00:00';
321 321
 		$time_end = ' 23:59:59';
322
-		$_where['REG_date']= array('BETWEEN',
322
+		$_where['REG_date'] = array('BETWEEN',
323 323
 			array(
324
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),
325
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )
324
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
325
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s')
326 326
 		));
327
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
328
-		return EEM_Registration::instance()->count(array( $_where ) );
327
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
328
+		return EEM_Registration::instance()->count(array($_where));
329 329
 	}
330 330
 
331 331
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param \EE_Registration $item
338 338
 	 * @return string
339 339
 	 */
340
-    function column_cb($item){
340
+    function column_cb($item) {
341 341
 	/** checkbox/lock **/
342
-	$transaction = $item->get_first_related( 'Transaction' );
343
-	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
344
-	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
342
+	$transaction = $item->get_first_related('Transaction');
343
+	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
344
+	return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
345 345
     }
346 346
 
347 347
 
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
 	 * @param \EE_Registration $item
354 354
 	 * @return string
355 355
 	 */
356
-	function column__REG_ID(EE_Registration $item){
356
+	function column__REG_ID(EE_Registration $item) {
357 357
 		$attendee = $item->attendee();
358 358
 		$content = $item->ID();
359 359
 		$content .= '<div class="show-on-mobile-view-only">';
360 360
 		$content .= '<br>';
361 361
 		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
362
-		$content .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
363
-		$content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
362
+		$content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
363
+		$content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
364 364
 		$content .= '</div>';
365 365
 		return $content;
366 366
 	}
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
 	 * @param \EE_Registration $item
375 375
 	 * @return string
376 376
 	 */
377
-	function column__REG_date(EE_Registration $item){
377
+	function column__REG_date(EE_Registration $item) {
378 378
 		$this->_set_related_details($item);
379 379
        		 //Build row actions
380
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
381
-		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
382
-		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
380
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
381
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
382
+		$view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>';
383 383
 		return $view_link;
384 384
 	}
385 385
 
@@ -392,18 +392,18 @@  discard block
 block discarded – undo
392 392
 	 * @param \EE_Registration $item
393 393
 	 * @return string
394 394
 	 */
395
-	function column_event_name(EE_Registration $item){
396
-		$this->_set_related_details( $item );
395
+	function column_event_name(EE_Registration $item) {
396
+		$this->_set_related_details($item);
397 397
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
398
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL );
398
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL);
399 399
 		$event_name = $item->event_name();
400 400
 		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
401
-		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ;
401
+		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...');
402 402
 
403
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
404
-		$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' .  __( 'View Registrations', 'event_espresso' ) . '</a>';
403
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL);
404
+		$actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>';
405 405
 
406
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
406
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
407 407
 	}
408 408
 
409 409
 
@@ -415,18 +415,18 @@  discard block
 block discarded – undo
415 415
 	 * @param \EE_Registration $item
416 416
 	 * @return string
417 417
 	 */
418
-   	function column_DTT_EVT_start(EE_Registration $item){
418
+   	function column_DTT_EVT_start(EE_Registration $item) {
419 419
 		$datetime_strings = array();
420
-		$ticket = $item->ticket( TRUE );
421
-		if ( $ticket instanceof EE_Ticket ) {
420
+		$ticket = $item->ticket(TRUE);
421
+		if ($ticket instanceof EE_Ticket) {
422 422
 			$remove_defaults = array('default_where_conditions' => 'none');
423 423
 			$datetimes = $ticket->datetimes($remove_defaults);
424
-			foreach($datetimes as $datetime){
425
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
424
+			foreach ($datetimes as $datetime) {
425
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
426 426
 			}
427
-			return implode("<br />",$datetime_strings);
427
+			return implode("<br />", $datetime_strings);
428 428
 		} else {
429
-			return __( 'There is no ticket on this registration', 'event_espresso' );
429
+			return __('There is no ticket on this registration', 'event_espresso');
430 430
 		}
431 431
     }
432 432
 
@@ -439,45 +439,45 @@  discard block
 block discarded – undo
439 439
 	 * @param \EE_Registration $item
440 440
 	 * @return string
441 441
 	 */
442
-   	function column_ATT_fname(EE_Registration $item){
442
+   	function column_ATT_fname(EE_Registration $item) {
443 443
    		$attendee = $item->attendee();
444 444
 
445
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
445
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
446 446
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
447
-		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name;
447
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name;
448 448
 		$link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
449 449
 
450 450
 		$t = $item->get_first_related('Transaction');
451 451
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
452 452
 
453 453
 	    //append group count to name
454
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
454
+	    $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
455 455
 
456 456
 	    //append reg_code
457
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
457
+	    $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
458 458
 
459 459
 	    //reg status text for accessibility
460
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
460
+	    $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
461 461
 
462 462
 		//trash/restore/delete actions
463 463
 		$actions = array();
464
-		if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
465
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
466
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
467
-		} elseif ( $this->_view == 'trash' ) {
464
+		if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
465
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
466
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
467
+		} elseif ($this->_view == 'trash') {
468 468
 			// restore registration link
469
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
470
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
471
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
469
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
470
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
471
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
472 472
 			}
473
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
474
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
473
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
474
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
475 475
 
476
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
476
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
477 477
 			}
478 478
 		}
479 479
 
480
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
480
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
481 481
 	}
482 482
 
483 483
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * @param \EE_Registration $item
490 490
 	 * @return string
491 491
 	 */
492
-	function column_ATT_email( EE_Registration $item ) {
492
+	function column_ATT_email(EE_Registration $item) {
493 493
 		$attendee = $item->get_first_related('Attendee');
494 494
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
495 495
 	}
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 	 * @param \EE_Registration $item
504 504
 	 * @return string
505 505
 	 */
506
-	function column__REG_count(EE_Registration $item){
507
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
506
+	function column__REG_count(EE_Registration $item) {
507
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
508 508
 	}
509 509
 
510 510
 
@@ -516,16 +516,16 @@  discard block
 block discarded – undo
516 516
 	 * @param \EE_Registration $item
517 517
 	 * @return string
518 518
 	 */
519
-	function column_PRC_amount(EE_Registration $item){
519
+	function column_PRC_amount(EE_Registration $item) {
520 520
 		$ticket = $item->ticket();
521 521
 
522
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
522
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
523 523
 
524
-		if ( $item->final_price() > 0 ) {
525
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
524
+		if ($item->final_price() > 0) {
525
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
526 526
 		} else {
527 527
 			// free event
528
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
528
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
529 529
 		}
530 530
 
531 531
 		return $content;
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
 	 * @param \EE_Registration $item
542 542
 	 * @return string
543 543
 	 */
544
-	function column__REG_final_price(EE_Registration $item){
544
+	function column__REG_final_price(EE_Registration $item) {
545 545
 		$ticket = $item->ticket();
546
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
546
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
547 547
 
548
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
548
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
549 549
 		return $content;
550 550
 
551 551
 	}
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	 * @param \EE_Registration $item
560 560
 	 * @return string
561 561
 	 */
562
-	function column__REG_paid(EE_Registration $item){
563
-		return '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
562
+	function column__REG_paid(EE_Registration $item) {
563
+		return '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
564 564
 	}
565 565
 
566 566
 
@@ -572,11 +572,11 @@  discard block
 block discarded – undo
572 572
 	 * @param \EE_Registration $item
573 573
 	 * @return string
574 574
 	 */
575
-	function column_TXN_total(EE_Registration $item){
576
-		if($item->transaction()){
577
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
578
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
579
-		}else{
575
+	function column_TXN_total(EE_Registration $item) {
576
+		if ($item->transaction()) {
577
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
578
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
579
+		} else {
580 580
 			return __("None", "event_espresso");
581 581
 		}
582 582
 	}
@@ -590,15 +590,15 @@  discard block
 block discarded – undo
590 590
 	 * @param \EE_Registration $item
591 591
 	 * @return string
592 592
 	 */
593
-	function column_TXN_paid(EE_Registration $item){
593
+	function column_TXN_paid(EE_Registration $item) {
594 594
 
595
-		if ( $item->count() == 1 ) {
595
+		if ($item->count() == 1) {
596 596
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
597
-			if ( $transaction->paid() >= $transaction->total() ) {
597
+			if ($transaction->paid() >= $transaction->total()) {
598 598
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
599 599
 			} else {
600
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
601
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
600
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
601
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
602 602
 			}
603 603
 		}
604 604
 
@@ -619,44 +619,44 @@  discard block
 block discarded – undo
619 619
 		EE_Registry::instance()->load_helper('MSG_Template');
620 620
 		$attendee = $item->attendee();
621 621
 		$ticket = $item->ticket();
622
-		$this->_set_related_details( $item );
622
+		$this->_set_related_details($item);
623 623
 
624 624
 		//Build row actions
625
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
626
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
625
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
626
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
627 627
 
628 628
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
629 629
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
630
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
630
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
631 631
 
632 632
 
633 633
 		//Build row actions
634
-		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
634
+		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
635 635
 			<li>
636
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
636
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
637 637
 				<div class="dashicons dashicons-clipboard"></div>
638 638
 			</a>
639 639
 			</li>' : '';
640 640
 
641
-		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
641
+		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
642 642
 			<li>
643
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
643
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
644 644
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
645 645
 			</a>
646 646
 			</li>' : '';
647 647
 
648
-		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
648
+		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
649 649
 			<li>
650
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
650
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
651 651
 				<div class="dashicons dashicons-email-alt"></div>
652 652
 			</a>
653 653
 			</li>' : '';
654 654
 
655 655
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
656
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
657
-		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
656
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
657
+		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
658 658
 			<li>
659
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text">
659
+			<a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'" class="tiny-text">
660 660
 				<div class="dashicons dashicons-cart"></div>
661 661
 			</a>
662 662
 			</li>' : '';
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
 		//invoice link
665 665
 		$dl_invoice_lnk_url = $item->invoice_url();
666 666
 		//only show invoice link if message type is active.
667
-		if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
667
+		if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
668 668
 			$dl_invoice_lnk = '
669 669
 		<li>
670
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
670
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
671 671
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
672 672
 			</a>
673 673
 		</li>';
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 			$dl_invoice_lnk = '';
676 676
 		}
677 677
 
678
-			return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul' );
678
+			return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul');
679 679
 	}
680 680
 
681 681
 }
Please login to merge, or discard this patch.