Completed
Branch BUG-8511-spco-revisit-oversell... (b4a10b)
by
unknown
15:37
created
core/helpers/EEH_Maps.helper.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	 * @param  array $ee_gmaps_opts array of attributes required for the map link generation
22 22
 	 * @return string (link to map!)
23 23
 	 */
24
-	public static function google_map( $ee_gmaps_opts ){
25
-
26
-		$ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300';
27
-		$ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185';
28
-		$ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
29
-		$ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false';
30
-		$ee_map_nav_size =  isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
31
-		$ee_map_type_control =  isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default';
32
-		$static_url =  isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE;
33
-
34
-		if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){
35
-			switch( $ee_gmaps_opts['ee_map_align'] ){
24
+	public static function google_map($ee_gmaps_opts) {
25
+
26
+		$ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';
27
+		$ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';
28
+		$ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
29
+		$ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';
30
+		$ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
31
+		$ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default';
32
+		$static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE;
33
+
34
+		if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) {
35
+			switch ($ee_gmaps_opts['ee_map_align']) {
36 36
 				case "left":
37 37
 					$map_align = 'ee-gmap-align-left left';
38 38
 					break;
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 
54 54
 		// Determine whether user has set a hardoded url to use and
55 55
 		// if so display a Google static iframe map else run V3 api
56
-		if( $static_url ) {
56
+		if ($static_url) {
57 57
 
58
-			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';
59
-			$html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width  .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">';
58
+			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">';
59
+			$html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">';
60 60
 			$html .= '</iframe>';
61
-			$html .= '<a href="' . $static_url . '">View Large map</a>';
61
+			$html .= '<a href="'.$static_url.'">View Large map</a>';
62 62
 			$html .= '</div>';
63 63
 			return $html;
64 64
 
65 65
 		 } else {
66 66
 
67
-			EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(
67
+			EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array(
68 68
 				'map_ID' => $ee_gmaps_opts['map_ID'],
69 69
 				'ee_map_zoom' => $ee_map_zoom,
70 70
 				'ee_map_nav_display' => $ee_map_nav_display,
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 			);
75 75
 
76 76
 			$html = '<div class="ee-gmap-wrapper '.$map_align.';">';
77
-			$html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>';  //
77
+			$html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; //
78 78
 			$html .= '</div>';
79 79
 
80
-			wp_enqueue_script( 'gmap_api' );
81
-			wp_enqueue_script( 'ee_gmap' );
82
-			add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' ));
80
+			wp_enqueue_script('gmap_api');
81
+			wp_enqueue_script('ee_gmap');
82
+			add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script'));
83 83
 
84 84
 			return $html;
85 85
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return void
95 95
 	 */
96 96
 	public static function footer_enqueue_script() {
97
-		wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars );
97
+		wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars);
98 98
 	}
99 99
 
100 100
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	public static function espresso_google_map_js() {
106 106
 		$api_url = sprintf(
107 107
 			"https://maps.googleapis.com/maps/api/js?key=%s",
108
-			apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key )
108
+			apply_filters('FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key)
109 109
 		);
110
-		wp_register_script( 'gmap_api', $api_url, array('jquery'), NULL, TRUE );
111
-		wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE );
110
+		wp_register_script('gmap_api', $api_url, array('jquery'), NULL, TRUE);
111
+		wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE);
112 112
 	}
113 113
 
114 114
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @return string (link to map!)
118 118
 	 */
119 119
 	public static function google_map_link($atts) {
120
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
120
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
121 121
 		extract($atts);
122 122
 		/** @var string $address */
123 123
 		/** @var string $city */
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 		$id = isset($id) ? $id : 'not_set';
137 137
 		$map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';
138 138
 
139
-		$address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
139
+		$address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : '');
140 140
 
141
-		$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string ));
141
+		$google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string));
142 142
 
143 143
 		switch ($type) {
144 144
 			case 'text':
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 			case 'map':
154 154
 				$scheme = is_ssl() ? 'https://' : 'http://';
155 155
 
156
-				$api_key = apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_link__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key );
156
+				$api_key = apply_filters('FHEE__EEH_Maps__espresso_google_maps_link__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key);
157 157
 
158
-				return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&amp;zoom=14&amp;size=' . $map_w . 'x' . $map_h . '&amp;markers=color:green|label:|' . urlencode( $address_string ) . '&amp;sensor=false&amp;key=' . $api_key ) . '" /></a>';
158
+				return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&amp;zoom=14&amp;size='.$map_w.'x'.$map_h.'&amp;markers=color:green|label:|'.urlencode($address_string).'&amp;sensor=false&amp;key='.$api_key).'" /></a>';
159 159
 		}
160 160
 
161
-		return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
161
+		return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>';
162 162
 	}
163 163
 
164 164
 
Please login to merge, or discard this patch.
admin_pages/venues/templates/google_map.template.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
26 26
                     <input type="text" id="ee-google-map-api-key" class="regular-text" name="google_map_api_key" value="<?php echo $map_settings->google_map_api_key; ?>" />
27 27
                     <p class="description">
28 28
                         <?php
29
-                            printf(
30
-                                __('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'),
31
-                                '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">',
32
-                                '</a>'
33
-                            );
34
-                        ?>
29
+							printf(
30
+								__('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'),
31
+								'<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">',
32
+								'</a>'
33
+							);
34
+						?>
35 35
                     </p>
36 36
                 </td>
37 37
             </tr>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 				</td>
16 16
 			</tr>
17 17
 			<?php
18
-			if( apply_filters( 'FHEE__google_map__show_api_key_input', true ) ) { ?>
18
+			if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?>
19 19
             <tr>
20 20
                 <th>
21 21
                     <label for="ee-google-map-api-key">
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 				<td>
111 111
 					<label for="event_details_control_type-default" class="ee-admin-radio-lbl">
112 112
 						<?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' : ''; ?>
113
-						<input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked;?>/>
113
+						<input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked; ?>/>
114 114
 						<?php _e(' Default', 'event_espresso') ?>
115 115
 					</label>
116 116
 
117 117
 					<label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl">
118 118
 						<?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' : ''; ?>
119
-						<input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked;?>/>
119
+						<input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked; ?>/>
120 120
 						<?php _e(' Horizontal', 'event_espresso') ?>
121 121
 					</label>
122 122
 
123 123
 					<label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl">
124 124
 						<?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' : ''; ?>
125
-						<input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked;?>/>
125
+						<input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked; ?>/>
126 126
 						<?php _e(' Dropdown', 'event_espresso') ?>
127 127
 					</label>
128 128
 				</td>
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 				<td>
136 136
 					<label for="event_details_map_align-none" class="ee-admin-radio-lbl">
137 137
 						<?php $checked = $map_settings->event_details_map_align == 'none' ? 'checked="checked"' : ''; ?>
138
-						<input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked;?>/>
138
+						<input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked; ?>/>
139 139
 						<?php _e(' None', 'event_espresso') ?>
140 140
 					</label>
141 141
 
142 142
 					<label for="event_details_map_align-left" class="ee-admin-radio-lbl">
143 143
 						<?php $checked = $map_settings->event_details_map_align == 'left' ? 'checked="checked"' : ''; ?>
144
-						<input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked;?>/>
144
+						<input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked; ?>/>
145 145
 						<?php _e(' Align Left', 'event_espresso') ?>
146 146
 					</label>
147 147
 
148 148
 					<label for="event_details_map_align-center" class="ee-admin-radio-lbl">
149 149
 						<?php $checked = $map_settings->event_details_map_align == 'center' ? 'checked="checked"' : ''; ?>
150
-						<input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked;?>/>
150
+						<input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked; ?>/>
151 151
 						<?php _e(' Align Center', 'event_espresso') ?>
152 152
 					</label>
153 153
 
154 154
 					<label for="event_details_map_align-right" class="ee-admin-radio-lbl">
155 155
 						<?php $checked = $map_settings->event_details_map_align == 'right' ? 'checked="checked"' : ''; ?>
156
-						<input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked;?>/>
156
+						<input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked; ?>/>
157 157
 						<?php _e(' Align Right', 'event_espresso') ?>
158 158
 					</label>
159 159
 				</td>
@@ -228,19 +228,19 @@  discard block
 block discarded – undo
228 228
 				<td>
229 229
 					<label for="event_list_control_type-default" class="ee-admin-radio-lbl">
230 230
 						<?php $checked = $map_settings->event_list_control_type == 'default' ? 'checked="checked"' : ''; ?>
231
-						<input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked;?>/>
231
+						<input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked; ?>/>
232 232
 						<?php _e(' Default', 'event_espresso') ?>
233 233
 					</label>
234 234
 
235 235
 					<label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl">
236 236
 						<?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' : ''; ?>
237
-						<input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked;?>/>
237
+						<input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked; ?>/>
238 238
 						<?php _e(' Horizontal', 'event_espresso') ?>
239 239
 					</label>
240 240
 
241 241
 					<label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl">
242 242
 						<?php $checked = $map_settings->event_list_control_type == 'dropdown' ? 'checked="checked"' : ''; ?>
243
-						<input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked;?>/>
243
+						<input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked; ?>/>
244 244
 						<?php _e(' Dropdown', 'event_espresso') ?>
245 245
 					</label>
246 246
 
@@ -254,25 +254,25 @@  discard block
 block discarded – undo
254 254
 				<td>
255 255
 					<label for="event_list_map_align-none" class="ee-admin-radio-lbl">
256 256
 						<?php $checked = $map_settings->event_list_map_align == 'none' ? 'checked="checked"' : ''; ?>
257
-						<input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked;?>/>
257
+						<input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked; ?>/>
258 258
 						<?php _e(' None', 'event_espresso') ?>
259 259
 					</label>
260 260
 
261 261
 					<label for="event_list_map_align-left" class="ee-admin-radio-lbl">
262 262
 						<?php $checked = $map_settings->event_list_map_align == 'left' ? 'checked="checked"' : ''; ?>
263
-						<input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked;?>/>
263
+						<input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked; ?>/>
264 264
 						<?php _e(' Align Left', 'event_espresso') ?>
265 265
 					</label>
266 266
 
267 267
 					<label for="event_list_map_align-center" class="ee-admin-radio-lbl">
268 268
 						<?php $checked = $map_settings->event_list_map_align == 'center' ? 'checked="checked"' : ''; ?>
269
-						<input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked;?>/>
269
+						<input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked; ?>/>
270 270
 						<?php _e(' Align Center', 'event_espresso') ?>
271 271
 					</label>
272 272
 
273 273
 					<label for="event_list_map_align-right" class="ee-admin-radio-lbl">
274 274
 						<?php $checked = $map_settings->event_list_map_align == 'right' ? 'checked="checked"' : ''; ?>
275
-						<input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked;?>/>
275
+						<input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked; ?>/>
276 276
 						<?php _e(' Align Right', 'event_espresso') ?>
277 277
 					</label>
278 278
 
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 1 patch
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 					'label' => __('Google Maps'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
380
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
556 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -583,31 +583,31 @@  discard block
 block discarded – undo
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		$default_map_settings->google_map_api_key = '';
585 585
 		// for event details pages (reg page)
586
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
587
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
588
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
589
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
590
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
591
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
592
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
586
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
587
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
588
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
589
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
590
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
591
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
592
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
593 593
 		// for event list pages
594
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
595
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
596
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
597
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
598
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
599
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
600
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
594
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
595
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
596
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
597
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
598
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
599
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
600
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
601 601
 
602 602
 		$this->_template_args['map_settings'] =
603
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
604
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
603
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
604
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
605 605
 				: $default_map_settings;
606 606
 
607
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
608
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
607
+		$this->_set_add_edit_form_tags('update_google_map_settings');
608
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
609 609
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
610
-			EE_VENUES_TEMPLATE_PATH . 'google_map.template.php',
610
+			EE_VENUES_TEMPLATE_PATH.'google_map.template.php',
611 611
 			$this->_template_args,
612 612
 			true
613 613
 		);
@@ -617,83 +617,83 @@  discard block
 block discarded – undo
617 617
 	protected function _update_google_map_settings() {
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
620
-			isset( $this->_req_data['use_google_maps'] )
621
-				? absint( $this->_req_data['use_google_maps'] )
620
+			isset($this->_req_data['use_google_maps'])
621
+				? absint($this->_req_data['use_google_maps'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->google_map_api_key =
625
-			isset( $this->_req_data['google_map_api_key'] )
626
-				? sanitize_text_field( $this->_req_data['google_map_api_key'] )
625
+			isset($this->_req_data['google_map_api_key'])
626
+				? sanitize_text_field($this->_req_data['google_map_api_key'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->google_map_api_key;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
630
-			isset( $this->_req_data['event_details_map_width'] )
631
-				? absint( $this->_req_data['event_details_map_width'] )
630
+			isset($this->_req_data['event_details_map_width'])
631
+				? absint($this->_req_data['event_details_map_width'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
635
-			isset( $this->_req_data['event_details_map_height'] )
636
-				? absint( $this->_req_data['event_details_map_height'] )
635
+			isset($this->_req_data['event_details_map_height'])
636
+				? absint($this->_req_data['event_details_map_height'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
640
-			isset( $this->_req_data['event_details_map_zoom'] )
641
-				? absint( $this->_req_data['event_details_map_zoom'] )
640
+			isset($this->_req_data['event_details_map_zoom'])
641
+				? absint($this->_req_data['event_details_map_zoom'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
645
-			isset( $this->_req_data['event_details_display_nav'] )
646
-				? absint( $this->_req_data['event_details_display_nav'] )
645
+			isset($this->_req_data['event_details_display_nav'])
646
+				? absint($this->_req_data['event_details_display_nav'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
650
-			isset( $this->_req_data['event_details_nav_size'] )
651
-				? absint( $this->_req_data['event_details_nav_size'] )
650
+			isset($this->_req_data['event_details_nav_size'])
651
+				? absint($this->_req_data['event_details_nav_size'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
655
-			isset( $this->_req_data['event_details_control_type'] )
656
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
655
+			isset($this->_req_data['event_details_control_type'])
656
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
660
-			isset( $this->_req_data['event_details_map_align'] )
661
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
660
+			isset($this->_req_data['event_details_map_align'])
661
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
665
-			isset( $this->_req_data['event_list_map_width'] )
666
-				? absint( $this->_req_data['event_list_map_width'] )
665
+			isset($this->_req_data['event_list_map_width'])
666
+				? absint($this->_req_data['event_list_map_width'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
670
-			isset( $this->_req_data['event_list_map_height'] )
671
-				? absint( $this->_req_data['event_list_map_height'] )
670
+			isset($this->_req_data['event_list_map_height'])
671
+				? absint($this->_req_data['event_list_map_height'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
675
-			isset( $this->_req_data['event_list_map_zoom'] )
676
-				? absint( $this->_req_data['event_list_map_zoom'] )
675
+			isset($this->_req_data['event_list_map_zoom'])
676
+				? absint($this->_req_data['event_list_map_zoom'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
680
-			isset( $this->_req_data['event_list_display_nav'] )
681
-				? absint( $this->_req_data['event_list_display_nav'] )
680
+			isset($this->_req_data['event_list_display_nav'])
681
+				? absint($this->_req_data['event_list_display_nav'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
685
-			isset( $this->_req_data['event_list_nav_size'] )
686
-				? absint( $this->_req_data['event_list_nav_size'] )
685
+			isset($this->_req_data['event_list_nav_size'])
686
+				? absint($this->_req_data['event_list_nav_size'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
688 688
 
689 689
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
690
-			isset( $this->_req_data['event_list_control_type'] )
691
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
690
+			isset($this->_req_data['event_list_control_type'])
691
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
692 692
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
693 693
 
694 694
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
695
-			isset( $this->_req_data['event_list_map_align'] )
696
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
695
+			isset($this->_req_data['event_list_map_align'])
696
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
697 697
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
698 698
 
699 699
 		EE_Registry::instance()->CFG->map_settings = apply_filters(
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			EE_Registry::instance()->CFG->map_settings,
708 708
 			__FILE__, __FUNCTION__, __LINE__
709 709
 		);
710
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
710
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
711 711
 
712 712
 	}
713 713
 
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 	protected function _venue_editor_metaboxes() {
717 717
 		$this->verify_cpt_object();
718 718
 
719
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
720
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
721
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
719
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
720
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
721
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
722 722
 
723 723
 	}
724 724
 
@@ -726,23 +726,23 @@  discard block
 block discarded – undo
726 726
 
727 727
 	public function venue_gmap_metabox() {
728 728
 		$template_args = array(
729
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
729
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
730 730
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
731 731
 			);
732
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
733
-		EEH_Template::display_template( $template, $template_args );
732
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
733
+		EEH_Template::display_template($template, $template_args);
734 734
 	}
735 735
 
736 736
 
737 737
 
738 738
 	public function venue_address_metabox() {
739 739
 
740
-		$template_args['_venue'] =$this->_cpt_model_obj;
740
+		$template_args['_venue'] = $this->_cpt_model_obj;
741 741
 
742 742
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
743 743
 			$QFI = new EE_Question_Form_Input(
744
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
745
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
744
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
745
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
746 746
 				array(
747 747
 					'input_name' =>  'sta_id',
748 748
 					'input_id' => 'sta_id',
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 		);
755 755
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
756 756
 			$QFI = new EE_Question_Form_Input(
757
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
758
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
757
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
758
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
759 759
 				array(
760 760
 					'input_name' =>  'cnt_iso',
761 761
 					'input_id' => 'cnt_iso',
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 			)
767 767
 		);
768 768
 
769
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
770
-		EEH_Template::display_template( $template, $template_args );
769
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
770
+		EEH_Template::display_template($template, $template_args);
771 771
 	}
772 772
 
773 773
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 		$template_args = array(
780 780
 			'_venue' => $this->_cpt_model_obj
781 781
 			);
782
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
783
-		EEH_Template::display_template( $template, $template_args );
782
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
783
+		EEH_Template::display_template($template, $template_args);
784 784
 	}
785 785
 
786 786
 
@@ -803,52 +803,52 @@  discard block
 block discarded – undo
803 803
 	 * @param  object $post    Post object (with "blessed" WP properties)
804 804
 	 * @return void
805 805
 	 */
806
-	protected function _insert_update_cpt_item( $post_id, $post ) {
806
+	protected function _insert_update_cpt_item($post_id, $post) {
807 807
 
808
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
809
-			return;// get out we're not processing the saving of venues.
808
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
809
+			return; // get out we're not processing the saving of venues.
810 810
 		}
811 811
 
812
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
812
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
813 813
 
814 814
 		$venue_values = array(
815
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
816
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
817
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
818
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
819
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
820
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
821
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
822
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
823
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
824
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
827
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
815
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
816
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
817
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
818
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
819
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
820
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
821
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
822
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
823
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
824
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
827
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
828 828
 			);
829 829
 
830 830
 		//update venue
831
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
831
+		$success = $this->_venue_model->update($venue_values, array($wheres));
832 832
 
833 833
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
834
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
835
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
834
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
835
+		$venue = $this->_venue_model->get_one(array($get_one_where));
836 836
 
837 837
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
838
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
838
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
839 839
 
840 840
 		$att_success = TRUE;
841 841
 
842
-		foreach ( $venue_update_callbacks as $v_callback ) {
843
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
844
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
842
+		foreach ($venue_update_callbacks as $v_callback) {
843
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
844
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
845 845
 		}
846 846
 
847 847
 		//any errors?
848
-		if ( $success && !$att_success ) {
849
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
850
-		} else if ( $success === FALSE ) {
851
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ($success && ! $att_success) {
849
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850
+		} else if ($success === FALSE) {
851
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
852 852
 		}
853 853
 	}
854 854
 
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
 
857 857
 
858 858
 
859
-	public function trash_cpt_item( $post_id ) {
859
+	public function trash_cpt_item($post_id) {
860 860
 		$this->_req_data['VNU_ID'] = $post_id;
861
-		$this->_trash_or_restore_venue( 'trash', FALSE );
861
+		$this->_trash_or_restore_venue('trash', FALSE);
862 862
 	}
863 863
 
864 864
 
@@ -866,18 +866,18 @@  discard block
 block discarded – undo
866 866
 
867 867
 
868 868
 
869
-	public function restore_cpt_item( $post_id ) {
869
+	public function restore_cpt_item($post_id) {
870 870
 		$this->_req_data['VNU_ID'] = $post_id;
871
-		$this->_trash_or_restore_venue( 'draft', FALSE );
871
+		$this->_trash_or_restore_venue('draft', FALSE);
872 872
 	}
873 873
 
874 874
 
875 875
 
876 876
 
877 877
 
878
-	public function delete_cpt_item( $post_id ) {
878
+	public function delete_cpt_item($post_id) {
879 879
 		$this->_req_data['VNU_ID'] = $post_id;
880
-		$this->_delete_venue( FALSE );
880
+		$this->_delete_venue(FALSE);
881 881
 	}
882 882
 
883 883
 
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 
895
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
896
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
895
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
896
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
897 897
 
898 898
 		//loop thru venues
899
-		if ( $VNU_ID ) {
899
+		if ($VNU_ID) {
900 900
 			//clean status
901
-			$venue_status = sanitize_key( $venue_status );
901
+			$venue_status = sanitize_key($venue_status);
902 902
 			// grab status
903
-			if (!empty($venue_status)) {
903
+			if ( ! empty($venue_status)) {
904 904
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
905 905
 			} else {
906 906
 				$success = FALSE;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		}
915 915
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
916 916
 
917
-		if ( $redirect_after )
917
+		if ($redirect_after)
918 918
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
919 919
 
920 920
 	}
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 
924 924
 
925 925
 
926
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
926
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
927 927
 		// clean status
928 928
 		$venue_status = sanitize_key($venue_status);
929 929
 		// grab status
930
-		if (!empty($venue_status)) {
930
+		if ( ! empty($venue_status)) {
931 931
 			$success = TRUE;
932 932
 			//determine the event id and set to array.
933 933
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -967,20 +967,20 @@  discard block
 block discarded – undo
967 967
 	 * @param  string $venue_status
968 968
 	 * @return void
969 969
 	 */
970
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
970
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
971 971
 		// grab venue id
972
-		if (! $VNU_ID) {
972
+		if ( ! $VNU_ID) {
973 973
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
974 974
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
975 975
 			return FALSE;
976 976
 		}
977 977
 
978
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
978
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
979 979
 
980 980
 		// clean status
981 981
 		$venue_status = sanitize_key($venue_status);
982 982
 		// grab status
983
-		if ( ! $venue_status ) {
983
+		if ( ! $venue_status) {
984 984
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
985 985
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
986 986
 			return FALSE;
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 				$hook = FALSE;
1002 1002
 		}
1003 1003
 		//use class to change status
1004
-		$this->_cpt_model_obj->set_status( $venue_status );
1004
+		$this->_cpt_model_obj->set_status($venue_status);
1005 1005
 		$success = $this->_cpt_model_obj->save();
1006 1006
 
1007 1007
 		if ($success === FALSE) {
@@ -1020,21 +1020,21 @@  discard block
 block discarded – undo
1020 1020
 	 * @param  bool $redirect_after
1021 1021
 	 * @return void
1022 1022
 	 */
1023
-	protected function _delete_venue( $redirect_after = true ) {
1023
+	protected function _delete_venue($redirect_after = true) {
1024 1024
 		//determine the venue id and set to array.
1025 1025
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1026
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1026
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1027 1027
 
1028 1028
 
1029 1029
 		// loop thru venues
1030 1030
 		if ($VNU_ID) {
1031
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1031
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1032 1032
 		} else {
1033 1033
 			$success = FALSE;
1034 1034
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1035 1035
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1036 1036
 		}
1037
-		if ( $redirect_after )
1037
+		if ($redirect_after)
1038 1038
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1039 1039
 	}
1040 1040
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 	//todo: put in parent
1067 1067
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1068 1068
 		// grab event id
1069
-		if (!$VNU_ID = absint($VNU_ID)) {
1069
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1070 1070
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1071 1071
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1072 1072
 			return FALSE;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1087 1087
 			return FALSE;
1088 1088
 		}
1089
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1089
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1090 1090
 		return TRUE;
1091 1091
 	}
1092 1092
 
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	/* QUERIES */
1098 1098
 
1099 1099
 
1100
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1100
+	public function get_venues($per_page = 10, $count = FALSE) {
1101 1101
 
1102
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1102
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1103 1103
 
1104
-		switch ( $_orderby ) {
1104
+		switch ($_orderby) {
1105 1105
 			case 'id':
1106 1106
 				$orderby = 'VNU_ID';
1107 1107
 				break;
@@ -1119,43 +1119,43 @@  discard block
 block discarded – undo
1119 1119
 		}
1120 1120
 
1121 1121
 
1122
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1122
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1123 1123
 
1124
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1125
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1126
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1124
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1125
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1126
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1127 1127
 
1128 1128
 
1129
-		$offset = ($current_page-1)*$per_page;
1129
+		$offset = ($current_page - 1) * $per_page;
1130 1130
 		$limit = array($offset, $per_page);
1131 1131
 
1132
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1132
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1133 1133
 		$where = array();
1134 1134
 
1135 1135
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1136
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1136
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1137 1137
 			$where['status'] = $this->_req_data['status'];
1138 1138
 		}
1139 1139
 
1140
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1140
+		if (isset($this->_req_data['venue_status'])) {
1141 1141
 			$where['status'] = $this->_req_data['venue_status'];
1142 1142
 		}
1143 1143
 
1144 1144
 
1145
-		if ( $category ) {
1145
+		if ($category) {
1146 1146
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1147 1147
 			$where['Term_Taxonomy.term_id'] = $category;
1148 1148
 		}
1149 1149
 
1150 1150
 
1151
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1152
-			$where['VNU_wp_user'] =  get_current_user_id();
1151
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1152
+			$where['VNU_wp_user'] = get_current_user_id();
1153 1153
 		} else {
1154
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1154
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1155 1155
 					$where['OR'] = array(
1156
-						'status*restrict_private' => array( '!=', 'private' ),
1156
+						'status*restrict_private' => array('!=', 'private'),
1157 1157
 						'AND'                     => array(
1158
-							'status*inclusive' => array( '=', 'private' ),
1158
+							'status*inclusive' => array('=', 'private'),
1159 1159
 							'VNU_wp_user'      => get_current_user_id()
1160 1160
 						)
1161 1161
 					);
@@ -1165,30 +1165,30 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
 
1167 1167
 
1168
-		if ( isset( $this->_req_data['s'] ) ) {
1169
-			$sstr = '%' . $this->_req_data['s'] . '%';
1168
+		if (isset($this->_req_data['s'])) {
1169
+			$sstr = '%'.$this->_req_data['s'].'%';
1170 1170
 			$where['OR'] = array(
1171
-				'VNU_name' => array('LIKE',$sstr ),
1172
-				'VNU_desc' => array('LIKE',$sstr ),
1173
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1174
-				'VNU_address' => array( 'LIKE', $sstr ),
1175
-				'VNU_address2' => array( 'LIKE', $sstr ),
1176
-				'VNU_city' => array( 'LIKE', $sstr ),
1177
-				'VNU_zip' => array( 'LIKE', $sstr ),
1178
-				'VNU_phone' => array( 'LIKE', $sstr ),
1179
-				'VNU_url' => array( 'LIKE', $sstr ),
1180
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1181
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1182
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1183
-				'Event.EVT_name' => array('LIKE', $sstr ),
1184
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1185
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1186
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1171
+				'VNU_name' => array('LIKE', $sstr),
1172
+				'VNU_desc' => array('LIKE', $sstr),
1173
+				'VNU_short_desc' => array('LIKE', $sstr),
1174
+				'VNU_address' => array('LIKE', $sstr),
1175
+				'VNU_address2' => array('LIKE', $sstr),
1176
+				'VNU_city' => array('LIKE', $sstr),
1177
+				'VNU_zip' => array('LIKE', $sstr),
1178
+				'VNU_phone' => array('LIKE', $sstr),
1179
+				'VNU_url' => array('LIKE', $sstr),
1180
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1181
+				'VNU_virtual_url' => array('LIKE', $sstr),
1182
+				'VNU_google_map_link' => array('LIKE', $sstr),
1183
+				'Event.EVT_name' => array('LIKE', $sstr),
1184
+				'Event.EVT_desc' => array('LIKE', $sstr),
1185
+				'Event.EVT_phone' => array('LIKE', $sstr),
1186
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1187 1187
 				);
1188 1188
 		}
1189 1189
 
1190 1190
 
1191
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1191
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1192 1192
 
1193 1193
 		return $venues;
1194 1194
 
@@ -1206,22 +1206,22 @@  discard block
 block discarded – undo
1206 1206
 	 * @return void
1207 1207
 	 */
1208 1208
 	private function _set_category_object() {
1209
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1209
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1210 1210
 			return; //already have the category object so get out.
1211 1211
 
1212 1212
 		//set default category object
1213 1213
 		$this->_set_empty_category_object();
1214 1214
 
1215 1215
 		//only set if we've got an id
1216
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1216
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1217 1217
 			return;
1218 1218
 		}
1219 1219
 
1220 1220
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1221
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1221
+		$term = get_term($category_id, 'espresso_venue_categories');
1222 1222
 
1223 1223
 
1224
-		if ( !empty( $term ) ) {
1224
+		if ( ! empty($term)) {
1225 1225
 			$this->_category->category_name = $term->name;
1226 1226
 			$this->_category->category_identifier = $term->slug;
1227 1227
 			$this->_category->category_desc = $term->description;
@@ -1235,14 +1235,14 @@  discard block
 block discarded – undo
1235 1235
 
1236 1236
 	private function _set_empty_category_object() {
1237 1237
 		$this->_category = new stdClass();
1238
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1238
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1239 1239
 		$this->_category->id = $this->_category->parent = 0;
1240 1240
 	}
1241 1241
 
1242 1242
 
1243 1243
 
1244 1244
 	protected function _category_list_table() {
1245
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1245
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1246 1246
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1247 1247
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1248 1248
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1258,13 +1258,13 @@  discard block
 block discarded – undo
1258 1258
 		$this->_set_add_edit_form_tags($route);
1259 1259
 
1260 1260
 		$this->_set_category_object();
1261
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1261
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1262 1262
 
1263 1263
 		$delete_action = 'delete_category';
1264 1264
 
1265
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1265
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1266 1266
 
1267
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1267
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1268 1268
 
1269 1269
 		//take care of contents
1270 1270
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1278,25 +1278,25 @@  discard block
 block discarded – undo
1278 1278
 			'type' => 'wp_editor',
1279 1279
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1280 1280
 			'class' => 'my_editor_custom',
1281
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1281
+			'wpeditor_args' => array('media_buttons' => FALSE)
1282 1282
 		);
1283
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1283
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1284 1284
 
1285
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1285
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1286 1286
 
1287 1287
 		//setup category select for term parents.
1288 1288
 		$category_select_values[] = array(
1289 1289
 			'text' => __('No Parent', 'event_espresso'),
1290 1290
 			'id' => 0
1291 1291
 			);
1292
-		foreach ( $all_terms as $term ) {
1292
+		foreach ($all_terms as $term) {
1293 1293
 			$category_select_values[] = array(
1294 1294
 				'text' => $term->name,
1295 1295
 				'id' => $term->term_id
1296 1296
 				);
1297 1297
 		}
1298 1298
 
1299
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1299
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1300 1300
 		$template_args = array(
1301 1301
 			'category' => $this->_category,
1302 1302
 			'category_select' => $category_select,
@@ -1305,15 +1305,15 @@  discard block
 block discarded – undo
1305 1305
 			'disable' => '',
1306 1306
 			'disabled_message' =>FALSE
1307 1307
 			);
1308
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1309
-		return EEH_Template::display_template($template, $template_args, TRUE );
1308
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1309
+		return EEH_Template::display_template($template, $template_args, TRUE);
1310 1310
 	}
1311 1311
 
1312 1312
 
1313 1313
 	protected function _delete_categories() {
1314
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1314
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1315 1315
 
1316
-		foreach ( $cat_ids as $cat_id ) {
1316
+		foreach ($cat_ids as $cat_id) {
1317 1317
 			$this->_delete_category($cat_id);
1318 1318
 		}
1319 1319
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 		$query_args = array(
1322 1322
 			'action' => 'category_list'
1323 1323
 			);
1324
-		$this->_redirect_after_action(0,'','',$query_args);
1324
+		$this->_redirect_after_action(0, '', '', $query_args);
1325 1325
 
1326 1326
 	}
1327 1327
 
@@ -1330,58 +1330,58 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 
1332 1332
 	protected function _delete_category($cat_id) {
1333
-		$cat_id = absint( $cat_id );
1334
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1333
+		$cat_id = absint($cat_id);
1334
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1335 1335
 	}
1336 1336
 
1337 1337
 
1338 1338
 
1339 1339
 	protected function _insert_or_update_category($new_category) {
1340 1340
 
1341
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1341
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1342 1342
 		$success = 0; //we already have a success message so lets not send another.
1343
-		if ( $cat_id ) {
1343
+		if ($cat_id) {
1344 1344
 			$query_args = array(
1345 1345
 				'action'     => 'edit_category',
1346 1346
 				'VEN_CAT_ID' => $cat_id
1347 1347
 			);
1348 1348
 		} else {
1349
-			$query_args = array( 'action' => 'add_category' );
1349
+			$query_args = array('action' => 'add_category');
1350 1350
 		}
1351
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1351
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1352 1352
 
1353 1353
 	}
1354 1354
 
1355 1355
 
1356 1356
 
1357
-	private function _insert_category( $update = FALSE ) {
1357
+	private function _insert_category($update = FALSE) {
1358 1358
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1359
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1360
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1361
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1359
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1360
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1361
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1362 1362
 
1363
-		if ( empty( $category_name ) ) {
1364
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1365
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1363
+		if (empty($category_name)) {
1364
+			$msg = __('You must add a name for the category.', 'event_espresso');
1365
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1366 1366
 			return false;
1367 1367
 		}
1368 1368
 
1369 1369
 
1370
-		$term_args=array(
1370
+		$term_args = array(
1371 1371
 			'name'=>$category_name,
1372 1372
 			'description'=>$category_desc,
1373 1373
 			'parent'=>$category_parent
1374 1374
 		);
1375 1375
 
1376
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1376
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1377 1377
 
1378
-		if ( !is_array( $insert_ids ) ) {
1379
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1380
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1378
+		if ( ! is_array($insert_ids)) {
1379
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1380
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1381 1381
 		} else {
1382 1382
 			$cat_id = $insert_ids['term_id'];
1383
-			$msg = sprintf ( __('The category %s was successfully created', 'event_espresso'), $category_name );
1384
-			EE_Error::add_success( $msg );
1383
+			$msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name);
1384
+			EE_Error::add_success($msg);
1385 1385
 		}
1386 1386
 
1387 1387
 		return $cat_id;
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1402 1402
 			);
1403 1403
 
1404
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1404
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1405 1405
 
1406
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1407
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1408
-			$EE_Export = EE_Export::instance( $this->_req_data );
1406
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1407
+			require_once(EE_CLASSES.'EE_Export.class.php');
1408
+			$EE_Export = EE_Export::instance($this->_req_data);
1409 1409
 			$EE_Export->export();
1410 1410
 		}
1411 1411
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 	protected function _import_categories() {
1419 1419
 
1420
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1420
+		require_once(EE_CLASSES.'EE_Import.class.php');
1421 1421
 		EE_Import::instance()->import();
1422 1422
 
1423 1423
 	}
@@ -1425,29 +1425,29 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 
1427 1427
 
1428
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1428
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1429 1429
 
1430 1430
 		//testing term stuff
1431
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1433
-		$limit = ($current_page-1)*$per_page;
1434
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1435
-		if ( isset( $this->_req_data['s'] ) ) {
1436
-			$sstr = '%' . $this->_req_data['s'] . '%';
1431
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1433
+		$limit = ($current_page - 1) * $per_page;
1434
+		$where = array('taxonomy' => 'espresso_venue_categories');
1435
+		if (isset($this->_req_data['s'])) {
1436
+			$sstr = '%'.$this->_req_data['s'].'%';
1437 1437
 			$where['OR'] = array(
1438
-				'Term.name' => array( 'LIKE', $sstr),
1439
-				'description' => array( 'LIKE', $sstr )
1438
+				'Term.name' => array('LIKE', $sstr),
1439
+				'description' => array('LIKE', $sstr)
1440 1440
 				);
1441 1441
 		}
1442 1442
 
1443 1443
 		$query_params = array(
1444 1444
 			$where,
1445
-			'order_by' => array( $orderby => $order ),
1446
-			'limit' => $limit . ',' . $per_page,
1445
+			'order_by' => array($orderby => $order),
1446
+			'limit' => $limit.','.$per_page,
1447 1447
 			'force_join' => array('Term')
1448 1448
 			);
1449 1449
 
1450
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1450
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1451 1451
 
1452 1452
 		return $categories;
1453 1453
 	}
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				'edit' => __('Update Event', 'event_espresso'),
93 93
 				'add_category' => __('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => __('Update Category', 'event_espresso'),
95
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => __('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		//load field generator helper
103 103
 
104 104
 		//is there a evt_id in the request?
105
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
106
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
105
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
106
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
107 107
 
108 108
 
109 109
 		$this->_page_routes = array(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 				'help_tour' => array(
318 318
 					'Event_Editor_Help_Tour'
319 319
 					),
320
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
320
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
321 321
 				'require_nonce' => FALSE
322 322
 			),
323 323
 			'edit' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				/*'help_tour' => array(
374 374
 					'Event_Edit_Help_Tour'
375 375
 				),*/
376
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
376
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
377 377
 				'require_nonce' => FALSE
378 378
 			),
379 379
 			'default_event_settings' => array(
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						'filename' => 'events_default_settings_status'
396 396
 					)
397 397
 				),
398
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
398
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
399 399
 				'require_nonce' => FALSE
400 400
 			),
401 401
 			//template settings
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 						'filename' => 'general_settings_templates'
412 412
 					)
413 413
 				),
414
-				'help_tour' => array( 'Templates_Help_Tour' ),
414
+				'help_tour' => array('Templates_Help_Tour'),
415 415
 				'require_nonce' => FALSE
416 416
 			),
417 417
 			//event category stuff
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					'label' => __('Edit Category', 'event_espresso'),
436 436
 					'order' => 15,
437 437
 					'persistent' => FALSE,
438
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
438
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
439 439
 					),
440 440
 				'help_tabs' => array(
441 441
 					'edit_category_help_tab' => array(
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 
506 506
 	public function load_scripts_styles() {
507 507
 
508
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
508
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
510 510
 		wp_enqueue_style('events-admin-css');
511 511
 		wp_enqueue_style('ee-cat-admin');
512 512
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
513 513
 		//registers for all views
514 514
 		//scripts
515
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
515
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
516 516
 	}
517 517
 
518 518
 	/**
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	public function load_scripts_styles_edit() {
531 531
 		//styles
532 532
 		wp_enqueue_style('espresso-ui-theme');
533
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
533
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
534 534
 		wp_enqueue_style('event-editor-css');
535 535
 
536 536
 		//scripts
537
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
537
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
538 538
 		wp_enqueue_script('event-datetime-metabox');
539 539
 
540 540
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
 
571 571
 	public function admin_init() {
572
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
572
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
573 573
 	}
574 574
 
575 575
 
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function verify_event_edit($event = NULL) {
592 592
 		// no event?
593
-		if ( empty( $event )) {
593
+		if (empty($event)) {
594 594
 			// set event
595 595
 			$event = $this->_cpt_model_obj;
596 596
 		}
597 597
 		// STILL no event?
598
-		if ( empty ( $event )) {
598
+		if (empty ($event)) {
599 599
 			return;
600 600
 		}
601 601
 		$orig_status = $event->status();
@@ -609,27 +609,27 @@  discard block
 block discarded – undo
609 609
 			return;
610 610
 		}
611 611
 		//made it here so it IS active... next check that any of the tickets are sold.
612
-		if ( $event->is_sold_out( true ) ) {
613
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
612
+		if ($event->is_sold_out(true)) {
613
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
614 614
 				EE_Error::add_attention(
615 615
 					sprintf(
616
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
617
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
616
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
617
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
618 618
 					)
619 619
 				);
620 620
 			}
621 621
 			return;
622
-		} else if ( $orig_status === EEM_Event::sold_out ) {
622
+		} else if ($orig_status === EEM_Event::sold_out) {
623 623
 			EE_Error::add_attention(
624 624
 				sprintf(
625
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
-						'event_espresso' ),
627
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
625
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
+						'event_espresso'),
627
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
628 628
 				)
629 629
 			);
630 630
 		}
631 631
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
632
-		if ( ! $event->tickets_on_sale() ) {
632
+		if ( ! $event->tickets_on_sale()) {
633 633
 			return;
634 634
 		}
635 635
 		//made it here so show warning
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	protected function _edit_event_warning() {
650 650
 		// we don't want to add warnings during these requests
651
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
651
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
652 652
 			return;
653 653
 		}
654 654
 		EE_Error::add_attention(
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			),
680 680
 		);
681 681
 
682
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
682
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
683 683
 			$this->_views['trash'] = array(
684 684
 				'slug' => 'trash',
685 685
 				'label' => __('Trash', 'event_espresso'),
@@ -709,39 +709,39 @@  discard block
 block discarded – undo
709 709
 				'desc' => __('View Registrations for Event', 'event_espresso')
710 710
 			)
711 711
 		);
712
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
712
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
713 713
 		$statuses = array(
714 714
 			'sold_out_status' => array(
715
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
716
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
715
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
716
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
717 717
 			),
718 718
 			'active_status' => array(
719
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
720
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
719
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
720
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
721 721
 			),
722 722
 			'upcoming_status' => array(
723
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
724
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
723
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
724
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
725 725
 			),
726 726
 			'postponed_status' => array(
727
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
728
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
727
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
728
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
729 729
 			),
730 730
 			'cancelled_status' => array(
731
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
732
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
731
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
732
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
733 733
 			),
734 734
 			'expired_status' => array(
735
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
736
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
735
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
736
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
737 737
 			),
738 738
 			'inactive_status' => array(
739
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
740
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
739
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
740
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
741 741
 			)
742 742
 		);
743
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
744
-		return array_merge( $items, $statuses );
743
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
744
+		return array_merge($items, $statuses);
745 745
 	}
746 746
 
747 747
 
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @return EEM_Event
754 754
 	 */
755 755
 	private function _event_model() {
756
-		if ( ! $this->_event_model instanceof EEM_Event ) {
757
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
756
+		if ( ! $this->_event_model instanceof EEM_Event) {
757
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
758 758
 		}
759 759
 		return $this->_event_model;
760 760
 	}
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 	 * @param  string $new_slug  what the slug is
774 774
 	 * @return string            The new html string for the permalink area
775 775
 	 */
776
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
776
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
777 777
 		//make sure this is only when editing
778
-		if ( !empty( $id ) ) {
779
-			$post = get_post( $id );
780
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
781
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
778
+		if ( ! empty($id)) {
779
+			$post = get_post($id);
780
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
781
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
782 782
 		}
783 783
 		return $return;
784 784
 	}
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
 	 * @return string html for generated table
795 795
 	 */
796 796
 	protected function _events_overview_list_table() {
797
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
798
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
797
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
798
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
799 799
 		$this->_display_legend($this->_event_legend_items());
800 800
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
801 801
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -813,51 +813,51 @@  discard block
 block discarded – undo
813 813
 
814 814
 
815 815
 
816
-	protected function _insert_update_cpt_item( $post_id, $post ) {
816
+	protected function _insert_update_cpt_item($post_id, $post) {
817 817
 
818
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
818
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
819 819
 			//getout we're not processing an event save.
820 820
 			return;
821 821
 		}
822 822
 
823 823
 		$event_values = array(
824
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
825
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
824
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
825
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
826 826
 			'EVT_additional_limit' => min(
827
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
828
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
829
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
831
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
832
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
833
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
834
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
827
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
828
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
829
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
831
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
832
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
833
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
834
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
835 835
 			);
836 836
 
837 837
 		//update event
838
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
838
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
839 839
 
840 840
 
841 841
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
842
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
843
-		$event = $this->_event_model()->get_one( array($get_one_where) );
842
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
843
+		$event = $this->_event_model()->get_one(array($get_one_where));
844 844
 
845 845
 
846 846
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
847
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
847
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
848 848
 
849 849
 		$att_success = TRUE;
850 850
 
851
-		foreach ( $event_update_callbacks as $e_callback ) {
852
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
853
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
851
+		foreach ($event_update_callbacks as $e_callback) {
852
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
853
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
854 854
 		}
855 855
 
856 856
 		//any errors?
857
-		if ( $success && FALSE === $att_success ) {
858
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
-		} else if ( $success === FALSE ) {
860
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
857
+		if ($success && FALSE === $att_success) {
858
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
859
+		} else if ($success === FALSE) {
860
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861 861
 		}
862 862
 	}
863 863
 
@@ -867,14 +867,14 @@  discard block
 block discarded – undo
867 867
 	/**
868 868
 	 * @see parent::restore_item()
869 869
 	 */
870
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
870
+	protected function _restore_cpt_item($post_id, $revision_id) {
871 871
 		//copy existing event meta to new post
872 872
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
873
-		if ( $post_evt instanceof EE_Event ) {
873
+		if ($post_evt instanceof EE_Event) {
874 874
 			//meta revision restore
875
-			$post_evt->restore_revision( $revision_id );
875
+			$post_evt->restore_revision($revision_id);
876 876
 			//related objs restore
877
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
877
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
878 878
 		}
879 879
 	}
880 880
 
@@ -887,52 +887,52 @@  discard block
 block discarded – undo
887 887
 	 * @param  array  $data   The request data from the form
888 888
 	 * @return bool           Success or fail.
889 889
 	 */
890
-	protected function _default_venue_update( $evtobj, $data ) {
891
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
890
+	protected function _default_venue_update($evtobj, $data) {
891
+		require_once(EE_MODELS.'EEM_Venue.model.php');
892 892
 		$venue_model = EE_Registry::instance()->load_model('Venue');
893 893
 		$rows_affected = NULL;
894
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
894
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
895 895
 
896 896
 		// very important.  If we don't have a venue name...
897 897
 		// then we'll get out because not necessary to create empty venue
898
-		if ( empty( $data['venue_title'] ) ) {
898
+		if (empty($data['venue_title'])) {
899 899
 			return false;
900 900
 		}
901 901
 
902 902
 		$venue_array = array(
903 903
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
904
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
905
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
906
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
907
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
908
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
909
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
910
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
911
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
912
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
913
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
914
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
915
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
916
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
917
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
919
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
904
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
905
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
906
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
907
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
908
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
909
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
910
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
911
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
912
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
913
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
914
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
915
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
916
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
917
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
919
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
920 920
 				'status' => 'publish'
921 921
 			);
922 922
 
923 923
 
924 924
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
925
-		if ( !empty( $venue_id ) ) {
926
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
927
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
925
+		if ( ! empty($venue_id)) {
926
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
927
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
928 928
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
929
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
929
+			$evtobj->_add_relation_to($venue_id, 'Venue');
930 930
 			return $rows_affected > 0 ? TRUE : FALSE;
931 931
 		} else {
932 932
 			//we insert the venue
933
-			$venue_id = $venue_model->insert( $venue_array );
934
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
935
-			return !empty( $venue_id ) ? TRUE : FALSE;
933
+			$venue_id = $venue_model->insert($venue_array);
934
+			$evtobj->_add_relation_to($venue_id, 'Venue');
935
+			return ! empty($venue_id) ? TRUE : FALSE;
936 936
 		}
937 937
 		//when we have the ancestor come in it's already been handled by the revision save.
938 938
 	}
@@ -946,54 +946,54 @@  discard block
 block discarded – undo
946 946
 	 * @param  array    $data   The request data from the form
947 947
 	 * @return bool             success or fail
948 948
 	 */
949
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
949
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
950 950
 		$success = true;
951 951
 		$saved_dtt = null;
952 952
 		$saved_tickets = array();
953
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
953
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
954 954
 
955
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
955
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
956 956
 			//trim all values to ensure any excess whitespace is removed.
957
-			$dtt =  array_map( 'trim', $dtt );
958
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
957
+			$dtt = array_map('trim', $dtt);
958
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959 959
 			$datetime_values = array(
960
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
960
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
961 961
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
962 962
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
963
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
963
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
964 964
 				'DTT_order' 	=> $row,
965 965
 			);
966 966
 
967 967
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
968 968
 
969
-			if ( !empty( $dtt['DTT_ID'] ) ) {
970
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
971
-				$DTM->set_date_format( $incoming_date_formats[0] );
972
-				$DTM->set_time_format( $incoming_date_formats[1] );
973
-				foreach ( $datetime_values as $field => $value ) {
974
-					$DTM->set( $field, $value );
969
+			if ( ! empty($dtt['DTT_ID'])) {
970
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
971
+				$DTM->set_date_format($incoming_date_formats[0]);
972
+				$DTM->set_time_format($incoming_date_formats[1]);
973
+				foreach ($datetime_values as $field => $value) {
974
+					$DTM->set($field, $value);
975 975
 				}
976 976
 
977 977
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
978 978
 				$saved_dtts[$DTM->ID()] = $DTM;
979 979
 			} else {
980
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
981
-				$DTM->set_date_format( $incoming_date_formats[0] );
982
-				$DTM->set_time_format( $incoming_date_formats[1] );
983
-				$DTM->set_timezone( $evtobj->get_timezone() );
984
-				foreach ( $datetime_values as $field => $value ) {
985
-					$DTM->set( $field, $value );
980
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
981
+				$DTM->set_date_format($incoming_date_formats[0]);
982
+				$DTM->set_time_format($incoming_date_formats[1]);
983
+				$DTM->set_timezone($evtobj->get_timezone());
984
+				foreach ($datetime_values as $field => $value) {
985
+					$DTM->set($field, $value);
986 986
 				}
987 987
 			}
988 988
 			$DTM->save();
989 989
 
990
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
990
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
991 991
 
992 992
 			//load DTT helper
993 993
 
994 994
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
995
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
996
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
995
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
996
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
997 997
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
998 998
 				$DTT->save();
999 999
 			}
@@ -1001,45 +1001,45 @@  discard block
 block discarded – undo
1001 1001
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1002 1002
 			$saved_dtt = $DTT;
1003 1003
 
1004
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1004
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1005 1005
 		}
1006 1006
 
1007 1007
 		//no dtts get deleted so we don't do any of that logic here.
1008 1008
 		//update tickets next
1009
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1010
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1011
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1009
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1010
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1011
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1012 1012
 			$update_prices = false;
1013
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1013
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1014 1014
 
1015 1015
 			// trim inputs to ensure any excess whitespace is removed.
1016
-			$tkt = array_map( 'trim', $tkt );
1016
+			$tkt = array_map('trim', $tkt);
1017 1017
 
1018
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1018
+			if (empty($tkt['TKT_start_date'])) {
1019 1019
 				//let's use now in the set timezone.
1020
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1021
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1020
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1021
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1022 1022
 			}
1023 1023
 
1024
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1024
+			if (empty($tkt['TKT_end_date'])) {
1025 1025
 				//use the start date of the first datetime
1026 1026
 				$dtt = $evtobj->first_datetime();
1027
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1027
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1028 1028
 			}
1029 1029
 
1030 1030
 			$TKT_values = array(
1031
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1032
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1033
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1034
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1031
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1032
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1033
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1034
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1035 1035
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1036 1036
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1037
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1038
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1039
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1040
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1037
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1038
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1039
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1040
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1041 1041
 				'TKT_row' 			=> $row,
1042
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1042
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1043 1043
 				'TKT_price' 		=> $ticket_price
1044 1044
 			);
1045 1045
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 
1049 1049
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1050
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1050
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1051 1051
 				$TKT_values['TKT_ID'] = 0;
1052 1052
 				$TKT_values['TKT_is_default'] = 0;
1053 1053
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1058,58 +1058,58 @@  discard block
 block discarded – undo
1058 1058
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1059 1059
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1060 1060
 
1061
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1062
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1063
-				if ( $TKT instanceof EE_Ticket ) {
1064
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1061
+			if ( ! empty($tkt['TKT_ID'])) {
1062
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1063
+				if ($TKT instanceof EE_Ticket) {
1064
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1065 1065
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1066
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1067
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1068
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1066
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1067
+					$TKT->set_date_format($incoming_date_formats[0]);
1068
+					$TKT->set_time_format($incoming_date_formats[1]);
1069 1069
 					//set new values
1070
-					foreach ( $TKT_values as $field => $value ) {
1071
-						if ( $field == 'TKT_qty' ) {
1072
-							$TKT->set_qty( $value );
1070
+					foreach ($TKT_values as $field => $value) {
1071
+						if ($field == 'TKT_qty') {
1072
+							$TKT->set_qty($value);
1073 1073
 						} else {
1074
-							$TKT->set( $field, $value );
1074
+							$TKT->set($field, $value);
1075 1075
 						}
1076 1076
 					}
1077 1077
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1078
-					if ( $create_new_TKT ) {
1078
+					if ($create_new_TKT) {
1079 1079
 						//archive the old ticket first
1080
-						$TKT->set( 'TKT_deleted', 1 );
1080
+						$TKT->set('TKT_deleted', 1);
1081 1081
 						$TKT->save();
1082 1082
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1083
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1083
+						$saved_tickets[$TKT->ID()] = $TKT;
1084 1084
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1085 1085
 						$TKT = clone $TKT;
1086
-						$TKT->set( 'TKT_ID', 0 );
1087
-						$TKT->set( 'TKT_deleted', 0 );
1088
-						$TKT->set( 'TKT_price', $ticket_price );
1089
-						$TKT->set( 'TKT_sold', 0 );
1086
+						$TKT->set('TKT_ID', 0);
1087
+						$TKT->set('TKT_deleted', 0);
1088
+						$TKT->set('TKT_price', $ticket_price);
1089
+						$TKT->set('TKT_sold', 0);
1090 1090
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1091 1091
 						$update_prices = true;
1092 1092
 					}
1093 1093
 					//make sure price is set if it hasn't been already
1094
-					$TKT->set( 'TKT_price', $ticket_price );
1094
+					$TKT->set('TKT_price', $ticket_price);
1095 1095
 				}
1096 1096
 
1097 1097
 			} else {
1098 1098
 				//no TKT_id so a new TKT
1099 1099
 				$TKT_values['TKT_price'] = $ticket_price;
1100
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1101
-				if ( $TKT instanceof EE_Ticket ) {
1100
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1101
+				if ($TKT instanceof EE_Ticket) {
1102 1102
 					//need to reset values to properly account for the date formats
1103
-					$TKT->set_date_format( $incoming_date_formats[0] );
1104
-					$TKT->set_time_format( $incoming_date_formats[1] );
1105
-					$TKT->set_timezone( $evtobj->get_timezone() );
1103
+					$TKT->set_date_format($incoming_date_formats[0]);
1104
+					$TKT->set_time_format($incoming_date_formats[1]);
1105
+					$TKT->set_timezone($evtobj->get_timezone());
1106 1106
 
1107 1107
 					//set new values
1108
-					foreach ( $TKT_values as $field => $value ) {
1109
-						if ( $field == 'TKT_qty' ) {
1110
-							$TKT->set_qty( $value );
1108
+					foreach ($TKT_values as $field => $value) {
1109
+						if ($field == 'TKT_qty') {
1110
+							$TKT->set_qty($value);
1111 1111
 						} else {
1112
-							$TKT->set( $field, $value );
1112
+							$TKT->set($field, $value);
1113 1113
 						}
1114 1114
 					}
1115 1115
 
@@ -1117,31 +1117,31 @@  discard block
 block discarded – undo
1117 1117
 				}
1118 1118
 			}
1119 1119
 			// cap ticket qty by datetime reg limits
1120
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1120
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1121 1121
 			//update ticket.
1122 1122
 			$TKT->save();
1123 1123
 
1124 1124
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1125
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1126
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1125
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1126
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1127 1127
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1128 1128
 				$TKT->save();
1129 1129
 			}
1130 1130
 
1131 1131
 			//initially let's add the ticket to the dtt
1132
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1132
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1133 1133
 
1134 1134
 			$saved_tickets[$TKT->ID()] = $TKT;
1135 1135
 
1136 1136
 			//add prices to ticket
1137
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1137
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1138 1138
 		}
1139 1139
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1140
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1140
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1142 1142
 
1143
-		foreach ( $tickets_removed as $id ) {
1144
-			$id = absint( $id );
1143
+		foreach ($tickets_removed as $id) {
1144
+			$id = absint($id);
1145 1145
 
1146 1146
 			//get the ticket for this id
1147 1147
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1150 1150
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1151 1151
 
1152
-			foreach( $dtts as $dtt ) {
1152
+			foreach ($dtts as $dtt) {
1153 1153
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1154 1154
 			}
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1161 1161
 			$tkt_to_remove->delete_permanently();
1162 1162
 		}
1163
-		return array( $saved_dtt, $saved_tickets );
1163
+		return array($saved_dtt, $saved_tickets);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1175,31 +1175,31 @@  discard block
 block discarded – undo
1175 1175
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1176 1176
 	 * @return  void
1177 1177
 	 */
1178
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1179
-		foreach ( $prices as $row => $prc ) {
1178
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1179
+		foreach ($prices as $row => $prc) {
1180 1180
 			$PRC_values = array(
1181
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1182
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1183
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1184
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1185
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1181
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1182
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1183
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1184
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1185
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1186 1186
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1187 1187
 				'PRC_order' => $row
1188 1188
 			);
1189 1189
 
1190
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1190
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1191 1191
 				$PRC_values['PRC_ID'] = 0;
1192
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1192
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1193 1193
 			} else {
1194
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1194
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1195 1195
 				//update this price with new values
1196
-				foreach ( $PRC_values as $field => $newprc ) {
1197
-					$PRC->set( $field, $newprc );
1196
+				foreach ($PRC_values as $field => $newprc) {
1197
+					$PRC->set($field, $newprc);
1198 1198
 				}
1199 1199
 				$PRC->save();
1200 1200
 			}
1201 1201
 
1202
-			$ticket->_add_relation_to( $PRC, 'Price' );
1202
+			$ticket->_add_relation_to($PRC, 'Price');
1203 1203
 		}
1204 1204
 	}
1205 1205
 
@@ -1237,9 +1237,9 @@  discard block
 block discarded – undo
1237 1237
 		//load formatter helper
1238 1238
 
1239 1239
   		//args for getting related registrations
1240
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1241
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1242
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1240
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1241
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1242
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1243 1243
 
1244 1244
 
1245 1245
 		// publish box
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
 				),
1269 1269
 				REG_ADMIN_URL
1270 1270
 			),
1271
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1272
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1273
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1271
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1272
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1273
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1274 1274
 			'misc_pub_section_class' => apply_filters(
1275 1275
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1276 1276
 				'misc-pub-section'
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1290 1290
 			$this->_cpt_model_obj
1291 1291
 		);
1292
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1292
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1293 1293
 		// load template
1294
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1294
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1295 1295
 	}
1296 1296
 
1297 1297
 
@@ -1323,16 +1323,16 @@  discard block
 block discarded – undo
1323 1323
 		$this->verify_cpt_object();
1324 1324
 		add_meta_box(
1325 1325
 			'espresso_event_editor_tickets',
1326
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1327
-			array( $this, 'ticket_metabox' ),
1326
+			__('Event Datetime & Ticket', 'event_espresso'),
1327
+			array($this, 'ticket_metabox'),
1328 1328
 			$this->page_slug,
1329 1329
 			'normal',
1330 1330
 			'high'
1331 1331
 		);
1332 1332
 		add_meta_box(
1333 1333
 			'espresso_event_editor_event_options',
1334
-			__( 'Event Registration Options', 'event_espresso' ),
1335
-			array( $this, 'registration_options_meta_box' ),
1334
+			__('Event Registration Options', 'event_espresso'),
1335
+			array($this, 'registration_options_meta_box'),
1336 1336
 			$this->page_slug,
1337 1337
 			'side',
1338 1338
 			'default'
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
 			'disabled' => ''
1363 1363
 			);
1364 1364
 
1365
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1365
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1366 1366
 
1367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1368 1368
 
1369 1369
 		/**
1370 1370
 		 * 1. Start with retrieving Datetimes
1371 1371
 		 * 2. Fore each datetime get related tickets
1372 1372
 		 * 3. For each ticket get related prices
1373 1373
 		 */
1374
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1374
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1375 1375
 		/** @type EE_Datetime $first_datetime */
1376
-		$first_datetime = reset( $times );
1376
+		$first_datetime = reset($times);
1377 1377
 		//do we get related tickets?
1378
-		if ( $first_datetime instanceof EE_Datetime
1379
-			&& $first_datetime->ID() !== 0 ) {
1378
+		if ($first_datetime instanceof EE_Datetime
1379
+			&& $first_datetime->ID() !== 0) {
1380 1380
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1381 1381
 			$template_args['time'] = $first_datetime;
1382 1382
 			$related_tickets = $first_datetime->tickets(
1383 1383
 				array(
1384
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1384
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1385 1385
 					'default_where_conditions' => 'none'
1386 1386
 				)
1387 1387
 			);
1388 1388
 
1389
-			if ( !empty($related_tickets) ) {
1389
+			if ( ! empty($related_tickets)) {
1390 1390
 				$template_args['total_ticket_rows'] = count($related_tickets);
1391 1391
 				$row = 0;
1392
-				foreach ( $related_tickets as $ticket ) {
1392
+				foreach ($related_tickets as $ticket) {
1393 1393
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1394
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1394
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1395 1395
 
1396 1396
 					$row++;
1397 1397
 				}
@@ -1399,13 +1399,13 @@  discard block
 block discarded – undo
1399 1399
 				$template_args['total_ticket_rows'] = 1;
1400 1400
 				/** @type EE_Ticket $ticket */
1401 1401
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1402
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1402
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1403 1403
 			}
1404 1404
 		} else {
1405 1405
 			$template_args['time'] = $times[0];
1406 1406
 			/** @type EE_Ticket $ticket */
1407 1407
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1408
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1408
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1409 1409
 			// NOTE: we're just sending the first default row
1410 1410
 			// (decaf can't manage default tickets so this should be sufficient);
1411 1411
 		}
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1415 1415
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1416 1416
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1417
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1418
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1417
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1418
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1419 1419
 		EEH_Template::display_template($template, $template_args);
1420 1420
 	}
1421 1421
 
@@ -1430,21 +1430,21 @@  discard block
 block discarded – undo
1430 1430
 	 * @param int        $row
1431 1431
 	 * @return string generated html for the ticket row.
1432 1432
 	 */
1433
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1433
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1434 1434
 		$template_args = array(
1435
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1436
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1435
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1436
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1437 1437
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1438 1438
 			'TKT_ID' => $ticket->get('TKT_ID'),
1439 1439
 			'TKT_name' => $ticket->get('TKT_name'),
1440 1440
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1441 1441
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1442 1442
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1443
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1443
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1444 1444
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1445 1445
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1446
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1446
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1448 1448
 			);
1449 1449
 
1450 1450
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1460,23 +1460,23 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
 		//make sure we have default start and end dates if skeleton
1462 1462
 		//handle rows that should NOT be empty
1463
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1463
+		if (empty($template_args['TKT_start_date'])) {
1464 1464
 			//if empty then the start date will be now.
1465 1465
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1466 1466
 		}
1467 1467
 
1468
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1468
+		if (empty($template_args['TKT_end_date'])) {
1469 1469
 			//get the earliest datetime (if present);
1470
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1470
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1471 1471
 
1472
-			if ( !empty( $earliest_dtt ) )
1472
+			if ( ! empty($earliest_dtt))
1473 1473
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1474 1474
 			else
1475
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1475
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1476 1476
 		}
1477 1477
 
1478
-		$template_args = array_merge( $template_args, $price_args );
1479
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1478
+		$template_args = array_merge($template_args, $price_args);
1479
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1480 1480
 		return EEH_Template::display_template($template, $template_args, TRUE);
1481 1481
 	}
1482 1482
 
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1506 1506
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1507 1507
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1508
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1509
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1508
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1509
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1510 1510
 		EEH_Template::display_template($templatepath, $template_args);
1511 1511
 	}
1512 1512
 
@@ -1534,21 +1534,21 @@  discard block
 block discarded – undo
1534 1534
 		$EEME = $this->_event_model();
1535 1535
 
1536 1536
 		$offset = ($current_page - 1) * $per_page;
1537
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1537
+		$limit = $count ? NULL : $offset.','.$per_page;
1538 1538
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1539 1539
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1540 1540
 
1541 1541
 		if (isset($this->_req_data['month_range'])) {
1542 1542
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1543
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1543
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1545 1545
 		}
1546 1546
 
1547 1547
 		$where = array();
1548 1548
 
1549
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1549
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1550 1550
 		//determine what post_status our condition will have for the query.
1551
-		switch ( $status ) {
1551
+		switch ($status) {
1552 1552
 			case 'month' :
1553 1553
 			case 'today' :
1554 1554
 			case NULL :
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 				break;
1557 1557
 
1558 1558
 			case 'draft' :
1559
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1559
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1560 1560
 				break;
1561 1561
 
1562 1562
 			default :
@@ -1564,43 +1564,43 @@  discard block
 block discarded – undo
1564 1564
 		}
1565 1565
 
1566 1566
 		//categories?
1567
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1567
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1568 1568
 
1569
-		if ( !empty ( $category ) ) {
1569
+		if ( ! empty ($category)) {
1570 1570
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1571 1571
 			$where['Term_Taxonomy.term_id'] = $category;
1572 1572
 		}
1573 1573
 
1574 1574
 		//date where conditions
1575
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1575
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1576 1576
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1577
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1578
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1579
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1580
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1577
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1578
+			$start = $DateTime->format(implode(' ', $start_formats));
1579
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1580
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1581 1581
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1582
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1583
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1584
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1585
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1586
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1587
-			$now = date( 'Y-m-01' );
1588
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1582
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1583
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1584
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1585
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1586
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1587
+			$now = date('Y-m-01');
1588
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592 1592
 		}
1593 1593
 
1594 1594
 
1595
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1596
-			$where['EVT_wp_user'] =  get_current_user_id();
1595
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1596
+			$where['EVT_wp_user'] = get_current_user_id();
1597 1597
 		} else {
1598
-			if ( ! isset( $where['status'] ) ) {
1599
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1598
+			if ( ! isset($where['status'])) {
1599
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1600 1600
 					$where['OR'] = array(
1601
-						'status*restrict_private' => array( '!=', 'private' ),
1601
+						'status*restrict_private' => array('!=', 'private'),
1602 1602
 						'AND' => array(
1603
-							'status*inclusive' => array( '=', 'private' ),
1603
+							'status*inclusive' => array('=', 'private'),
1604 1604
 							'EVT_wp_user' => get_current_user_id()
1605 1605
 						)
1606 1606
 					);
@@ -1608,16 +1608,16 @@  discard block
 block discarded – undo
1608 1608
 			}
1609 1609
 		}
1610 1610
 
1611
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1612
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1611
+		if (isset($this->_req_data['EVT_wp_user'])) {
1612
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1613 1613
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617 1617
 
1618 1618
 		//search query handling
1619
-		if ( isset( $this->_req_data['s'] ) ) {
1620
-			$search_string = '%' . $this->_req_data['s'] . '%';
1619
+		if (isset($this->_req_data['s'])) {
1620
+			$search_string = '%'.$this->_req_data['s'].'%';
1621 1621
 			$where['OR'] = array(
1622 1622
 				'EVT_name' => array('LIKE', $search_string),
1623 1623
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1626,32 +1626,32 @@  discard block
 block discarded – undo
1626 1626
 		}
1627 1627
 
1628 1628
 
1629
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1630
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1629
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1630
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1631 1631
 
1632 1632
 
1633 1633
 		//let's first check if we have special requests coming in.
1634
-		if ( isset( $this->_req_data['active_status'] ) ) {
1635
-			switch ( $this->_req_data['active_status'] ) {
1634
+		if (isset($this->_req_data['active_status'])) {
1635
+			switch ($this->_req_data['active_status']) {
1636 1636
 				case 'upcoming' :
1637
-					return $EEME->get_upcoming_events( $query_params, $count );
1637
+					return $EEME->get_upcoming_events($query_params, $count);
1638 1638
 					break;
1639 1639
 
1640 1640
 				case 'expired' :
1641
-					return $EEME->get_expired_events( $query_params, $count );
1641
+					return $EEME->get_expired_events($query_params, $count);
1642 1642
 					break;
1643 1643
 
1644 1644
 				case 'active' :
1645
-					return $EEME->get_active_events( $query_params, $count );
1645
+					return $EEME->get_active_events($query_params, $count);
1646 1646
 					break;
1647 1647
 
1648 1648
 				case 'inactive' :
1649
-					return $EEME->get_inactive_events( $query_params, $count );
1649
+					return $EEME->get_inactive_events($query_params, $count);
1650 1650
 					break;
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1654
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1655 1655
 
1656 1656
 		return $events;
1657 1657
 	}
@@ -1660,23 +1660,23 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
 
1662 1662
 	//handling for WordPress CPT actions (trash, restore, delete)
1663
-	public function trash_cpt_item( $post_id ) {
1663
+	public function trash_cpt_item($post_id) {
1664 1664
 		$this->_req_data['EVT_ID'] = $post_id;
1665
-		$this->_trash_or_restore_event( 'trash', FALSE );
1665
+		$this->_trash_or_restore_event('trash', FALSE);
1666 1666
 	}
1667 1667
 
1668 1668
 
1669 1669
 
1670 1670
 
1671
-	public function restore_cpt_item( $post_id ) {
1671
+	public function restore_cpt_item($post_id) {
1672 1672
 		$this->_req_data['EVT_ID'] = $post_id;
1673
-		$this->_trash_or_restore_event( 'draft', FALSE );
1673
+		$this->_trash_or_restore_event('draft', FALSE);
1674 1674
 	}
1675 1675
 
1676 1676
 
1677
-	public function delete_cpt_item( $post_id ) {
1677
+	public function delete_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_delete_event( FALSE );
1679
+		$this->_delete_event(FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 	 * @param  string $event_status
1689 1689
 	 * @return void
1690 1690
 	 */
1691
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1691
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1692 1692
 		//determine the event id and set to array.
1693 1693
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1694 1694
 		// loop thru events
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 			// clean status
1697 1697
 			$event_status = sanitize_key($event_status);
1698 1698
 			// grab status
1699
-			if (!empty($event_status)) {
1699
+			if ( ! empty($event_status)) {
1700 1700
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1701 1701
 			} else {
1702 1702
 				$success = FALSE;
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		}
1711 1711
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1712 1712
 
1713
-		if ( $redirect_after )
1713
+		if ($redirect_after)
1714 1714
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1715 1715
 	}
1716 1716
 
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 		// clean status
1726 1726
 		$event_status = sanitize_key($event_status);
1727 1727
 		// grab status
1728
-		if (!empty($event_status)) {
1728
+		if ( ! empty($event_status)) {
1729 1729
 			$success = TRUE;
1730 1730
 			//determine the event id and set to array.
1731 1731
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1760,15 +1760,15 @@  discard block
 block discarded – undo
1760 1760
 	 * @param  string $event_status
1761 1761
 	 * @return bool
1762 1762
 	 */
1763
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1763
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1764 1764
 		// grab event id
1765
-		if (!$EVT_ID) {
1765
+		if ( ! $EVT_ID) {
1766 1766
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1767 1767
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1768 1768
 			return FALSE;
1769 1769
 		}
1770 1770
 
1771
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1771
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1772 1772
 
1773 1773
 		// clean status
1774 1774
 		$event_status = sanitize_key($event_status);
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
 				$hook = FALSE;
1795 1795
 		}
1796 1796
 		//use class to change status
1797
-		$this->_cpt_model_obj->set_status( $event_status );
1797
+		$this->_cpt_model_obj->set_status($event_status);
1798 1798
 		$success = $this->_cpt_model_obj->save();
1799 1799
 
1800 1800
 		if ($success === FALSE) {
@@ -1816,15 +1816,15 @@  discard block
 block discarded – undo
1816 1816
 	 * @access protected
1817 1817
 	 * @param bool $redirect_after
1818 1818
 	 */
1819
-	protected function _delete_event( $redirect_after = TRUE ) {
1819
+	protected function _delete_event($redirect_after = TRUE) {
1820 1820
 		//determine the event id and set to array.
1821 1821
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1822
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1822
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1823 1823
 
1824 1824
 
1825 1825
 		// loop thru events
1826 1826
 		if ($EVT_ID) {
1827
-			$success = $this->_permanently_delete_event( $EVT_ID );
1827
+			$success = $this->_permanently_delete_event($EVT_ID);
1828 1828
 			// get list of events with no prices
1829 1829
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1830 1830
 			// remove this event from the list of events with no prices
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 		}
1840 1840
 
1841
-		if ( $redirect_after )
1841
+		if ($redirect_after)
1842 1842
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1843 1843
 	}
1844 1844
 
@@ -1856,12 +1856,12 @@  discard block
 block discarded – undo
1856 1856
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1857 1857
 		// loop thru events
1858 1858
 		foreach ($EVT_IDs as $EVT_ID) {
1859
-			$EVT_ID = absint( $EVT_ID );
1860
-			if ( $EVT_ID ) {
1861
-				$results = $this->_permanently_delete_event( $EVT_ID );
1859
+			$EVT_ID = absint($EVT_ID);
1860
+			if ($EVT_ID) {
1861
+				$results = $this->_permanently_delete_event($EVT_ID);
1862 1862
 				$success = $results !== FALSE ? $success : FALSE;
1863 1863
 				// remove this event from the list of events with no prices
1864
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1864
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1865 1865
 			} else {
1866 1866
 				$success = FALSE;
1867 1867
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1881,9 +1881,9 @@  discard block
 block discarded – undo
1881 1881
 	 * @param  int $EVT_ID
1882 1882
 	 * @return bool
1883 1883
 	 */
1884
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1884
+	private function _permanently_delete_event($EVT_ID = 0) {
1885 1885
 		// grab event id
1886
-		if ( ! $EVT_ID ) {
1886
+		if ( ! $EVT_ID) {
1887 1887
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1888 1888
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1889 1889
 			return FALSE;
@@ -1892,19 +1892,19 @@  discard block
 block discarded – undo
1892 1892
 			! $this->_cpt_model_obj instanceof EE_Event
1893 1893
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1894 1894
 		) {
1895
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1895
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1896 1896
 		}
1897 1897
 
1898
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
1898
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
1899 1899
 			return false;
1900 1900
 		}
1901 1901
 
1902 1902
 		//need to delete related tickets and prices first.
1903 1903
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1904
-		foreach ( $datetimes as $datetime ) {
1904
+		foreach ($datetimes as $datetime) {
1905 1905
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1906 1906
 			$tickets = $datetime->get_many_related('Ticket');
1907
-			foreach ( $tickets as $ticket ) {
1907
+			foreach ($tickets as $ticket) {
1908 1908
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1909 1909
 				$ticket->delete_related_permanently('Price');
1910 1910
 				$ticket->delete_permanently();
@@ -1914,14 +1914,14 @@  discard block
 block discarded – undo
1914 1914
 
1915 1915
 		//what about related venues or terms?
1916 1916
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1917
-		foreach ( $venues as $venue ) {
1917
+		foreach ($venues as $venue) {
1918 1918
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1919 1919
 		}
1920 1920
 
1921 1921
 		//any attached question groups?
1922 1922
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1923
-		if ( !empty( $question_groups ) ) {
1924
-			foreach ( $question_groups as $question_group ) {
1923
+		if ( ! empty($question_groups)) {
1924
+			foreach ($question_groups as $question_group) {
1925 1925
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1926 1926
 			}
1927 1927
 		}
@@ -1930,12 +1930,12 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
 
1932 1932
 		//Message Template Groups
1933
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1933
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1934 1934
 
1935 1935
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1936 1936
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1937 1937
 
1938
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1938
+		foreach ($term_taxonomies as $term_taxonomy) {
1939 1939
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1940 1940
 		}
1941 1941
 
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1950 1950
 			return FALSE;
1951 1951
 		}
1952
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1952
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1953 1953
 		return TRUE;
1954 1954
 	}
1955 1955
 
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	public function total_events() {
1968 1968
 
1969
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1969
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1970 1970
 		return $count;
1971 1971
 	}
1972 1972
 
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 	 */
1982 1982
 	public function total_events_draft() {
1983 1983
 		$where = array(
1984
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1984
+			'status' => array('IN', array('draft', 'auto-draft'))
1985 1985
 			);
1986 1986
 
1987
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1987
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1988 1988
 		return $count;
1989 1989
 	}
1990 1990
 
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 			'status' => 'trash'
2004 2004
 			);
2005 2005
 
2006
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2006
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2007 2007
 		return $count;
2008 2008
 	}
2009 2009
 
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 			// translated
2032 2032
 			TRUE
2033 2033
 		);
2034
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2034
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2035 2035
 
2036 2036
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2037 2037
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2038
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2038
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2039 2039
 		$this->display_admin_page_with_sidebar();
2040 2040
 	}
2041 2041
 
@@ -2061,9 +2061,9 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
 	protected function _template_settings() {
2063 2063
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2064
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2065
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2066
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2064
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2065
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2066
+		$this->display_admin_caf_preview_page('template_settings_tab');
2067 2067
 	}
2068 2068
 
2069 2069
 
@@ -2076,22 +2076,22 @@  discard block
 block discarded – undo
2076 2076
 	 * @return void
2077 2077
 	 */
2078 2078
 	private function _set_category_object() {
2079
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2079
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2080 2080
 			return; //already have the category object so get out.
2081 2081
 
2082 2082
 		//set default category object
2083 2083
 		$this->_set_empty_category_object();
2084 2084
 
2085 2085
 		//only set if we've got an id
2086
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2086
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2087 2087
 			return;
2088 2088
 		}
2089 2089
 
2090 2090
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2091 2091
 
2092
-		$term = get_term( $category_id, 'espresso_event_categories' );
2092
+		$term = get_term($category_id, 'espresso_event_categories');
2093 2093
 
2094
-		if ( !empty( $term ) ) {
2094
+		if ( ! empty($term)) {
2095 2095
 			$this->_category->category_name = $term->name;
2096 2096
 			$this->_category->category_identifier = $term->slug;
2097 2097
 			$this->_category->category_desc = $term->description;
@@ -2105,13 +2105,13 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 	private function _set_empty_category_object() {
2107 2107
 		$this->_category = new stdClass();
2108
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2108
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2109 2109
 		$this->_category->id = $this->_category->parent = 0;
2110 2110
 	}
2111 2111
 
2112 2112
 
2113 2113
 	protected function _category_list_table() {
2114
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2114
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2115 2115
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2116 2116
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2117 2117
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,14 +2127,14 @@  discard block
 block discarded – undo
2127 2127
 		$this->_set_add_edit_form_tags($route);
2128 2128
 
2129 2129
 		$this->_set_category_object();
2130
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2130
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2131 2131
 
2132 2132
 		$delete_action = 'delete_category';
2133 2133
 
2134 2134
 		//custom redirect
2135
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2135
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2136 2136
 
2137
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2137
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2138 2138
 
2139 2139
 		//take care of contents
2140 2140
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2148,25 +2148,25 @@  discard block
 block discarded – undo
2148 2148
 			'type' => 'wp_editor',
2149 2149
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2150 2150
 			'class' => 'my_editor_custom',
2151
-			'wpeditor_args' => array('media_buttons' => FALSE )
2151
+			'wpeditor_args' => array('media_buttons' => FALSE)
2152 2152
 		);
2153
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2153
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2154 2154
 
2155
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2155
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2156 2156
 
2157 2157
 		//setup category select for term parents.
2158 2158
 		$category_select_values[] = array(
2159 2159
 			'text' => __('No Parent', 'event_espresso'),
2160 2160
 			'id' => 0
2161 2161
 			);
2162
-		foreach ( $all_terms as $term ) {
2162
+		foreach ($all_terms as $term) {
2163 2163
 			$category_select_values[] = array(
2164 2164
 				'text' => $term->name,
2165 2165
 				'id' => $term->term_id
2166 2166
 				);
2167 2167
 		}
2168 2168
 
2169
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2169
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2170 2170
 
2171 2171
 		$template_args = array(
2172 2172
 			'category' => $this->_category,
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
 			'disable' => '',
2177 2177
 			'disabled_message' => FALSE
2178 2178
 			);
2179
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2180
-		return EEH_Template::display_template($template, $template_args, TRUE );
2179
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2180
+		return EEH_Template::display_template($template, $template_args, TRUE);
2181 2181
 	}
2182 2182
 
2183 2183
 
2184 2184
 	protected function _delete_categories() {
2185
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2185
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2186 2186
 
2187
-		foreach ( $cat_ids as $cat_id ) {
2187
+		foreach ($cat_ids as $cat_id) {
2188 2188
 			$this->_delete_category($cat_id);
2189 2189
 		}
2190 2190
 
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$query_args = array(
2193 2193
 			'action' => 'category_list'
2194 2194
 			);
2195
-		$this->_redirect_after_action(0,'','',$query_args);
2195
+		$this->_redirect_after_action(0, '', '', $query_args);
2196 2196
 
2197 2197
 	}
2198 2198
 
@@ -2202,61 +2202,61 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 	protected function _delete_category($cat_id) {
2204 2204
 		global $wpdb;
2205
-		$cat_id = absint( $cat_id );
2206
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2205
+		$cat_id = absint($cat_id);
2206
+		wp_delete_term($cat_id, 'espresso_event_categories');
2207 2207
 	}
2208 2208
 
2209 2209
 
2210 2210
 
2211 2211
 	protected function _insert_or_update_category($new_category) {
2212 2212
 
2213
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2213
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2214 2214
 		$success = 0; //we already have a success message so lets not send another.
2215 2215
 
2216
-		if ( $cat_id ) {
2216
+		if ($cat_id) {
2217 2217
 			$query_args = array(
2218 2218
 				'action'     => 'edit_category',
2219 2219
 				'EVT_CAT_ID' => $cat_id
2220 2220
 			);
2221 2221
 		} else {
2222
-			$query_args = array( 'action' => 'add_category' );
2222
+			$query_args = array('action' => 'add_category');
2223 2223
 		}
2224
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2224
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2225 2225
 
2226 2226
 	}
2227 2227
 
2228 2228
 
2229 2229
 
2230
-	private function _insert_category( $update = FALSE ) {
2230
+	private function _insert_category($update = FALSE) {
2231 2231
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2232
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2233
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2234
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2232
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2233
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2234
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2235 2235
 
2236
-		if ( empty( $category_name ) ) {
2237
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2238
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2236
+		if (empty($category_name)) {
2237
+			$msg = __('You must add a name for the category.', 'event_espresso');
2238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239 2239
 			return false;
2240 2240
 		}
2241 2241
 
2242
-		$term_args=array(
2242
+		$term_args = array(
2243 2243
 			'name'=>$category_name,
2244 2244
 			'description'=>$category_desc,
2245 2245
 			'parent'=>$category_parent
2246 2246
 		);
2247 2247
 		//was the category_identifier input disabled?
2248
-		if(isset($this->_req_data['category_identifier'])){
2248
+		if (isset($this->_req_data['category_identifier'])) {
2249 2249
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2250 2250
 		}
2251
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2251
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2252 2252
 
2253
-		if ( !is_array( $insert_ids ) ) {
2254
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2255
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2253
+		if ( ! is_array($insert_ids)) {
2254
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2255
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 		} else {
2257 2257
 			$cat_id = $insert_ids['term_id'];
2258
-			$msg = sprintf ( __('The category %s was successfully saved', 'event_espresso'), $category_name );
2259
-			EE_Error::add_success( $msg );
2258
+			$msg = sprintf(__('The category %s was successfully saved', 'event_espresso'), $category_name);
2259
+			EE_Error::add_success($msg);
2260 2260
 		}
2261 2261
 
2262 2262
 		return $cat_id;
@@ -2265,32 +2265,32 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
 
2267 2267
 
2268
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2268
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2269 2269
 		global $wpdb;
2270 2270
 
2271 2271
 		//testing term stuff
2272
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2274
-		$limit = ($current_page-1)*$per_page;
2272
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2274
+		$limit = ($current_page - 1) * $per_page;
2275 2275
 
2276
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2276
+		$where = array('taxonomy' => 'espresso_event_categories');
2277 2277
 
2278
-		if ( isset( $this->_req_data['s'] ) ) {
2279
-			$sstr = '%' . $this->_req_data['s'] . '%';
2278
+		if (isset($this->_req_data['s'])) {
2279
+			$sstr = '%'.$this->_req_data['s'].'%';
2280 2280
 			$where['OR'] = array(
2281
-				'Term.name' => array( 'LIKE', $sstr),
2282
-				'description' => array( 'LIKE', $sstr )
2281
+				'Term.name' => array('LIKE', $sstr),
2282
+				'description' => array('LIKE', $sstr)
2283 2283
 				);
2284 2284
 		}
2285 2285
 
2286 2286
 		$query_params = array(
2287
-			$where ,
2288
-			'order_by' => array( $orderby => $order ),
2289
-			'limit' => $limit . ',' . $per_page,
2287
+			$where,
2288
+			'order_by' => array($orderby => $order),
2289
+			'limit' => $limit.','.$per_page,
2290 2290
 			'force_join' => array('Term')
2291 2291
 			);
2292 2292
 
2293
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2293
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2294 2294
 
2295 2295
 		return $categories;
2296 2296
 	}
Please login to merge, or discard this patch.
widgets/upcoming_events/EEW_Upcoming_Events.widget.php 2 patches
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	function __construct() {
31 31
 		parent::__construct(
32 32
 			'ee-upcoming-events-widget',
33
-			__( 'Event Espresso Upcoming Events', 'event_espresso' ),
34
-			 array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )),
33
+			__('Event Espresso Upcoming Events', 'event_espresso'),
34
+			 array('description' => __('A widget to display your upcoming events.', 'event_espresso')),
35 35
 			array(
36 36
 				'width' => 300,
37 37
 				'height' => 350,
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param array $instance Previously saved values from database.
50 50
 	 * @return string|void
51 51
 	 */
52
-	public function form( $instance ) {
52
+	public function form($instance) {
53 53
 
54
-		EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE );
54
+		EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
55 55
 		// Set up some default widget settings.
56 56
 		$defaults = array(
57 57
 			'title' => __('Upcoming Events', 'event_espresso'),
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 			'image_size' => 'medium'
67 67
 		);
68 68
 
69
-		$instance = wp_parse_args( (array) $instance, $defaults );
69
+		$instance = wp_parse_args((array) $instance, $defaults);
70 70
 		// don't add HTML labels for EE_Form_Fields generated inputs
71
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' );
71
+		add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
72 72
 		$yes_no_values = array(
73
-			EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))),
74
-			EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso')))
73
+			EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))),
74
+			EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso')))
75 75
 		);
76 76
 
77 77
 	?>
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			<label for="<?php echo $this->get_field_id('title'); ?>">
83 83
 				<?php _e('Title:', 'event_espresso'); ?>
84 84
 			</label>
85
-			<input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" />
85
+			<input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" />
86 86
 		</p>
87 87
 		<p>
88 88
 			<label for="<?php echo $this->get_field_id('category_name'); ?>">
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 			<?php
92 92
 			$event_categories = array();
93 93
 			/** @type EEM_Term $EEM_Term */
94
-			$EEM_Term = EE_Registry::instance()->load_model( 'Term' );
95
-			$categories = $EEM_Term->get_all_ee_categories( TRUE );
96
-			if ( $categories ) {
97
-				foreach ( $categories as $category ) {
98
-					if ( $category instanceof EE_Term ) {
99
-						$event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' )));
94
+			$EEM_Term = EE_Registry::instance()->load_model('Term');
95
+			$categories = $EEM_Term->get_all_ee_categories(TRUE);
96
+			if ($categories) {
97
+				foreach ($categories as $category) {
98
+					if ($category instanceof EE_Term) {
99
+						$event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name')));
100 100
 					}
101 101
 				}
102 102
 			}
103
-			array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
103
+			array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
104 104
 			echo EEH_Form_Fields::select(
105 105
 				 __('Event Category:', 'event_espresso'),
106 106
 				$instance['category_name'],
@@ -137,16 +137,16 @@  discard block
 block discarded – undo
137 137
 			<?php
138 138
 			$image_sizes = array();
139 139
 			$sizes = get_intermediate_image_sizes();
140
-			if ( $sizes ) {
140
+			if ($sizes) {
141 141
 				// loop thru images and create option objects out of them
142
-				foreach ( $sizes as $image_size ) {
143
-					$image_size = trim( $image_size );
142
+				foreach ($sizes as $image_size) {
143
+					$image_size = trim($image_size);
144 144
 					// no big images plz
145
-					if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) {
146
-						$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size ));
145
+					if ( ! in_array($image_size, array('large', 'post-thumbnail'))) {
146
+						$image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size));
147 147
 					}
148 148
 				}
149
-				$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' =>  __('don\'t show images', 'event_espresso') ));
149
+				$image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' =>  __('don\'t show images', 'event_espresso')));
150 150
 			}
151 151
 			echo EEH_Form_Fields::select(
152 152
 				 __('Image Size:', 'event_espresso'),
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			<label for="<?php echo $this->get_field_id('date_limit'); ?>">
205 205
 				<?php _e('Number of Dates to Display:', 'event_espresso'); ?>
206 206
 			</label>
207
-			<input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" />
207
+			<input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" />
208 208
 		</p>
209 209
 		<p>
210 210
 			<label for="<?php echo $this->get_field_id('date_range'); ?>">
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return array Updated safe values to be saved.
238 238
 	 */
239
-	public function update( $new_instance, $old_instance ) {
239
+	public function update($new_instance, $old_instance) {
240 240
 		$instance = $old_instance;
241
-		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
241
+		$instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : '';
242 242
 		$instance['category_name'] = $new_instance['category_name'];
243 243
 		$instance['show_expired'] = $new_instance['show_expired'];
244 244
 		$instance['limit'] = $new_instance['limit'];
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 	 * @param array $args     Widget arguments.
262 262
 	 * @param array $instance Saved values from database.
263 263
 	 */
264
-	public function widget( $args, $instance ) {
264
+	public function widget($args, $instance) {
265 265
 
266 266
 		global $post;
267 267
 		// make sure there is some kinda post object
268
-		if ( $post instanceof WP_Post ) {
268
+		if ($post instanceof WP_Post) {
269 269
 			$before_widget = '';
270 270
 			$before_title = '';
271 271
 			$after_title = '';
272 272
 			$after_widget = '';
273 273
 			// but NOT an events archives page, cuz that would be like two event lists on the same page
274
-			$show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE;
275
-			if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) {
274
+			$show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE;
275
+			if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) {
276 276
 				// let's use some of the event helper functions'
277 277
 				// make separate vars out of attributes
278 278
 
@@ -291,81 +291,81 @@  discard block
 block discarded – undo
291 291
 				// Before widget (defined by themes).
292 292
 				echo $before_widget;
293 293
 				// Display the widget title if one was input (before and after defined by themes).
294
-				if ( ! empty( $title )) {
295
-					echo $before_title . $title . $after_title;
294
+				if ( ! empty($title)) {
295
+					echo $before_title.$title.$after_title;
296 296
 				}
297 297
 				// grab widget settings
298
-				$category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE;
299
-				$show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE;
300
-				$image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium';
301
-				$show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE;
302
-				$show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE;
303
-				$date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL;
304
-				$date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE;
298
+				$category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE;
299
+				$show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE;
300
+				$image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium';
301
+				$show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE;
302
+				$show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE;
303
+				$date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL;
304
+				$date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE;
305 305
 				// start to build our where clause
306 306
 				$where = array(
307 307
 //					'Datetime.DTT_is_primary' => 1,
308 308
 					'status' => 'publish'
309 309
 				);
310 310
 				// add category
311
-				if ( $category ) {
311
+				if ($category) {
312 312
 					$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
313 313
 					$where['Term_Taxonomy.Term.slug'] = $category;
314 314
 				}
315 315
 				// if NOT expired then we want events that start today or in the future
316
-				if ( ! $show_expired ) {
317
-					$where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
316
+				if ( ! $show_expired) {
317
+					$where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
318 318
 				}
319 319
 				// run the query
320
-				$events = EE_Registry::instance()->load_model( 'Event' )->get_all( array(
320
+				$events = EE_Registry::instance()->load_model('Event')->get_all(array(
321 321
 					$where,
322
-					'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10',
322
+					'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10',
323 323
 					'order_by' => 'Datetime.DTT_EVT_start',
324 324
 					'order' => 'ASC',
325 325
 					'group_by' => 'EVT_ID'
326 326
 				));
327 327
 
328
-				if ( ! empty( $events )) {
328
+				if ( ! empty($events)) {
329 329
 					echo '<ul class="ee-upcoming-events-widget-ul">';
330
-					foreach ( $events as $event ) {
331
-						if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) {
330
+					foreach ($events as $event) {
331
+						if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) {
332 332
 							//printr( $event, '$event  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
333
-							echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">';
333
+							echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">';
334 334
 							// how big is the event name ?
335
-							$name_length = strlen( $event->name() );
336
-							switch( $name_length ) {
335
+							$name_length = strlen($event->name());
336
+							switch ($name_length) {
337 337
 								case $name_length > 70 :
338
-									$len_class =  ' three-line';
338
+									$len_class = ' three-line';
339 339
 									break;
340 340
 								case $name_length > 35 :
341
-									$len_class =  ' two-line';
341
+									$len_class = ' two-line';
342 342
 									break;
343 343
 								default :
344
-									$len_class =  ' one-line';
344
+									$len_class = ' one-line';
345 345
 							}
346
-							$event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event );
347
-							echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>';
348
-							if ( post_password_required( $event->ID() ) ) {
349
-								$pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event );
346
+							$event_url = apply_filters('FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event);
347
+							echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.$event_url.'">'.$event->name().'</a></h5>';
348
+							if (post_password_required($event->ID())) {
349
+								$pswd_form = apply_filters('FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form($event->ID()), $event);
350 350
 								echo $pswd_form;
351 351
 							} else {
352
-								if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) {
353
-									echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>';
352
+								if (has_post_thumbnail($event->ID()) && $image_size != 'none') {
353
+									echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.$event_url.'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>';
354 354
 								}
355
-								$desc = $event->short_description( 25 );
356
-								if ( $show_dates ) {
357
-									$date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' ));
358
-									$time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' ));
359
-									$single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' ));
360
-									$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' ));
361
-									if ( $date_range == TRUE ) {
362
-										echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() );
363
-									}else{
364
-										echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit );
355
+								$desc = $event->short_description(25);
356
+								if ($show_dates) {
357
+									$date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format'));
358
+									$time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format'));
359
+									$single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format'));
360
+									$single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format'));
361
+									if ($date_range == TRUE) {
362
+										echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID());
363
+									} else {
364
+										echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit);
365 365
 									}
366 366
 								}
367
-								if ( $show_desc && $desc ) {
368
-									echo '<p style="margin-top: .5em">' . $desc . '</p>';
367
+								if ($show_desc && $desc) {
368
+									echo '<p style="margin-top: .5em">'.$desc.'</p>';
369 369
 								}
370 370
 							}
371 371
 							echo '</li>';
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @return string
390 390
 	 */
391 391
 	public function make_the_title_a_link($title) {
392
-	    return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
392
+	    return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>';
393 393
 	}
394 394
 
395 395
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -360,7 +362,7 @@  discard block
 block discarded – undo
360 362
 									$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' ));
361 363
 									if ( $date_range == TRUE ) {
362 364
 										echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() );
363
-									}else{
365
+									} else{
364 366
 										echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit );
365 367
 									}
366 368
 								}
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EE_PMT_Paypal_Pro.pm.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Paypal_Pro extends EE_PMT_Base{
28
+class EE_PMT_Paypal_Pro extends EE_PMT_Base {
29 29
 
30 30
 	/**
31 31
 	 * @param EE_Payment_Method $pm_instance
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		require_once($this->file_folder().'EEG_Paypal_Pro.gateway.php');
36 36
 		$this->_gateway = new EEG_Paypal_Pro();
37 37
 		$this->_pretty_name = __("Paypal Pro", 'event_espresso');
38
-		$this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' );
38
+		$this->_default_description = __('Please provide the following billing information.', 'event_espresso');
39 39
 		$this->_requires_https = true;
40 40
 		parent::__construct($pm_instance);
41 41
 	}
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 			'extra_meta_inputs'=>array(
52 52
 //				'paypal_email'=>new EE_Email_Input(), not actually used
53 53
 				'username'=>new EE_Text_Input(array(
54
-					'html_label_text'=>  sprintf(__("Paypal API Username %s", "event_espresso"),$this->get_help_tab_link()),
54
+					'html_label_text'=>  sprintf(__("Paypal API Username %s", "event_espresso"), $this->get_help_tab_link()),
55 55
 					'required' => true
56 56
 				)),
57 57
 				'password'=>new EE_Text_Input(array(
58
-					'html_label_text'=>  sprintf(__("Paypal API Password %s", "event_espresso"),$this->get_help_tab_link()),
58
+					'html_label_text'=>  sprintf(__("Paypal API Password %s", "event_espresso"), $this->get_help_tab_link()),
59 59
 					'required' => true
60 60
 				)),
61 61
 				'signature'=>new EE_Text_Input(array(
62
-					'html_label_text'=>  sprintf(__("Paypal API Signature %s", "event_espresso"),$this->get_help_tab_link()),
62
+					'html_label_text'=>  sprintf(__("Paypal API Signature %s", "event_espresso"), $this->get_help_tab_link()),
63 63
 					'required' => true
64 64
 				)),
65 65
 				'credit_card_types'=>new EE_Checkbox_Multi_Input(
66 66
 						$this->card_types_supported(),
67 67
 						array(
68
-							'html_label_text' => __( 'Card Types Supported', 'event_espresso' ),
68
+							'html_label_text' => __('Card Types Supported', 'event_espresso'),
69 69
 							'required' => true )),
70 70
 				)
71 71
 			)
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	 * @throws \EE_Error
80 80
 	 * @return EE_Billing_Info_Form
81 81
 	 */
82
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
83
-		$allowed_types = $this->_pm_instance->get_extra_meta( 'credit_card_types', TRUE );
82
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
83
+		$allowed_types = $this->_pm_instance->get_extra_meta('credit_card_types', TRUE);
84 84
 		//if allowed types is a string or empty array or null...
85
-		if( empty( $allowed_types )) {
85
+		if (empty($allowed_types)) {
86 86
 			$allowed_types = array();
87 87
 		}
88 88
 
@@ -93,26 +93,26 @@  discard block
 block discarded – undo
93 93
 //				'html_id'=> 'ee-Paypal_Pro-billing-form',
94 94
 				'subsections'=>array(
95 95
 					'credit_card'=>new EE_Credit_Card_Input(
96
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Number', 'event_espresso' ))
96
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Number', 'event_espresso'))
97 97
 					),
98 98
 					'credit_card_type'=>new EE_Select_Input(
99 99
 						//the options are set dynamically
100
-						array_intersect_key( EE_PMT_Paypal_Pro::card_types_supported(), array_flip( $allowed_types )),
101
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Type', 'event_espresso' ))
100
+						array_intersect_key(EE_PMT_Paypal_Pro::card_types_supported(), array_flip($allowed_types)),
101
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Type', 'event_espresso'))
102 102
 					),
103 103
 					'exp_month'=>new EE_Credit_Card_Month_Input(
104
-						TRUE, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' =>  __( 'Expiry Month', 'event_espresso' )  )
104
+						TRUE, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' =>  __('Expiry Month', 'event_espresso'))
105 105
 					),
106 106
 					'exp_year'=>new EE_Credit_Card_Year_Input(
107
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Year', 'event_espresso' )  )
107
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Year', 'event_espresso'))
108 108
 					),
109 109
 					'cvv'=>new EE_CVV_Input(
110
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'CVV', 'event_espresso' ) )
110
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('CVV', 'event_espresso'))
111 111
 					),
112 112
 				)
113 113
 			)
114 114
 		);
115
-		return $this->apply_billing_form_debug_settings( $billing_form );
115
+		return $this->apply_billing_form_debug_settings($billing_form);
116 116
 	}
117 117
 
118 118
 
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 	 * @param \EE_Billing_Info_Form $billing_form
125 125
 	 * @return \EE_Billing_Info_Form
126 126
 	 */
127
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
128
-		if ( $this->_pm_instance->debug_mode() ) {
127
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
128
+		if ($this->_pm_instance->debug_mode()) {
129 129
 			$billing_form->add_subsections(
130
-				array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ),
130
+				array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()),
131 131
 				'credit_card'
132 132
 			);
133 133
 			$billing_form->add_subsections(
134
-				array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php' )),
134
+				array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php')),
135 135
 				'first_name'
136 136
 			);
137
-			$billing_form->get_input( 'credit_card_type' )->set_default( 'Visa' );
138
-			$billing_form->get_input( 'exp_year' )->set_default( 2018);
139
-			$billing_form->get_input( 'cvv' )->set_default( '115' );
137
+			$billing_form->get_input('credit_card_type')->set_default('Visa');
138
+			$billing_form->get_input('exp_year')->set_default(2018);
139
+			$billing_form->get_input('cvv')->set_default('115');
140 140
 		}
141 141
 		return $billing_form;
142 142
 	}
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * Keys are their values, values are their pretty names.
149 149
 	 * @return array
150 150
 	 */
151
-	public static function card_types_supported(){
151
+	public static function card_types_supported() {
152 152
 		return array(
153 153
 			'Visa'=>  __("Visa", 'event_espresso'),
154 154
 			'MasterCard'=>  __("MasterCard", 'event_espresso'),
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * @see EE_PMT_Base::help_tabs_config()
165 165
 	 * @return array
166 166
 	 */
167
-	public function help_tabs_config(){
167
+	public function help_tabs_config() {
168 168
 		return array(
169 169
 			$this->get_help_tab_name() => array(
170 170
 						'title' => __('PayPal Pro Settings', 'event_espresso'),
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * @param EE_Billing_Info_Form $billing_form
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _get_billing_values_from_form( $billing_form ){
183
-		$billing_values = parent::_get_billing_values_from_form( $billing_form );
184
-		$billing_values[ 'country' ] = $billing_form->get_input_value( 'country' );
185
-		$billing_values[ 'credit_card_type' ] = $billing_form->get_input_value( 'credit_card_type' );
182
+	protected function _get_billing_values_from_form($billing_form) {
183
+		$billing_values = parent::_get_billing_values_from_form($billing_form);
184
+		$billing_values['country'] = $billing_form->get_input_value('country');
185
+		$billing_values['credit_card_type'] = $billing_form->get_input_value('credit_card_type');
186 186
 		return $billing_values;
187 187
 	}
188 188
 
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 3 patches
Doc Comments   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 
146 146
 	/**
147
-	 * @return null
147
+	 * @return EE_Line_Item_Display
148 148
 	 */
149 149
 	public function line_item_display() {
150 150
 		return $this->line_item_display;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 
155 155
 	/**
156
-	 * @param null $line_item_display
156
+	 * @param EE_Line_Item_Display $line_item_display
157 157
 	 */
158 158
 	public function set_line_item_display( $line_item_display ) {
159 159
 		$this->line_item_display = $line_item_display;
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 	 *    _apply_registration_payments_to_amount_owing
840 840
 	 *
841 841
 	 * @access protected
842
-	 * @param array $registrations
842
+	 * @param EE_Base_Class[] $registrations
843 843
 	 */
844 844
 	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
845 845
 		$payments = array();
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	 * get_billing_form_html_for_payment_method
1113 1113
 	 *
1114 1114
 	 * @access public
1115
-	 * @return string
1115
+	 * @return boolean
1116 1116
 	 * @throws \EE_Error
1117 1117
 	 */
1118 1118
 	public function get_billing_form_html_for_payment_method() {
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 	 *
1177 1177
 	 * @access private
1178 1178
 	 * @param EE_Payment_Method $payment_method
1179
-	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1179
+	 * @return EE_Billing_Info_Form
1180 1180
 	 * @throws \EE_Error
1181 1181
 	 */
1182 1182
 	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 	 * switch_payment_method
1281 1281
 	 *
1282 1282
 	 * @access public
1283
-	 * @return string
1283
+	 * @return boolean
1284 1284
 	 * @throws \EE_Error
1285 1285
 	 */
1286 1286
 	public function switch_payment_method() {
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 	/**
1488 1488
 	 * process_reg_step
1489 1489
 	 *
1490
-	 * @return boolean
1490
+	 * @return null|boolean
1491 1491
 	 * @throws \EE_Error
1492 1492
 	 */
1493 1493
 	public function process_reg_step() {
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 	 *    update_reg_step
1614 1614
 	 *    this is the final step after a user  revisits the site to retry a payment
1615 1615
 	 *
1616
-	 * @return boolean
1616
+	 * @return null|boolean
1617 1617
 	 * @throws \EE_Error
1618 1618
 	 */
1619 1619
 	public function update_reg_step() {
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
 	 *
1982 1982
 	 * @access    private
1983 1983
 	 * @type    EE_Payment_Method $payment_method
1984
-	 * @return    mixed    EE_Payment | boolean
1984
+	 * @return    EE_Payment|null    EE_Payment | boolean
1985 1985
 	 * @throws \EE_Error
1986 1986
 	 */
1987 1987
 	private function _attempt_payment( EE_Payment_Method $payment_method ) {
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 	 * _post_payment_processing
2113 2113
 	 *
2114 2114
 	 * @access private
2115
-	 * @param EE_Payment|bool $payment
2115
+	 * @param EE_Payment $payment
2116 2116
 	 * @return bool
2117 2117
 	 * @throws \EE_Error
2118 2118
 	 */
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
 	 *        or present the payment options again
2302 2302
 	 *
2303 2303
 	 * @access private
2304
-	 * @return EE_Payment | FALSE
2304
+	 * @return boolean | FALSE
2305 2305
 	 * @throws \EE_Error
2306 2306
 	 */
2307 2307
 	public function process_gateway_response() {
@@ -2434,8 +2434,8 @@  discard block
 block discarded – undo
2434 2434
 	 * _redirect_wayward_request
2435 2435
 	 *
2436 2436
 	 * @access private
2437
-	 * @param \EE_Registration|null $primary_registrant
2438
-	 * @return bool
2437
+	 * @param EE_Registration $primary_registrant
2438
+	 * @return false|null
2439 2439
 	 * @throws \EE_Error
2440 2440
 	 */
2441 2441
 	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -467,38 +467,38 @@  discard block
 block discarded – undo
467 467
 	 * @throws \EE_Error
468 468
 	 */
469 469
 	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
470
-        // registrations per event
470
+		// registrations per event
471 471
 		$event_reg_count = array();
472 472
 		// spaces left per event
473 473
 		$event_spaces_remaining = array();
474
-        // tickets left sorted by ID
475
-        $tickets_remaining = array();
476
-        // registrations that have lost their space
474
+		// tickets left sorted by ID
475
+		$tickets_remaining = array();
476
+		// registrations that have lost their space
477 477
 		$ejected_registrations = array();
478 478
 		foreach ( $registrations as $REG_ID => $registration ) {
479 479
 			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
480 480
 				continue;
481 481
 			}
482 482
 			$EVT_ID = $registration->event_ID();
483
-            $ticket = $registration->ticket();
484
-            if ( ! isset($tickets_remaining[$ticket->ID()])) {
485
-                $tickets_remaining[$ticket->ID()] = $ticket->remaining();
486
-            }
487
-            if ($tickets_remaining[$ticket->ID()] > 0) {
488
-                if ( ! isset($event_reg_count[$EVT_ID])) {
489
-                    $event_reg_count[$EVT_ID] = 0;
490
-                }
491
-                $event_reg_count[$EVT_ID]++;
492
-                if ( ! isset($event_spaces_remaining[$EVT_ID])) {
493
-                    $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
494
-                }
495
-            }
483
+			$ticket = $registration->ticket();
484
+			if ( ! isset($tickets_remaining[$ticket->ID()])) {
485
+				$tickets_remaining[$ticket->ID()] = $ticket->remaining();
486
+			}
487
+			if ($tickets_remaining[$ticket->ID()] > 0) {
488
+				if ( ! isset($event_reg_count[$EVT_ID])) {
489
+					$event_reg_count[$EVT_ID] = 0;
490
+				}
491
+				$event_reg_count[$EVT_ID]++;
492
+				if ( ! isset($event_spaces_remaining[$EVT_ID])) {
493
+					$event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
494
+				}
495
+			}
496 496
 			if (
497 497
 				$revisit
498 498
 				&& (
499
-                    $tickets_remaining[$ticket->ID()] === 0
500
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
501
-                )
499
+					$tickets_remaining[$ticket->ID()] === 0
500
+					|| $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
501
+				)
502 502
 			) {
503 503
 				$ejected_registrations[ $REG_ID ] = $registration->event();
504 504
 				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
 				'layout_strategy' => new EE_Template_Layout(
574 574
 					array(
575 575
 						'layout_template_file' => SPCO_REG_STEPS_PATH
576
-						                          . $this->_slug
577
-						                          . DS
578
-						                          . 'sold_out_events.template.php',
576
+												  . $this->_slug
577
+												  . DS
578
+												  . 'sold_out_events.template.php',
579 579
 						'template_args'        => apply_filters(
580 580
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
581 581
 							array(
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 				'layout_strategy' => new EE_Template_Layout(
627 627
 					array(
628 628
 						'layout_template_file' => SPCO_REG_STEPS_PATH
629
-						                          . $this->_slug
630
-						                          . DS
631
-						                          . 'sold_out_events.template.php',
629
+												  . $this->_slug
630
+												  . DS
631
+												  . 'sold_out_events.template.php',
632 632
 						'template_args'        => apply_filters(
633 633
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args',
634 634
 							array(
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
 				'layout_strategy' => new EE_Template_Layout(
681 681
 					array(
682 682
 						'layout_template_file' => SPCO_REG_STEPS_PATH
683
-						                          . $this->_slug
684
-						                          . DS
685
-						                          . 'events_requiring_pre_approval.template.php', // layout_template
683
+												  . $this->_slug
684
+												  . DS
685
+												  . 'events_requiring_pre_approval.template.php', // layout_template
686 686
 						'template_args'        => apply_filters(
687 687
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
688 688
 							array(
@@ -724,9 +724,9 @@  discard block
 block discarded – undo
724 724
 				'layout_strategy' => new EE_Template_Layout(
725 725
 					array(
726 726
 						'layout_template_file' => SPCO_REG_STEPS_PATH
727
-						                          . $this->_slug
728
-						                          . DS
729
-						                          . 'no_payment_required.template.php', // layout_template
727
+												  . $this->_slug
728
+												  . DS
729
+												  . 'no_payment_required.template.php', // layout_template
730 730
 						'template_args'        => apply_filters(
731 731
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
732 732
 							array(
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
957 957
 				}
958 958
 				$payment_methods_billing_info[ $payment_method->slug()
959
-				                               . '-info' ] = $this->_payment_method_billing_info(
959
+											   . '-info' ] = $this->_payment_method_billing_info(
960 960
 					$payment_method
961 961
 				);
962 962
 			}
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 		// fill form with attendee info if applicable
1145 1145
 		if (
1146 1146
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
1147
-		    && $this->checkout->transaction_has_primary_registrant()
1147
+			&& $this->checkout->transaction_has_primary_registrant()
1148 1148
 		) {
1149 1149
 			$payment_method_billing_form->populate_from_attendee(
1150 1150
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 		// and debug content
1154 1154
 		if (
1155 1155
 			$payment_method_billing_form instanceof EE_Billing_Info_Form
1156
-		    && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1156
+			&& $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1157 1157
 		) {
1158 1158
 			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1159 1159
 				$payment_method_billing_form
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		}
1313 1313
 		// fill form with attendee info if applicable
1314 1314
 		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1315
-		     && $this->checkout->transaction_has_primary_registrant()
1315
+			 && $this->checkout->transaction_has_primary_registrant()
1316 1316
 		) {
1317 1317
 			$this->checkout->billing_form->populate_from_attendee(
1318 1318
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 		}
1321 1321
 		// and debug content
1322 1322
 		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1323
-		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1323
+			 && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1324 1324
 		) {
1325 1325
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1326 1326
 				$this->checkout->billing_form
@@ -1454,8 +1454,8 @@  discard block
 block discarded – undo
1454 1454
 		}
1455 1455
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1456 1456
 		if ( ! empty( $attendee_data['ATT_fname'] )
1457
-		     && ! empty( $attendee_data['ATT_lname'] )
1458
-		     && ! empty( $attendee_data['ATT_email'] )
1457
+			 && ! empty( $attendee_data['ATT_lname'] )
1458
+			 && ! empty( $attendee_data['ATT_email'] )
1459 1459
 		) {
1460 1460
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1461 1461
 				array(
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 			$payment_status = $payment->status();
1698 1698
 			if (
1699 1699
 				$payment_status === EEM_Payment::status_id_approved
1700
-			    || $payment_status === EEM_Payment::status_id_pending
1700
+				|| $payment_status === EEM_Payment::status_id_pending
1701 1701
 			) {
1702 1702
 				return true;
1703 1703
 			} else {
@@ -1885,8 +1885,8 @@  discard block
 block discarded – undo
1885 1885
 			return false;
1886 1886
 		}
1887 1887
 		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1888
-		       instanceof
1889
-		       EE_Attendee
1888
+			   instanceof
1889
+			   EE_Attendee
1890 1890
 		) {
1891 1891
 			EE_Error::add_error(
1892 1892
 				sprintf(
Please login to merge, or discard this patch.
Spacing   +354 added lines, -354 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -38,32 +38,32 @@  discard block
 block discarded – undo
38 38
 	public static function set_hooks() {
39 39
 		add_filter(
40 40
 			'FHEE__SPCO__EE_Line_Item_Filter_Collection',
41
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' )
41
+			array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')
42 42
 		);
43 43
 		add_action(
44 44
 			'wp_ajax_switch_spco_billing_form',
45
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
45
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
46 46
 		);
47 47
 		add_action(
48 48
 			'wp_ajax_nopriv_switch_spco_billing_form',
49
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
49
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
50 50
 		);
51
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) );
51
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
52 52
 		add_action(
53 53
 			'wp_ajax_nopriv_save_payer_details',
54
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )
54
+			array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')
55 55
 		);
56 56
 		add_action(
57 57
 			'wp_ajax_get_transaction_details_for_gateways',
58
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
58
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
59 59
 		);
60 60
 		add_action(
61 61
 			'wp_ajax_nopriv_get_transaction_details_for_gateways',
62
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
62
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
63 63
 		);
64 64
 		add_filter(
65 65
 			'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
66
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ),
66
+			array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'),
67 67
 			10,
68 68
 			1
69 69
 		);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @throws \EE_Error
78 78
 	 */
79 79
 	public static function switch_spco_billing_form() {
80
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
80
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
81 81
 	}
82 82
 
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @throws \EE_Error
89 89
 	 */
90 90
 	public static function save_payer_details() {
91
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
91
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
92 92
 	}
93 93
 
94 94
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @throws \EE_Error
100 100
 	 */
101 101
 	public static function get_transaction_details() {
102
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
102
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
103 103
 	}
104 104
 
105 105
 
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	 * @param    EE_Checkout $checkout
128 128
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
129 129
 	 */
130
-	public function __construct( EE_Checkout $checkout ) {
130
+	public function __construct(EE_Checkout $checkout) {
131 131
 		$this->_slug = 'payment_options';
132
-		$this->_name = __( 'Payment Options', 'event_espresso' );
133
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
132
+		$this->_name = __('Payment Options', 'event_espresso');
133
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
134 134
 		$this->checkout = $checkout;
135 135
 		$this->_reset_success_message();
136 136
 		$this->set_instructions(
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	/**
156 156
 	 * @param null $line_item_display
157 157
 	 */
158
-	public function set_line_item_display( $line_item_display ) {
158
+	public function set_line_item_display($line_item_display) {
159 159
 		$this->line_item_display = $line_item_display;
160 160
 	}
161 161
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	/**
174 174
 	 * @param boolean $handle_IPN_in_this_request
175 175
 	 */
176
-	public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) {
177
-		$this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN );
176
+	public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) {
177
+		$this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN);
178 178
 	}
179 179
 
180 180
 
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	public function enqueue_styles_and_scripts() {
210 210
 		$transaction = $this->checkout->transaction;
211 211
 		//if the transaction isn't set or nothing is owed on it, don't enqueue any JS
212
-		if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) {
212
+		if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) {
213 213
 			return;
214 214
 		}
215
-		foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) {
215
+		foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) {
216 216
 			$type_obj = $payment_method->type_obj();
217
-			if( $type_obj instanceof EE_PMT_Base ) {
218
-				$billing_form = $type_obj->generate_new_billing_form( $transaction );
219
-				if( $billing_form instanceof EE_Form_Section_Proper ) {
217
+			if ($type_obj instanceof EE_PMT_Base) {
218
+				$billing_form = $type_obj->generate_new_billing_form($transaction);
219
+				if ($billing_form instanceof EE_Form_Section_Proper) {
220 220
 					$billing_form->enqueue_js();
221 221
 				}
222 222
 			}
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 			// 	$ 0.00 transactions (no payment required)
242 242
 			! $this->checkout->payment_required()
243 243
 			// but do NOT remove if current action being called belongs to this reg step
244
-			&& ! is_callable( array( $this, $this->checkout->action ) )
244
+			&& ! is_callable(array($this, $this->checkout->action))
245 245
 			&& ! $this->completed()
246 246
 		) {
247 247
 			// and if so, then we no longer need the Payment Options step
248
-			if ( $this->is_current_step() ) {
248
+			if ($this->is_current_step()) {
249 249
 				$this->checkout->generate_reg_form = false;
250 250
 			}
251
-			$this->checkout->remove_reg_step( $this->_slug );
251
+			$this->checkout->remove_reg_step($this->_slug);
252 252
 			// DEBUG LOG
253 253
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
254 254
 			return false;
255 255
 		}
256 256
 		// load EEM_Payment_Method
257
-		EE_Registry::instance()->load_model( 'Payment_Method' );
257
+		EE_Registry::instance()->load_model('Payment_Method');
258 258
 		// get all active payment methods
259 259
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
260 260
 			$this->checkout->transaction,
@@ -281,15 +281,15 @@  discard block
 block discarded – undo
281 281
 		$insufficient_spaces_available = array();
282 282
 		$reg_count = 0;
283 283
 		// loop thru registrations to gather info
284
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
284
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
285 285
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
286 286
 			$registrations,
287 287
 			$this->checkout->revisit
288 288
 		);
289
-		foreach ( $registrations as $REG_ID => $registration ) {
289
+		foreach ($registrations as $REG_ID => $registration) {
290 290
 			// has this registration lost it's space ?
291
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
292
-				$insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event();
291
+			if (isset($ejected_registrations[$REG_ID])) {
292
+				$insufficient_spaces_available[$registration->event()->ID()] = $registration->event();
293 293
 				continue;
294 294
 			}
295 295
 			/** @var $registration EE_Registration */
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 				&& $registration->status_ID() === EEM_Registration::status_id_approved
302 302
 			)
303 303
 			) {
304
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) {
304
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
305 305
 					// add event to list of events that are sold out
306
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
306
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
307 307
 					do_action(
308 308
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
309 309
 						$registration->event(),
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
 					continue;
313 313
 				}
314 314
 				// event requires admin approval
315
-				if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) {
315
+				if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
316 316
 					// add event to list of events with pre-approval reg status
317
-					$registrations_requiring_pre_approval[ $REG_ID ] = $registration;
317
+					$registrations_requiring_pre_approval[$REG_ID] = $registration;
318 318
 					do_action(
319 319
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
320 320
 						$registration->event(),
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 				}
324 324
 			}
325 325
 			// are they allowed to pay now and is there monies owing?
326
-			if ( $registration->owes_monies_and_can_pay() ) {
327
-				$registrations_requiring_payment[ $REG_ID ] = $registration;
326
+			if ($registration->owes_monies_and_can_pay()) {
327
+				$registrations_requiring_payment[$REG_ID] = $registration;
328 328
 				do_action(
329 329
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
330 330
 					$registration->event(),
@@ -335,29 +335,29 @@  discard block
 block discarded – undo
335 335
 				&& $registration->status_ID() !== EEM_Registration::status_id_not_approved
336 336
 				&& $registration->ticket()->is_free()
337 337
 			) {
338
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
338
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
339 339
 			}
340 340
 		}
341 341
 		$subsections = array();
342 342
 		// now decide which template to load
343
-		if ( ! empty( $sold_out_events ) ) {
344
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
343
+		if ( ! empty($sold_out_events)) {
344
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
345 345
 		}
346
-		if ( ! empty( $insufficient_spaces_available ) ) {
346
+		if ( ! empty($insufficient_spaces_available)) {
347 347
 			$subsections['insufficient_space'] = $this->_insufficient_spaces_available(
348 348
 				$insufficient_spaces_available
349 349
 			);
350 350
 		}
351
-		if ( ! empty( $registrations_requiring_pre_approval ) ) {
351
+		if ( ! empty($registrations_requiring_pre_approval)) {
352 352
 			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval(
353 353
 				$registrations_requiring_pre_approval
354 354
 			);
355 355
 		}
356
-		if ( ! empty( $registrations_for_free_events ) ) {
357
-			$subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events );
356
+		if ( ! empty($registrations_for_free_events)) {
357
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
358 358
 		}
359
-		if ( ! empty( $registrations_requiring_payment ) ) {
360
-			if ( $this->checkout->amount_owing > 0 ) {
359
+		if ( ! empty($registrations_requiring_payment)) {
360
+			if ($this->checkout->amount_owing > 0) {
361 361
 				// autoload Line_Item_Display classes
362 362
 				EEH_Autoloader::register_line_item_filter_autoloaders();
363 363
 				$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 				/** @var EE_Line_Item $filtered_line_item_tree */
371 371
 				$filtered_line_item_tree = $line_item_filter_processor->process();
372 372
 				EEH_Autoloader::register_line_item_display_autoloaders();
373
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
373
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
374 374
 				$subsections['payment_options'] = $this->_display_payment_options(
375 375
 					$this->line_item_display->display_line_item(
376 376
 						$filtered_line_item_tree,
377
-						array( 'registrations' => $registrations )
377
+						array('registrations' => $registrations)
378 378
 					)
379 379
 				);
380 380
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
381
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
381
+				$this->_apply_registration_payments_to_amount_owing($registrations);
382 382
 			}
383 383
 		} else {
384 384
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @return \EE_Line_Item_Filter_Collection
410 410
 	 * @throws \EE_Error
411 411
 	 */
412
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
412
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
413 413
 		$line_item_filter_collection->add(
414 414
 			new EE_Billable_Line_Item_Filter(
415 415
 				EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations(
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 				)
420 420
 			)
421 421
 		);
422
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
422
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
423 423
 		return $line_item_filter_collection;
424 424
 	}
425 425
 
@@ -435,15 +435,15 @@  discard block
 block discarded – undo
435 435
 	 * @return \EE_Registration[]
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public static function remove_ejected_registrations( array $registrations ) {
438
+	public static function remove_ejected_registrations(array $registrations) {
439 439
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
440 440
 			$registrations,
441 441
 			EE_Registry::instance()->SSN->checkout()->revisit
442 442
 		);
443
-		foreach ( $registrations as $REG_ID => $registration ) {
443
+		foreach ($registrations as $REG_ID => $registration) {
444 444
 			// has this registration lost it's space ?
445
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
446
-				unset( $registrations[ $REG_ID ] );
445
+			if (isset($ejected_registrations[$REG_ID])) {
446
+				unset($registrations[$REG_ID]);
447 447
 				continue;
448 448
 			}
449 449
 		}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 * @return array
467 467
 	 * @throws \EE_Error
468 468
 	 */
469
-	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
469
+	public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) {
470 470
         // registrations per event
471 471
 		$event_reg_count = array();
472 472
 		// spaces left per event
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
         $tickets_remaining = array();
476 476
         // registrations that have lost their space
477 477
 		$ejected_registrations = array();
478
-		foreach ( $registrations as $REG_ID => $registration ) {
479
-			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
478
+		foreach ($registrations as $REG_ID => $registration) {
479
+			if ($registration->status_ID() === EEM_Registration::status_id_approved) {
480 480
 				continue;
481 481
 			}
482 482
 			$EVT_ID = $registration->event_ID();
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 				$revisit
498 498
 				&& (
499 499
                     $tickets_remaining[$ticket->ID()] === 0
500
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
500
+				    || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID]
501 501
                 )
502 502
 			) {
503
-				$ejected_registrations[ $REG_ID ] = $registration->event();
504
-				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
503
+				$ejected_registrations[$REG_ID] = $registration->event();
504
+				if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) {
505 505
 					/** @type EE_Registration_Processor $registration_processor */
506
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
506
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
507 507
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
508 508
 					$registration_processor->manually_update_registration_status(
509 509
 						$registration,
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 	 * @return void
539 539
 	 */
540 540
 	protected function _hide_reg_step_submit_button_if_revisit() {
541
-		if ( $this->checkout->revisit ) {
542
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
541
+		if ($this->checkout->revisit) {
542
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
543 543
 		}
544 544
 	}
545 545
 
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	 * @return \EE_Form_Section_Proper
554 554
 	 * @throws \EE_Error
555 555
 	 */
556
-	private function _sold_out_events( $sold_out_events_array = array() ) {
556
+	private function _sold_out_events($sold_out_events_array = array()) {
557 557
 		// set some defaults
558 558
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
559 559
 		$sold_out_events = '';
560
-		foreach ( $sold_out_events_array as $sold_out_event ) {
560
+		foreach ($sold_out_events_array as $sold_out_event) {
561 561
 			$sold_out_events .= EEH_HTML::li(
562
-				EEH_HTML::span( '  ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
562
+				EEH_HTML::span('  '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
563 563
 			);
564 564
 		}
565 565
 		return new EE_Form_Section_Proper(
@@ -606,14 +606,14 @@  discard block
 block discarded – undo
606 606
 	 * @return \EE_Form_Section_Proper
607 607
 	 * @throws \EE_Error
608 608
 	 */
609
-	private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) {
609
+	private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) {
610 610
 		// set some defaults
611 611
 		$this->checkout->selected_method_of_payment = 'invoice';
612 612
 		$insufficient_space_events = '';
613
-		foreach ( $insufficient_spaces_events_array as $event ) {
614
-			if ( $event instanceof EE_Event ) {
613
+		foreach ($insufficient_spaces_events_array as $event) {
614
+			if ($event instanceof EE_Event) {
615 615
 				$insufficient_space_events .= EEH_HTML::li(
616
-					EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
616
+					EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
617 617
 				);
618 618
 			}
619 619
 		}
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
 	 * @return \EE_Form_Section_Proper
658 658
 	 * @throws \EE_Error
659 659
 	 */
660
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) {
660
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
661 661
 		$events_requiring_pre_approval = '';
662
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
663
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
664
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
662
+		foreach ($registrations_requiring_pre_approval as $registration) {
663
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
664
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
665 665
 					EEH_HTML::span(
666 666
 						'',
667 667
 						'',
668 668
 						'dashicons dashicons-marker ee-icon-size-16 orange-text'
669 669
 					)
670
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
670
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
671 671
 				);
672 672
 			}
673 673
 		}
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 						'template_args'        => apply_filters(
687 687
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
688 688
 							array(
689
-								'events_requiring_pre_approval'     => implode( '', $events_requiring_pre_approval ),
689
+								'events_requiring_pre_approval'     => implode('', $events_requiring_pre_approval),
690 690
 								'events_requiring_pre_approval_msg' => apply_filters(
691 691
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
692 692
 									__(
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	 * @return \EE_Form_Section_Proper
712 712
 	 * @throws \EE_Error
713 713
 	 */
714
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
714
+	private function _no_payment_required($registrations_for_free_events = array()) {
715 715
 		// set some defaults
716 716
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
717 717
 		// generate no_payment_required form
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 								'ticket_count'                  => array(),
736 736
 								'registrations_for_free_events' => $registrations_for_free_events,
737 737
 								'no_payment_required_msg'       => EEH_HTML::p(
738
-									__( 'This is a free event, so no billing will occur.', 'event_espresso' )
738
+									__('This is a free event, so no billing will occur.', 'event_espresso')
739 739
 								)
740 740
 							)
741 741
 						),
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 * @return \EE_Form_Section_Proper
755 755
 	 * @throws \EE_Error
756 756
 	 */
757
-	private function _display_payment_options( $transaction_details = '' ) {
757
+	private function _display_payment_options($transaction_details = '') {
758 758
 		// has method_of_payment been set by no-js user?
759 759
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
760 760
 		// build payment options form
@@ -766,18 +766,18 @@  discard block
 block discarded – undo
766 766
 						'before_payment_options' => apply_filters(
767 767
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
768 768
 							new EE_Form_Section_Proper(
769
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
769
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
770 770
 							)
771 771
 						),
772 772
 						'payment_options'        => $this->_setup_payment_options(),
773 773
 						'after_payment_options'  => apply_filters(
774 774
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
775 775
 							new EE_Form_Section_Proper(
776
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
776
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
777 777
 							)
778 778
 						),
779 779
 						'default_hidden_inputs'  => $this->reg_step_hidden_inputs(),
780
-						'extra_hidden_inputs'    => $this->_extra_hidden_inputs( false )
780
+						'extra_hidden_inputs'    => $this->_extra_hidden_inputs(false)
781 781
 					),
782 782
 					'layout_strategy' => new EE_Template_Layout(
783 783
 						array(
@@ -806,10 +806,10 @@  discard block
 block discarded – undo
806 806
 	 * @return \EE_Form_Section_Proper
807 807
 	 * @throws \EE_Error
808 808
 	 */
809
-	private function _extra_hidden_inputs( $no_payment_required = true ) {
809
+	private function _extra_hidden_inputs($no_payment_required = true) {
810 810
 		return new EE_Form_Section_Proper(
811 811
 			array(
812
-				'html_id'         => 'ee-' . $this->slug() . '-extra-hidden-inputs',
812
+				'html_id'         => 'ee-'.$this->slug().'-extra-hidden-inputs',
813 813
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
814 814
 				'subsections'     => array(
815 815
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -841,16 +841,16 @@  discard block
 block discarded – undo
841 841
 	 * @access protected
842 842
 	 * @param array $registrations
843 843
 	 */
844
-	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
844
+	protected function _apply_registration_payments_to_amount_owing(array $registrations) {
845 845
 		$payments = array();
846
-		foreach ( $registrations as $registration ) {
847
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
846
+		foreach ($registrations as $registration) {
847
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
848 848
 				$payments += $registration->registration_payments();
849 849
 			}
850 850
 		}
851
-		if ( ! empty( $payments ) ) {
852
-			foreach ( $payments as $payment ) {
853
-				if ( $payment instanceof EE_Registration_Payment ) {
851
+		if ( ! empty($payments)) {
852
+			foreach ($payments as $payment) {
853
+				if ($payment instanceof EE_Registration_Payment) {
854 854
 					$this->checkout->amount_owing -= $payment->amount();
855 855
 				}
856 856
 			}
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
 	 * @param    bool $force_reset
867 867
 	 * @return    void
868 868
 	 */
869
-	private function _reset_selected_method_of_payment( $force_reset = false ) {
869
+	private function _reset_selected_method_of_payment($force_reset = false) {
870 870
 		$reset_payment_method = $force_reset
871 871
 			? true
872
-			: sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) );
873
-		if ( $reset_payment_method ) {
872
+			: sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false));
873
+		if ($reset_payment_method) {
874 874
 			$this->checkout->selected_method_of_payment = null;
875 875
 			$this->checkout->payment_method = null;
876 876
 			$this->checkout->billing_form = null;
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
 	 * @param string $selected_method_of_payment
890 890
 	 * @return        EE_Billing_Info_Form
891 891
 	 */
892
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
893
-		$selected_method_of_payment = ! empty( $selected_method_of_payment )
892
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
893
+		$selected_method_of_payment = ! empty($selected_method_of_payment)
894 894
 			? $selected_method_of_payment
895 895
 			: $this->checkout->selected_method_of_payment;
896 896
 		EE_Registry::instance()->SSN->set_session_data(
897
-			array( 'selected_method_of_payment' => $selected_method_of_payment )
897
+			array('selected_method_of_payment' => $selected_method_of_payment)
898 898
 		);
899 899
 	}
900 900
 
@@ -910,19 +910,19 @@  discard block
 block discarded – undo
910 910
 		// load payment method classes
911 911
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
912 912
 		// switch up header depending on number of available payment methods
913
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
913
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
914 914
 			? apply_filters(
915 915
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
916
-				__( 'Please Select Your Method of Payment', 'event_espresso' )
916
+				__('Please Select Your Method of Payment', 'event_espresso')
917 917
 			)
918 918
 			: apply_filters(
919 919
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
920
-				__( 'Method of Payment', 'event_espresso' )
920
+				__('Method of Payment', 'event_espresso')
921 921
 			);
922 922
 		$available_payment_methods = array(
923 923
 			// display the "Payment Method" header
924 924
 			'payment_method_header' => new EE_Form_Section_HTML(
925
-				EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' )
925
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
926 926
 			)
927 927
 		);
928 928
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
@@ -931,32 +931,32 @@  discard block
 block discarded – undo
931 931
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
932 932
 		$payment_methods_billing_info = array(
933 933
 			new EE_Form_Section_HTML(
934
-				EEH_HTML::div( '<br />', '', '', 'clear:both;' )
934
+				EEH_HTML::div('<br />', '', '', 'clear:both;')
935 935
 			)
936 936
 		);
937 937
 		// loop through payment methods
938
-		foreach ( $this->checkout->available_payment_methods as $payment_method ) {
939
-			if ( $payment_method instanceof EE_Payment_Method ) {
938
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
939
+			if ($payment_method instanceof EE_Payment_Method) {
940 940
 				$payment_method_button = EEH_HTML::img(
941 941
 					$payment_method->button_url(),
942 942
 					$payment_method->name(),
943
-					'spco-payment-method-' . $payment_method->slug() . '-btn-img',
943
+					'spco-payment-method-'.$payment_method->slug().'-btn-img',
944 944
 					'spco-payment-method-btn-img'
945 945
 				);
946 946
 				// check if any payment methods are set as default
947 947
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
948 948
 				if (
949
-					( $this->checkout->selected_method_of_payment === $payment_method->slug() )
950
-					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )
949
+					($this->checkout->selected_method_of_payment === $payment_method->slug())
950
+					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())
951 951
 				) {
952 952
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
953 953
 					$this->_save_selected_method_of_payment();
954
-					$default_payment_method_option[ $payment_method->slug() ] = $payment_method_button;
954
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
955 955
 				} else {
956
-					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
956
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
957 957
 				}
958
-				$payment_methods_billing_info[ $payment_method->slug()
959
-				                               . '-info' ] = $this->_payment_method_billing_info(
958
+				$payment_methods_billing_info[$payment_method->slug()
959
+				                               . '-info'] = $this->_payment_method_billing_info(
960 960
 					$payment_method
961 961
 				);
962 962
 			}
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
 	 * @return EE_Payment_Method[]
987 987
 	 */
988 988
 	protected function _get_available_payment_methods() {
989
-		if ( ! empty( $this->checkout->available_payment_methods ) ) {
989
+		if ( ! empty($this->checkout->available_payment_methods)) {
990 990
 			return $this->checkout->available_payment_methods;
991 991
 		}
992 992
 		$available_payment_methods = array();
993 993
 		// load EEM_Payment_Method
994
-		EE_Registry::instance()->load_model( 'Payment_Method' );
994
+		EE_Registry::instance()->load_model('Payment_Method');
995 995
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
996 996
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
997 997
 		// get all active payment methods
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
 			$this->checkout->transaction,
1000 1000
 			EEM_Payment_Method::scope_cart
1001 1001
 		);
1002
-		foreach ( $payment_methods as $payment_method ) {
1003
-			if ( $payment_method instanceof EE_Payment_Method ) {
1004
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
1002
+		foreach ($payment_methods as $payment_method) {
1003
+			if ($payment_method instanceof EE_Payment_Method) {
1004
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
1005 1005
 			}
1006 1006
 		}
1007 1007
 		return $available_payment_methods;
@@ -1016,14 +1016,14 @@  discard block
 block discarded – undo
1016 1016
 	 * @param    array $available_payment_method_options
1017 1017
 	 * @return    \EE_Form_Section_Proper
1018 1018
 	 */
1019
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
1019
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
1020 1020
 		// generate inputs
1021 1021
 		return new EE_Form_Section_Proper(
1022 1022
 			array(
1023 1023
 				'html_id'         => 'ee-available-payment-method-inputs',
1024 1024
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1025 1025
 				'subsections'     => array(
1026
-					'' => new EE_Radio_Button_Input (
1026
+					'' => new EE_Radio_Button_Input(
1027 1027
 						$available_payment_method_options,
1028 1028
 						array(
1029 1029
 							'html_name'          => 'selected_method_of_payment',
@@ -1048,28 +1048,28 @@  discard block
 block discarded – undo
1048 1048
 	 * @return    \EE_Form_Section_Proper
1049 1049
 	 * @throws \EE_Error
1050 1050
 	 */
1051
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
1051
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
1052 1052
 		$currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug()
1053 1053
 			? true
1054 1054
 			: false;
1055 1055
 		// generate the billing form for payment method
1056 1056
 		$billing_form = $currently_selected
1057
-			? $this->_get_billing_form_for_payment_method( $payment_method )
1057
+			? $this->_get_billing_form_for_payment_method($payment_method)
1058 1058
 			: new EE_Form_Section_HTML();
1059 1059
 		$this->checkout->billing_form = $currently_selected
1060 1060
 			? $billing_form
1061 1061
 			: $this->checkout->billing_form;
1062 1062
 		// it's all in the details
1063 1063
 		$info_html = EEH_HTML::h3(
1064
-			__( 'Important information regarding your payment', 'event_espresso' ),
1064
+			__('Important information regarding your payment', 'event_espresso'),
1065 1065
 			'',
1066 1066
 			'spco-payment-method-hdr'
1067 1067
 		);
1068 1068
 		// add some info regarding the step, either from what's saved in the admin,
1069 1069
 		// or a default string depending on whether the PM has a billing form or not
1070
-		if ( $payment_method->description() ) {
1070
+		if ($payment_method->description()) {
1071 1071
 			$payment_method_info = $payment_method->description();
1072
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
1072
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
1073 1073
 			$payment_method_info = sprintf(
1074 1074
 				__(
1075 1075
 					'Please provide the following billing information, then click the "%1$s" button below in order to proceed.',
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 			);
1080 1080
 		} else {
1081 1081
 			$payment_method_info = sprintf(
1082
-				__( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ),
1082
+				__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'),
1083 1083
 				$this->submit_button_text()
1084 1084
 			);
1085 1085
 		}
@@ -1093,13 +1093,13 @@  discard block
 block discarded – undo
1093 1093
 		);
1094 1094
 		return new EE_Form_Section_Proper(
1095 1095
 			array(
1096
-				'html_id'         => 'spco-payment-method-info-' . $payment_method->slug(),
1096
+				'html_id'         => 'spco-payment-method-info-'.$payment_method->slug(),
1097 1097
 				'html_class'      => 'spco-payment-method-info-dv',
1098 1098
 				// only display the selected or default PM
1099 1099
 				'html_style'      => $currently_selected ? '' : 'display:none;',
1100 1100
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1101 1101
 				'subsections'     => array(
1102
-					'info'         => new EE_Form_Section_HTML( $info_html ),
1102
+					'info'         => new EE_Form_Section_HTML($info_html),
1103 1103
 					'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML()
1104 1104
 				)
1105 1105
 			)
@@ -1117,15 +1117,15 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	public function get_billing_form_html_for_payment_method() {
1119 1119
 		// how have they chosen to pay?
1120
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1120
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1121 1121
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1122
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1122
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1123 1123
 			return false;
1124 1124
 		}
1125
-		if ( apply_filters(
1125
+		if (apply_filters(
1126 1126
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1127 1127
 			false
1128
-		) ) {
1128
+		)) {
1129 1129
 			EE_Error::add_success(
1130 1130
 				apply_filters(
1131 1131
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 			);
1141 1141
 		}
1142 1142
 		// now generate billing form for selected method of payment
1143
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1143
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1144 1144
 		// fill form with attendee info if applicable
1145 1145
 		if (
1146 1146
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
@@ -1162,10 +1162,10 @@  discard block
 block discarded – undo
1162 1162
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper
1163 1163
 			? $payment_method_billing_form->get_html()
1164 1164
 			: '';
1165
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) );
1165
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
1166 1166
 		// localize validation rules for main form
1167 1167
 		$this->checkout->current_step->reg_form->localize_validation_rules();
1168
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1168
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1169 1169
 		return true;
1170 1170
 	}
1171 1171
 
@@ -1179,18 +1179,18 @@  discard block
 block discarded – undo
1179 1179
 	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1180 1180
 	 * @throws \EE_Error
1181 1181
 	 */
1182
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
1182
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
1183 1183
 		$billing_form = $payment_method->type_obj()->billing_form(
1184 1184
 			$this->checkout->transaction,
1185
-			array( 'amount_owing' => $this->checkout->amount_owing )
1185
+			array('amount_owing' => $this->checkout->amount_owing)
1186 1186
 		);
1187
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
1187
+		if ($billing_form instanceof EE_Billing_Info_Form) {
1188 1188
 			if (
1189 1189
 				apply_filters(
1190 1190
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1191 1191
 					false
1192 1192
 				)
1193
-				&& EE_Registry::instance()->REQ->is_set( 'payment_method' )
1193
+				&& EE_Registry::instance()->REQ->is_set('payment_method')
1194 1194
 			) {
1195 1195
 				EE_Error::add_success(
1196 1196
 					apply_filters(
@@ -1232,15 +1232,15 @@  discard block
 block discarded – undo
1232 1232
 		$request_param = 'selected_method_of_payment'
1233 1233
 	) {
1234 1234
 		// is selected_method_of_payment set in the request ?
1235
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false );
1236
-		if ( $selected_method_of_payment ) {
1235
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false);
1236
+		if ($selected_method_of_payment) {
1237 1237
 			// sanitize it
1238
-			$selected_method_of_payment = is_array( $selected_method_of_payment )
1239
-				? array_shift( $selected_method_of_payment )
1238
+			$selected_method_of_payment = is_array($selected_method_of_payment)
1239
+				? array_shift($selected_method_of_payment)
1240 1240
 				: $selected_method_of_payment;
1241
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
1241
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
1242 1242
 			// store it in the session so that it's available for all subsequent requests including AJAX
1243
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
1243
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
1244 1244
 		} else {
1245 1245
 			// or is is set in the session ?
1246 1246
 			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data(
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 			);
1249 1249
 		}
1250 1250
 		// do ya really really gotta have it?
1251
-		if ( empty( $selected_method_of_payment ) && $required ) {
1251
+		if (empty($selected_method_of_payment) && $required) {
1252 1252
 			EE_Error::add_error(
1253 1253
 				sprintf(
1254 1254
 					__(
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 					),
1258 1258
 					'<br/>',
1259 1259
 					'<br/>',
1260
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1260
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1261 1261
 				),
1262 1262
 				__FILE__,
1263 1263
 				__FUNCTION__,
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
 	 * @throws \EE_Error
1285 1285
 	 */
1286 1286
 	public function switch_payment_method() {
1287
-		if ( ! $this->_verify_payment_method_is_set() ) {
1287
+		if ( ! $this->_verify_payment_method_is_set()) {
1288 1288
 			return false;
1289 1289
 		}
1290
-		if ( apply_filters(
1290
+		if (apply_filters(
1291 1291
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1292 1292
 			false
1293
-		) ) {
1293
+		)) {
1294 1294
 			EE_Error::add_success(
1295 1295
 				apply_filters(
1296 1296
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1305,13 +1305,13 @@  discard block
 block discarded – undo
1305 1305
 			);
1306 1306
 		}
1307 1307
 		// generate billing form for selected method of payment if it hasn't been done already
1308
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1308
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1309 1309
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1310 1310
 				$this->checkout->payment_method
1311 1311
 			);
1312 1312
 		}
1313 1313
 		// fill form with attendee info if applicable
1314
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1314
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1315 1315
 		     && $this->checkout->transaction_has_primary_registrant()
1316 1316
 		) {
1317 1317
 			$this->checkout->billing_form->populate_from_attendee(
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 			);
1320 1320
 		}
1321 1321
 		// and debug content
1322
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1322
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form
1323 1323
 		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1324 1324
 		) {
1325 1325
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
@@ -1327,15 +1327,15 @@  discard block
 block discarded – undo
1327 1327
 			);
1328 1328
 		}
1329 1329
 		// get html and validation rules for form
1330
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
1330
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
1331 1331
 			$this->checkout->json_response->set_return_data(
1332
-				array( 'payment_method_info' => $this->checkout->billing_form->get_html() )
1332
+				array('payment_method_info' => $this->checkout->billing_form->get_html())
1333 1333
 			);
1334 1334
 			// localize validation rules for main form
1335
-			$this->checkout->billing_form->localize_validation_rules( true );
1336
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1335
+			$this->checkout->billing_form->localize_validation_rules(true);
1336
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1337 1337
 		} else {
1338
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) );
1338
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
1339 1339
 		}
1340 1340
 		//prevents advancement to next step
1341 1341
 		$this->checkout->continue_reg = false;
@@ -1352,12 +1352,12 @@  discard block
 block discarded – undo
1352 1352
 	 */
1353 1353
 	protected function _verify_payment_method_is_set() {
1354 1354
 		// generate billing form for selected method of payment if it hasn't been done already
1355
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1355
+		if (empty($this->checkout->selected_method_of_payment)) {
1356 1356
 			// how have they chosen to pay?
1357
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1357
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1358 1358
 		}
1359 1359
 		// verify payment method
1360
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1360
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1361 1361
 			// get payment method for selected method of payment
1362 1362
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1363 1363
 		}
@@ -1376,25 +1376,25 @@  discard block
 block discarded – undo
1376 1376
 	 * @throws \EE_Error
1377 1377
 	 */
1378 1378
 	public function save_payer_details_via_ajax() {
1379
-		if ( ! $this->_verify_payment_method_is_set() ) {
1379
+		if ( ! $this->_verify_payment_method_is_set()) {
1380 1380
 			return;
1381 1381
 		}
1382 1382
 		// generate billing form for selected method of payment if it hasn't been done already
1383
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1383
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1384 1384
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1385 1385
 				$this->checkout->payment_method
1386 1386
 			);
1387 1387
 		}
1388 1388
 		// generate primary attendee from payer info if applicable
1389
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1389
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1390 1390
 			$attendee = $this->_create_attendee_from_request_data();
1391
-			if ( $attendee instanceof EE_Attendee ) {
1392
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1393
-					if ( $registration->is_primary_registrant() ) {
1391
+			if ($attendee instanceof EE_Attendee) {
1392
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1393
+					if ($registration->is_primary_registrant()) {
1394 1394
 						$this->checkout->primary_attendee_obj = $attendee;
1395
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1396
-						$registration->set_attendee_id( $attendee->ID() );
1397
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1395
+						$registration->_add_relation_to($attendee, 'Attendee');
1396
+						$registration->set_attendee_id($attendee->ID());
1397
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1398 1398
 					}
1399 1399
 				}
1400 1400
 			}
@@ -1412,50 +1412,50 @@  discard block
 block discarded – undo
1412 1412
 	 */
1413 1413
 	protected function _create_attendee_from_request_data() {
1414 1414
 		// get State ID
1415
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1416
-		if ( ! empty( $STA_ID ) ) {
1415
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1416
+		if ( ! empty($STA_ID)) {
1417 1417
 			// can we get state object from name ?
1418
-			EE_Registry::instance()->load_model( 'State' );
1419
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' );
1420
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1418
+			EE_Registry::instance()->load_model('State');
1419
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1420
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1421 1421
 		}
1422 1422
 		// get Country ISO
1423
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1424
-		if ( ! empty( $CNT_ISO ) ) {
1423
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1424
+		if ( ! empty($CNT_ISO)) {
1425 1425
 			// can we get country object from name ?
1426
-			EE_Registry::instance()->load_model( 'Country' );
1426
+			EE_Registry::instance()->load_model('Country');
1427 1427
 			$country = EEM_Country::instance()->get_col(
1428
-				array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ),
1428
+				array(array('CNT_name' => $CNT_ISO), 'limit' => 1),
1429 1429
 				'CNT_ISO'
1430 1430
 			);
1431
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1431
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1432 1432
 		}
1433 1433
 		// grab attendee data
1434 1434
 		$attendee_data = array(
1435
-			'ATT_fname'    => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1436
-			'ATT_lname'    => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1437
-			'ATT_email'    => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1438
-			'ATT_address'  => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1439
-			'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1440
-			'ATT_city'     => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1435
+			'ATT_fname'    => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1436
+			'ATT_lname'    => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1437
+			'ATT_email'    => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1438
+			'ATT_address'  => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1439
+			'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1440
+			'ATT_city'     => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1441 1441
 			'STA_ID'       => $STA_ID,
1442 1442
 			'CNT_ISO'      => $CNT_ISO,
1443
-			'ATT_zip'      => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1444
-			'ATT_phone'    => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1443
+			'ATT_zip'      => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1444
+			'ATT_phone'    => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1445 1445
 		);
1446 1446
 		// validate the email address since it is the most important piece of info
1447
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) {
1447
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) {
1448 1448
 			EE_Error::add_error(
1449
-				__( 'An invalid email address was submitted.', 'event_espresso' ),
1449
+				__('An invalid email address was submitted.', 'event_espresso'),
1450 1450
 				__FILE__,
1451 1451
 				__FUNCTION__,
1452 1452
 				__LINE__
1453 1453
 			);
1454 1454
 		}
1455 1455
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1456
-		if ( ! empty( $attendee_data['ATT_fname'] )
1457
-		     && ! empty( $attendee_data['ATT_lname'] )
1458
-		     && ! empty( $attendee_data['ATT_email'] )
1456
+		if ( ! empty($attendee_data['ATT_fname'])
1457
+		     && ! empty($attendee_data['ATT_lname'])
1458
+		     && ! empty($attendee_data['ATT_email'])
1459 1459
 		) {
1460 1460
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1461 1461
 				array(
@@ -1464,19 +1464,19 @@  discard block
 block discarded – undo
1464 1464
 					'ATT_email' => $attendee_data['ATT_email']
1465 1465
 				)
1466 1466
 			);
1467
-			if ( $existing_attendee instanceof EE_Attendee ) {
1467
+			if ($existing_attendee instanceof EE_Attendee) {
1468 1468
 				return $existing_attendee;
1469 1469
 			}
1470 1470
 		}
1471 1471
 		// no existing attendee? kk let's create a new one
1472 1472
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1473
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] )
1473
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname'])
1474 1474
 			? $attendee_data['ATT_fname']
1475 1475
 			: $attendee_data['ATT_email'];
1476
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] )
1476
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname'])
1477 1477
 			? $attendee_data['ATT_lname']
1478 1478
 			: $attendee_data['ATT_email'];
1479
-		return EE_Attendee::new_instance( $attendee_data );
1479
+		return EE_Attendee::new_instance($attendee_data);
1480 1480
 	}
1481 1481
 
1482 1482
 
@@ -1494,26 +1494,26 @@  discard block
 block discarded – undo
1494 1494
 		// how have they chosen to pay?
1495 1495
 		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free()
1496 1496
 			? 'no_payment_required'
1497
-			: $this->_get_selected_method_of_payment( true );
1497
+			: $this->_get_selected_method_of_payment(true);
1498 1498
 		// choose your own adventure based on method_of_payment
1499
-		switch ( $this->checkout->selected_method_of_payment ) {
1499
+		switch ($this->checkout->selected_method_of_payment) {
1500 1500
 
1501 1501
 			case 'events_sold_out' :
1502 1502
 				$this->checkout->redirect = true;
1503 1503
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1504
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1504
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1505 1505
 				// mark this reg step as completed
1506 1506
 				$this->set_completed();
1507 1507
 				return false;
1508 1508
 				break;
1509 1509
 
1510 1510
 			case 'payments_closed' :
1511
-				if ( apply_filters(
1511
+				if (apply_filters(
1512 1512
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success',
1513 1513
 					false
1514
-				) ) {
1514
+				)) {
1515 1515
 					EE_Error::add_success(
1516
-						__( 'no payment required at this time.', 'event_espresso' ),
1516
+						__('no payment required at this time.', 'event_espresso'),
1517 1517
 						__FILE__,
1518 1518
 						__FUNCTION__,
1519 1519
 						__LINE__
@@ -1525,12 +1525,12 @@  discard block
 block discarded – undo
1525 1525
 				break;
1526 1526
 
1527 1527
 			case 'no_payment_required' :
1528
-				if ( apply_filters(
1528
+				if (apply_filters(
1529 1529
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success',
1530 1530
 					false
1531
-				) ) {
1531
+				)) {
1532 1532
 					EE_Error::add_success(
1533
-						__( 'no payment required.', 'event_espresso' ),
1533
+						__('no payment required.', 'event_espresso'),
1534 1534
 						__FILE__,
1535 1535
 						__FUNCTION__,
1536 1536
 						__LINE__
@@ -1550,15 +1550,15 @@  discard block
 block discarded – undo
1550 1550
 					EE_Registry::instance()->SSN->checkout()->revisit
1551 1551
 				);
1552 1552
 				// calculate difference between the two arrays
1553
-				$registrations = array_diff( $registrations, $ejected_registrations );
1554
-				if ( empty( $registrations ) ) {
1553
+				$registrations = array_diff($registrations, $ejected_registrations);
1554
+				if (empty($registrations)) {
1555 1555
 					$this->_redirect_because_event_sold_out();
1556 1556
 					return false;
1557 1557
 				}
1558 1558
 				$payment_successful = $this->_process_payment();
1559
-				if ( $payment_successful ) {
1559
+				if ($payment_successful) {
1560 1560
 					$this->checkout->continue_reg = true;
1561
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1561
+					$this->_maybe_set_completed($this->checkout->payment_method);
1562 1562
 				} else {
1563 1563
 					$this->checkout->continue_reg = false;
1564 1564
 				}
@@ -1579,10 +1579,10 @@  discard block
 block discarded – undo
1579 1579
 		$this->checkout->continue_reg = false;
1580 1580
 		// set redirect URL
1581 1581
 		$this->checkout->redirect_url = add_query_arg(
1582
-			array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1582
+			array('e_reg_url_link' => $this->checkout->reg_url_link),
1583 1583
 			$this->checkout->current_step->reg_step_url()
1584 1584
 		);
1585
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1585
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1586 1586
 	}
1587 1587
 
1588 1588
 
@@ -1595,8 +1595,8 @@  discard block
 block discarded – undo
1595 1595
 	 * @return void
1596 1596
 	 * @throws \EE_Error
1597 1597
 	 */
1598
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1599
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1598
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1599
+		switch ($payment_method->type_obj()->payment_occurs()) {
1600 1600
 			case EE_PMT_Base::offsite :
1601 1601
 				break;
1602 1602
 			case EE_PMT_Base::onsite :
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 	public function update_reg_step() {
1620 1620
 		$success = true;
1621 1621
 		// if payment required
1622
-		if ( $this->checkout->transaction->total() > 0 ) {
1622
+		if ($this->checkout->transaction->total() > 0) {
1623 1623
 			do_action(
1624 1624
 				'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway',
1625 1625
 				$this->checkout->transaction
@@ -1627,13 +1627,13 @@  discard block
 block discarded – undo
1627 1627
 			// attempt payment via payment method
1628 1628
 			$success = $this->process_reg_step();
1629 1629
 		}
1630
-		if ( $success && ! $this->checkout->redirect ) {
1630
+		if ($success && ! $this->checkout->redirect) {
1631 1631
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
1632 1632
 				$this->checkout->transaction->ID()
1633 1633
 			);
1634 1634
 			// set return URL
1635 1635
 			$this->checkout->redirect_url = add_query_arg(
1636
-				array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1636
+				array('e_reg_url_link' => $this->checkout->reg_url_link),
1637 1637
 				$this->checkout->thank_you_page_url
1638 1638
 			);
1639 1639
 		}
@@ -1653,28 +1653,28 @@  discard block
 block discarded – undo
1653 1653
 		// clear any previous errors related to not selecting a payment method
1654 1654
 //		EE_Error::overwrite_errors();
1655 1655
 		// ya gotta make a choice man
1656
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1656
+		if (empty($this->checkout->selected_method_of_payment)) {
1657 1657
 			$this->checkout->json_response->set_plz_select_method_of_payment(
1658
-				__( 'Please select a method of payment before proceeding.', 'event_espresso' )
1658
+				__('Please select a method of payment before proceeding.', 'event_espresso')
1659 1659
 			);
1660 1660
 			return false;
1661 1661
 		}
1662 1662
 		// get EE_Payment_Method object
1663
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1663
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1664 1664
 			return false;
1665 1665
 		}
1666 1666
 		// setup billing form
1667
-		if ( $this->checkout->payment_method->is_on_site() ) {
1667
+		if ($this->checkout->payment_method->is_on_site()) {
1668 1668
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1669 1669
 				$this->checkout->payment_method
1670 1670
 			);
1671 1671
 			// bad billing form ?
1672
-			if ( ! $this->_billing_form_is_valid() ) {
1672
+			if ( ! $this->_billing_form_is_valid()) {
1673 1673
 				return false;
1674 1674
 			}
1675 1675
 		}
1676 1676
 		// ensure primary registrant has been fully processed
1677
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1677
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1678 1678
 			return false;
1679 1679
 		}
1680 1680
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1682,18 +1682,18 @@  discard block
 block discarded – undo
1682 1682
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1683 1683
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1684 1684
 		// attempt payment
1685
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1685
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1686 1686
 		// process results
1687
-		$payment = $this->_validate_payment( $payment );
1688
-		$payment = $this->_post_payment_processing( $payment );
1687
+		$payment = $this->_validate_payment($payment);
1688
+		$payment = $this->_post_payment_processing($payment);
1689 1689
 		// verify payment
1690
-		if ( $payment instanceof EE_Payment ) {
1690
+		if ($payment instanceof EE_Payment) {
1691 1691
 			// store that for later
1692 1692
 			$this->checkout->payment = $payment;
1693 1693
 			/** @type EE_Transaction_Processor $transaction_processor */
1694
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1694
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1695 1695
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1696
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1696
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1697 1697
 			$payment_status = $payment->status();
1698 1698
 			if (
1699 1699
 				$payment_status === EEM_Payment::status_id_approved
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 			} else {
1704 1704
 				return false;
1705 1705
 			}
1706
-		} else if ( $payment === true ) {
1706
+		} else if ($payment === true) {
1707 1707
 			// please note that offline payment methods will NOT make a payment,
1708 1708
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1709 1709
 			$this->checkout->payment = $payment;
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 		);
1729 1729
 		$html = $payment_method_billing_info->get_html_and_js();
1730 1730
 		$html .= $this->checkout->redirect_form;
1731
-		EE_Registry::instance()->REQ->add_output( $html );
1731
+		EE_Registry::instance()->REQ->add_output($html);
1732 1732
 		return true;
1733 1733
 	}
1734 1734
 
@@ -1742,28 +1742,28 @@  discard block
 block discarded – undo
1742 1742
 	 * @throws \EE_Error
1743 1743
 	 */
1744 1744
 	private function _billing_form_is_valid() {
1745
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1745
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1746 1746
 			return true;
1747 1747
 		}
1748
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1749
-			if ( $this->checkout->billing_form->was_submitted() ) {
1748
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1749
+			if ($this->checkout->billing_form->was_submitted()) {
1750 1750
 				$this->checkout->billing_form->receive_form_submission();
1751
-				if ( $this->checkout->billing_form->is_valid() ) {
1751
+				if ($this->checkout->billing_form->is_valid()) {
1752 1752
 					return true;
1753 1753
 				}
1754 1754
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1755 1755
 				$error_strings = array();
1756
-				foreach ( $validation_errors as $validation_error ) {
1757
-					if ( $validation_error instanceof EE_Validation_Error ) {
1756
+				foreach ($validation_errors as $validation_error) {
1757
+					if ($validation_error instanceof EE_Validation_Error) {
1758 1758
 						$form_section = $validation_error->get_form_section();
1759
-						if ( $form_section instanceof EE_Form_Input_Base ) {
1759
+						if ($form_section instanceof EE_Form_Input_Base) {
1760 1760
 							$label = $form_section->html_label_text();
1761
-						} elseif ( $form_section instanceof EE_Form_Section_Base ) {
1761
+						} elseif ($form_section instanceof EE_Form_Section_Base) {
1762 1762
 							$label = $form_section->name();
1763 1763
 						} else {
1764
-							$label = __( 'Validation Error', 'event_espresso' );
1764
+							$label = __('Validation Error', 'event_espresso');
1765 1765
 						}
1766
-						$error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() );
1766
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1767 1767
 					}
1768 1768
 				}
1769 1769
 				EE_Error::add_error(
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 							'event_espresso'
1774 1774
 						),
1775 1775
 						'<br/>',
1776
-						implode( '<br/>', $error_strings )
1776
+						implode('<br/>', $error_strings)
1777 1777
 					),
1778 1778
 					__FILE__,
1779 1779
 					__FUNCTION__,
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 			}
1793 1793
 		} else {
1794 1794
 			EE_Error::add_error(
1795
-				__( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ),
1795
+				__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'),
1796 1796
 				__FILE__,
1797 1797
 				__FUNCTION__,
1798 1798
 				__LINE__
@@ -1827,13 +1827,13 @@  discard block
 block discarded – undo
1827 1827
 		// grab the primary_registration object
1828 1828
 		$primary_registration = $this->checkout->transaction->primary_registration();
1829 1829
 		/** @type EE_Transaction_Processor $transaction_processor */
1830
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1830
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1831 1831
 		// at this point we'll consider a TXN to not have been failed
1832
-		$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1832
+		$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1833 1833
 		// save the TXN ( which clears cached copy of primary_registration)
1834 1834
 		$this->checkout->transaction->save();
1835 1835
 		// grab TXN ID and save it to the primary_registration
1836
-		$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1836
+		$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1837 1837
 		// save what we have so far
1838 1838
 		$primary_registration->save();
1839 1839
 		return true;
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
 	private function _capture_primary_registration_data_from_billing_form() {
1852 1852
 		// convert billing form data into an attendee
1853 1853
 		$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1854
-		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1854
+		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1855 1855
 			EE_Error::add_error(
1856 1856
 				sprintf(
1857 1857
 					__(
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 						'event_espresso'
1860 1860
 					),
1861 1861
 					'<br/>',
1862
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1862
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1863 1863
 				),
1864 1864
 				__FILE__,
1865 1865
 				__FUNCTION__,
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 			return false;
1869 1869
 		}
1870 1870
 		$primary_registration = $this->checkout->transaction->primary_registration();
1871
-		if ( ! $primary_registration instanceof EE_Registration ) {
1871
+		if ( ! $primary_registration instanceof EE_Registration) {
1872 1872
 			EE_Error::add_error(
1873 1873
 				sprintf(
1874 1874
 					__(
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 						'event_espresso'
1877 1877
 					),
1878 1878
 					'<br/>',
1879
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1879
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1880 1880
 				),
1881 1881
 				__FILE__,
1882 1882
 				__FUNCTION__,
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 			);
1885 1885
 			return false;
1886 1886
 		}
1887
-		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1887
+		if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee')
1888 1888
 		       instanceof
1889 1889
 		       EE_Attendee
1890 1890
 		) {
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 						'event_espresso'
1896 1896
 					),
1897 1897
 					'<br/>',
1898
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1898
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1899 1899
 				),
1900 1900
 				__FILE__,
1901 1901
 				__FUNCTION__,
@@ -1904,9 +1904,9 @@  discard block
 block discarded – undo
1904 1904
 			return false;
1905 1905
 		}
1906 1906
 		/** @type EE_Registration_Processor $registration_processor */
1907
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1907
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1908 1908
 		// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1909
-		$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1909
+		$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1910 1910
 		return true;
1911 1911
 	}
1912 1912
 
@@ -1921,22 +1921,22 @@  discard block
 block discarded – undo
1921 1921
 	 * @throws \EE_Error
1922 1922
 	 */
1923 1923
 	private function _get_payment_method_for_selected_method_of_payment() {
1924
-		if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) {
1924
+		if ($this->checkout->selected_method_of_payment === 'events_sold_out') {
1925 1925
 			$this->_redirect_because_event_sold_out();
1926 1926
 			return null;
1927 1927
 		}
1928 1928
 		// get EE_Payment_Method object
1929
-		if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) {
1930
-			$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1929
+		if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1930
+			$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1931 1931
 		} else {
1932 1932
 			// load EEM_Payment_Method
1933
-			EE_Registry::instance()->load_model( 'Payment_Method' );
1933
+			EE_Registry::instance()->load_model('Payment_Method');
1934 1934
 			/** @type EEM_Payment_Method $EEM_Payment_Method */
1935 1935
 			$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1936
-			$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1936
+			$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1937 1937
 		}
1938 1938
 		// verify $payment_method
1939
-		if ( ! $payment_method instanceof EE_Payment_Method ) {
1939
+		if ( ! $payment_method instanceof EE_Payment_Method) {
1940 1940
 			// not a payment
1941 1941
 			EE_Error::add_error(
1942 1942
 				sprintf(
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 						'event_espresso'
1946 1946
 					),
1947 1947
 					'<br/>',
1948
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1948
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1949 1949
 				),
1950 1950
 				__FILE__,
1951 1951
 				__FUNCTION__,
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 			return null;
1955 1955
 		}
1956 1956
 		// and verify it has a valid Payment_Method Type object
1957
-		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1957
+		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1958 1958
 			// not a payment
1959 1959
 			EE_Error::add_error(
1960 1960
 				sprintf(
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 						'event_espresso'
1964 1964
 					),
1965 1965
 					'<br/>',
1966
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1966
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1967 1967
 				),
1968 1968
 				__FILE__,
1969 1969
 				__FUNCTION__,
@@ -1984,29 +1984,29 @@  discard block
 block discarded – undo
1984 1984
 	 * @return    mixed    EE_Payment | boolean
1985 1985
 	 * @throws \EE_Error
1986 1986
 	 */
1987
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1987
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1988 1988
 		$payment = null;
1989 1989
 		$this->checkout->transaction->save();
1990
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1991
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1990
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1991
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1992 1992
 			return false;
1993 1993
 		}
1994 1994
 		try {
1995
-			$payment_processor->set_revisit( $this->checkout->revisit );
1995
+			$payment_processor->set_revisit($this->checkout->revisit);
1996 1996
 			// generate payment object
1997 1997
 			$payment = $payment_processor->process_payment(
1998 1998
 				$payment_method,
1999 1999
 				$this->checkout->transaction,
2000 2000
 				$this->checkout->amount_owing,
2001 2001
 				$this->checkout->billing_form,
2002
-				$this->_get_return_url( $payment_method ),
2002
+				$this->_get_return_url($payment_method),
2003 2003
 				'CART',
2004 2004
 				$this->checkout->admin_request,
2005 2005
 				true,
2006 2006
 				$this->reg_step_url()
2007 2007
 			);
2008
-		} catch ( Exception $e ) {
2009
-			$this->_handle_payment_processor_exception( $e );
2008
+		} catch (Exception $e) {
2009
+			$this->_handle_payment_processor_exception($e);
2010 2010
 		}
2011 2011
 		return $payment;
2012 2012
 	}
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
 	 * @return void
2022 2022
 	 * @throws \EE_Error
2023 2023
 	 */
2024
-	protected function _handle_payment_processor_exception( Exception $e ) {
2024
+	protected function _handle_payment_processor_exception(Exception $e) {
2025 2025
 		EE_Error::add_error(
2026 2026
 			sprintf(
2027 2027
 				__(
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 					'event_espresso'
2030 2030
 				),
2031 2031
 				'<br/>',
2032
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
2032
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
2033 2033
 				$e->getMessage(),
2034 2034
 				$e->getFile(),
2035 2035
 				$e->getLine()
@@ -2050,9 +2050,9 @@  discard block
 block discarded – undo
2050 2050
 	 * @return string
2051 2051
 	 * @throws \EE_Error
2052 2052
 	 */
2053
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
2053
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
2054 2054
 		$return_url = '';
2055
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
2055
+		switch ($payment_method->type_obj()->payment_occurs()) {
2056 2056
 			case EE_PMT_Base::offsite :
2057 2057
 				$return_url = add_query_arg(
2058 2058
 					array(
@@ -2081,12 +2081,12 @@  discard block
 block discarded – undo
2081 2081
 	 * @return EE_Payment | FALSE
2082 2082
 	 * @throws \EE_Error
2083 2083
 	 */
2084
-	private function _validate_payment( $payment = null ) {
2085
-		if ( $this->checkout->payment_method->is_off_line() ) {
2084
+	private function _validate_payment($payment = null) {
2085
+		if ($this->checkout->payment_method->is_off_line()) {
2086 2086
 			return true;
2087 2087
 		}
2088 2088
 		// verify payment object
2089
-		if ( ! $payment instanceof EE_Payment ) {
2089
+		if ( ! $payment instanceof EE_Payment) {
2090 2090
 			// not a payment
2091 2091
 			EE_Error::add_error(
2092 2092
 				sprintf(
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 						'event_espresso'
2096 2096
 					),
2097 2097
 					'<br/>',
2098
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2098
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2099 2099
 				),
2100 2100
 				__FILE__,
2101 2101
 				__FUNCTION__,
@@ -2116,27 +2116,27 @@  discard block
 block discarded – undo
2116 2116
 	 * @return bool
2117 2117
 	 * @throws \EE_Error
2118 2118
 	 */
2119
-	private function _post_payment_processing( $payment = null ) {
2119
+	private function _post_payment_processing($payment = null) {
2120 2120
 		// Off-Line payment?
2121
-		if ( $payment === true ) {
2121
+		if ($payment === true) {
2122 2122
 			//$this->_setup_redirect_for_next_step();
2123 2123
 			return true;
2124 2124
 		// On-Site payment?
2125
-		} else if ( $this->checkout->payment_method->is_on_site() ) {
2126
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) {
2125
+		} else if ($this->checkout->payment_method->is_on_site()) {
2126
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
2127 2127
 				//$this->_setup_redirect_for_next_step();
2128 2128
 				$this->checkout->continue_reg = false;
2129 2129
 			}
2130 2130
 		// Off-Site payment?
2131
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
2131
+		} else if ($this->checkout->payment_method->is_off_site()) {
2132 2132
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
2133
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ) {
2134
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
2133
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
2134
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
2135 2135
 				$this->checkout->redirect = true;
2136 2136
 				$this->checkout->redirect_form = $payment->redirect_form();
2137
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
2137
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
2138 2138
 				// set JSON response
2139
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
2139
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
2140 2140
 				// set cron job for finalizing the TXN
2141 2141
 				// in case the user does not return from the off-site gateway
2142 2142
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 					$this->checkout->transaction->ID()
2145 2145
 				);
2146 2146
 				// and lastly, let's bump the payment status to pending
2147
-				$payment->set_status( EEM_Payment::status_id_pending );
2147
+				$payment->set_status(EEM_Payment::status_id_pending);
2148 2148
 				$payment->save();
2149 2149
 			} else {
2150 2150
 				// not a payment
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
 							'event_espresso'
2157 2157
 						),
2158 2158
 						'<br/>',
2159
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2159
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
2160 2160
 					),
2161 2161
 					__FILE__,
2162 2162
 					__FUNCTION__,
@@ -2194,21 +2194,21 @@  discard block
 block discarded – undo
2194 2194
 	 * @return bool
2195 2195
 	 * @throws \EE_Error
2196 2196
 	 */
2197
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
2197
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
2198 2198
 		// off-line payment? carry on
2199
-		if ( $payment_occurs === EE_PMT_Base::offline ) {
2199
+		if ($payment_occurs === EE_PMT_Base::offline) {
2200 2200
 			return true;
2201 2201
 		}
2202 2202
 		// verify payment validity
2203
-		if ( $payment instanceof EE_Payment ) {
2204
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
2203
+		if ($payment instanceof EE_Payment) {
2204
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
2205 2205
 			$msg = $payment->gateway_response();
2206 2206
 			// check results
2207
-			switch ( $payment->status() ) {
2207
+			switch ($payment->status()) {
2208 2208
 				// good payment
2209 2209
 				case EEM_Payment::status_id_approved :
2210 2210
 					EE_Error::add_success(
2211
-						__( 'Your payment was processed successfully.', 'event_espresso' ),
2211
+						__('Your payment was processed successfully.', 'event_espresso'),
2212 2212
 						__FILE__,
2213 2213
 						__FUNCTION__,
2214 2214
 						__LINE__
@@ -2217,45 +2217,45 @@  discard block
 block discarded – undo
2217 2217
 					break;
2218 2218
 				// slow payment
2219 2219
 				case EEM_Payment::status_id_pending :
2220
-					if ( empty( $msg ) ) {
2220
+					if (empty($msg)) {
2221 2221
 						$msg = __(
2222 2222
 							'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.',
2223 2223
 							'event_espresso'
2224 2224
 						);
2225 2225
 					}
2226
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
2226
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
2227 2227
 					return true;
2228 2228
 					break;
2229 2229
 				// don't wanna payment
2230 2230
 				case EEM_Payment::status_id_cancelled :
2231
-					if ( empty( $msg ) ) {
2231
+					if (empty($msg)) {
2232 2232
 						$msg = _n(
2233 2233
 							'Payment cancelled. Please try again.',
2234 2234
 							'Payment cancelled. Please try again or select another method of payment.',
2235
-							count( $this->checkout->available_payment_methods ),
2235
+							count($this->checkout->available_payment_methods),
2236 2236
 							'event_espresso'
2237 2237
 						);
2238 2238
 					}
2239
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2239
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2240 2240
 					return false;
2241 2241
 					break;
2242 2242
 				// not enough payment
2243 2243
 				case EEM_Payment::status_id_declined :
2244
-					if ( empty( $msg ) ) {
2244
+					if (empty($msg)) {
2245 2245
 						$msg = _n(
2246 2246
 							'We\'re sorry but your payment was declined. Please try again.',
2247 2247
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
2248
-							count( $this->checkout->available_payment_methods ),
2248
+							count($this->checkout->available_payment_methods),
2249 2249
 							'event_espresso'
2250 2250
 						);
2251 2251
 					}
2252
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2252
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2253 2253
 					return false;
2254 2254
 					break;
2255 2255
 				// bad payment
2256 2256
 				case EEM_Payment::status_id_failed :
2257
-					if ( ! empty( $msg ) ) {
2258
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2257
+					if ( ! empty($msg)) {
2258
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2259 2259
 						return false;
2260 2260
 					}
2261 2261
 					// default to error below
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 		}
2265 2265
 		// off-site payment gateway responses are too unreliable, so let's just assume that
2266 2266
 		// the payment processing is just running slower than the registrant's request
2267
-		if ( $payment_occurs === EE_PMT_Base::offsite ) {
2267
+		if ($payment_occurs === EE_PMT_Base::offsite) {
2268 2268
 			return true;
2269 2269
 		}
2270 2270
 		EE_Error::add_error(
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 					'event_espresso'
2275 2275
 				),
2276 2276
 				'<br/>',
2277
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2277
+				EE_Registry::instance()->CFG->organization->get_pretty('email')
2278 2278
 			),
2279 2279
 			__FILE__,
2280 2280
 			__FUNCTION__,
@@ -2307,13 +2307,13 @@  discard block
 block discarded – undo
2307 2307
 	public function process_gateway_response() {
2308 2308
 		$payment = null;
2309 2309
 		// how have they chosen to pay?
2310
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
2310
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
2311 2311
 		// get EE_Payment_Method object
2312
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
2312
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
2313 2313
 			$this->checkout->continue_reg = false;
2314 2314
 			return false;
2315 2315
 		}
2316
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
2316
+		if ( ! $this->checkout->payment_method->is_off_site()) {
2317 2317
 			return false;
2318 2318
 		}
2319 2319
 		$this->_validate_offsite_return();
@@ -2327,23 +2327,23 @@  discard block
 block discarded – undo
2327 2327
 		//	true
2328 2328
 		//);
2329 2329
 		// verify TXN
2330
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
2330
+		if ($this->checkout->transaction instanceof EE_Transaction) {
2331 2331
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
2332
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
2332
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
2333 2333
 				$this->checkout->continue_reg = false;
2334 2334
 				return false;
2335 2335
 			}
2336
-			$payment = $this->_process_off_site_payment( $gateway );
2337
-			$payment = $this->_process_cancelled_payments( $payment );
2338
-			$payment = $this->_validate_payment( $payment );
2336
+			$payment = $this->_process_off_site_payment($gateway);
2337
+			$payment = $this->_process_cancelled_payments($payment);
2338
+			$payment = $this->_validate_payment($payment);
2339 2339
 			// if payment was not declined by the payment gateway or cancelled by the registrant
2340
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
2340
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
2341 2341
 				//$this->_setup_redirect_for_next_step();
2342 2342
 				// store that for later
2343 2343
 				$this->checkout->payment = $payment;
2344 2344
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
2345 2345
 				// because we will complete this step during the IPN processing then
2346
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) {
2346
+				if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) {
2347 2347
 					$this->set_completed();
2348 2348
 				}
2349 2349
 				return true;
@@ -2367,21 +2367,21 @@  discard block
 block discarded – undo
2367 2367
 	 * @throws \EE_Error
2368 2368
 	 */
2369 2369
 	private function _validate_offsite_return() {
2370
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
2371
-		if ( $TXN_ID !== $this->checkout->transaction->ID() ) {
2370
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
2371
+		if ($TXN_ID !== $this->checkout->transaction->ID()) {
2372 2372
 			// Houston... we might have a problem
2373 2373
 			$invalid_TXN = false;
2374 2374
 			// first gather some info
2375
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
2375
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
2376 2376
 			$primary_registrant = $valid_TXN instanceof EE_Transaction
2377 2377
 				? $valid_TXN->primary_registration()
2378 2378
 				: null;
2379 2379
 			// let's start by retrieving the cart for this TXN
2380
-			$cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction );
2381
-			if ( $cart instanceof EE_Cart ) {
2380
+			$cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction);
2381
+			if ($cart instanceof EE_Cart) {
2382 2382
 				// verify that the current cart has tickets
2383 2383
 				$tickets = $cart->get_tickets();
2384
-				if ( empty( $tickets ) ) {
2384
+				if (empty($tickets)) {
2385 2385
 					$invalid_TXN = true;
2386 2386
 				}
2387 2387
 			} else {
@@ -2391,39 +2391,39 @@  discard block
 block discarded – undo
2391 2391
 				? $primary_registrant->session_ID()
2392 2392
 				: null;
2393 2393
 			// validate current Session ID and compare against valid TXN session ID
2394
-			if ( EE_Session::instance()->id() === null ) {
2394
+			if (EE_Session::instance()->id() === null) {
2395 2395
 				$invalid_TXN = true;
2396
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
2396
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
2397 2397
 				// WARNING !!!
2398 2398
 				// this could be PayPal sending back duplicate requests (ya they do that)
2399 2399
 				// or it **could** mean someone is simply registering AGAIN after having just done so
2400 2400
 				// so now we need to determine if this current TXN looks valid or not
2401 2401
 				/** @type EE_Transaction_Processor $transaction_processor */
2402
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
2402
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
2403 2403
 				// has this step even been started ?
2404
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
2404
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
2405 2405
 				) {
2406 2406
 					// really? you're half way through this reg step, but you never started it ?
2407 2407
 					$invalid_TXN = true;
2408 2408
 				}
2409 2409
 			}
2410
-			if ( $invalid_TXN ) {
2410
+			if ($invalid_TXN) {
2411 2411
 				// is the valid TXN completed ?
2412
-				if ( $valid_TXN instanceof EE_Transaction ) {
2412
+				if ($valid_TXN instanceof EE_Transaction) {
2413 2413
 					/** @type EE_Transaction_Processor $transaction_processor */
2414
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
2414
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
2415 2415
 					// has this step even been started ?
2416
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
2417
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
2416
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
2417
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
2418 2418
 						// so it **looks** like this is a double request from PayPal
2419 2419
 						// so let's try to pick up where we left off
2420 2420
 						$this->checkout->transaction = $valid_TXN;
2421
-						$this->checkout->refresh_all_entities( true );
2421
+						$this->checkout->refresh_all_entities(true);
2422 2422
 						return;
2423 2423
 					}
2424 2424
 				}
2425 2425
 				// you appear to be lost?
2426
-				$this->_redirect_wayward_request( $primary_registrant );
2426
+				$this->_redirect_wayward_request($primary_registrant);
2427 2427
 			}
2428 2428
 		}
2429 2429
 	}
@@ -2438,14 +2438,14 @@  discard block
 block discarded – undo
2438 2438
 	 * @return bool
2439 2439
 	 * @throws \EE_Error
2440 2440
 	 */
2441
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
2442
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2441
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
2442
+		if ( ! $primary_registrant instanceof EE_Registration) {
2443 2443
 			// try redirecting based on the current TXN
2444 2444
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction
2445 2445
 				? $this->checkout->transaction->primary_registration()
2446 2446
 				: null;
2447 2447
 		}
2448
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2448
+		if ( ! $primary_registrant instanceof EE_Registration) {
2449 2449
 			EE_Error::add_error(
2450 2450
 				sprintf(
2451 2451
 					__(
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
 						'event_espresso'
2454 2454
 					),
2455 2455
 					'<br/>',
2456
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2456
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2457 2457
 				),
2458 2458
 				__FILE__,
2459 2459
 				__FUNCTION__,
@@ -2484,17 +2484,17 @@  discard block
 block discarded – undo
2484 2484
 	 * @return \EE_Payment
2485 2485
 	 * @throws \EE_Error
2486 2486
 	 */
2487
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
2487
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
2488 2488
 		try {
2489 2489
 			$request_data = \EE_Registry::instance()->REQ->params();
2490 2490
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
2491 2491
 			$this->set_handle_IPN_in_this_request(
2492
-				$gateway->handle_IPN_in_this_request( $request_data, false )
2492
+				$gateway->handle_IPN_in_this_request($request_data, false)
2493 2493
 			);
2494
-			if ( $this->handle_IPN_in_this_request() ) {
2494
+			if ($this->handle_IPN_in_this_request()) {
2495 2495
 				// get payment details and process results
2496 2496
 				/** @type EE_Payment_Processor $payment_processor */
2497
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
2497
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
2498 2498
 				$payment = $payment_processor->process_ipn(
2499 2499
 					$request_data,
2500 2500
 					$this->checkout->transaction,
@@ -2507,14 +2507,14 @@  discard block
 block discarded – undo
2507 2507
 				$payment = $this->checkout->transaction->last_payment();
2508 2508
 				//$payment_source = 'last_payment';
2509 2509
 			}
2510
-		} catch ( Exception $e ) {
2510
+		} catch (Exception $e) {
2511 2511
 			// let's just eat the exception and try to move on using any previously set payment info
2512 2512
 			$payment = $this->checkout->transaction->last_payment();
2513 2513
 			//$payment_source = 'last_payment after Exception';
2514 2514
 			// but if we STILL don't have a payment object
2515
-			if ( ! $payment instanceof EE_Payment ) {
2515
+			if ( ! $payment instanceof EE_Payment) {
2516 2516
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
2517
-				$this->_handle_payment_processor_exception( $e );
2517
+				$this->_handle_payment_processor_exception($e);
2518 2518
 			}
2519 2519
 		}
2520 2520
 		// DEBUG LOG
@@ -2539,13 +2539,13 @@  discard block
 block discarded – undo
2539 2539
 	 * @return EE_Payment | FALSE
2540 2540
 	 * @throws \EE_Error
2541 2541
 	 */
2542
-	private function _process_cancelled_payments( $payment = null ) {
2542
+	private function _process_cancelled_payments($payment = null) {
2543 2543
 		if (
2544 2544
 			$payment instanceof EE_Payment
2545
-			&& isset( $_REQUEST['ee_cancel_payment'] )
2545
+			&& isset($_REQUEST['ee_cancel_payment'])
2546 2546
 			&& $payment->status() === EEM_Payment::status_id_failed
2547 2547
 		) {
2548
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2548
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2549 2549
 		}
2550 2550
 		return $payment;
2551 2551
 	}
@@ -2562,14 +2562,14 @@  discard block
 block discarded – undo
2562 2562
 	public function get_transaction_details_for_gateways() {
2563 2563
 		$txn_details = array();
2564 2564
 		// ya gotta make a choice man
2565
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2565
+		if (empty($this->checkout->selected_method_of_payment)) {
2566 2566
 			$txn_details = array(
2567
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2567
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2568 2568
 			);
2569 2569
 		}
2570 2570
 		// get EE_Payment_Method object
2571 2571
 		if (
2572
-			empty( $txn_details )
2572
+			empty($txn_details)
2573 2573
 			&&
2574 2574
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2575 2575
 		) {
@@ -2581,8 +2581,8 @@  discard block
 block discarded – undo
2581 2581
 				)
2582 2582
 			);
2583 2583
 		}
2584
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2585
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2584
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2585
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2586 2586
 			$txn_details = array(
2587 2587
 				'TXN_ID'         => $this->checkout->transaction->ID(),
2588 2588
 				'TXN_timestamp'  => $this->checkout->transaction->datetime(),
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 				'PMD_ID'         => $this->checkout->transaction->payment_method_ID(),
2594 2594
 				'payment_amount' => $this->checkout->amount_owing,
2595 2595
 				'return_url'     => $return_url,
2596
-				'cancel_url'     => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2596
+				'cancel_url'     => add_query_arg(array('ee_cancel_payment' => true), $return_url),
2597 2597
 				'notify_url'     => EE_Config::instance()->core->txn_page_url(
2598 2598
 					array(
2599 2599
 						'e_reg_url_link'    => $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2602,7 +2602,7 @@  discard block
 block discarded – undo
2602 2602
 				)
2603 2603
 			);
2604 2604
 		}
2605
-		echo json_encode( $txn_details );
2605
+		echo json_encode($txn_details);
2606 2606
 		exit();
2607 2607
 	}
2608 2608
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *
42 42
  */
43 43
 
44
-if ( function_exists( 'espresso_version' ) ) {
44
+if (function_exists('espresso_version')) {
45 45
 
46 46
 	/**
47 47
 	 *    espresso_duplicate_plugin_error
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	function espresso_duplicate_plugin_error() {
51 51
 		?>
52 52
 		<div class="error">
53
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
53
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
54 54
 		</div>
55 55
 		<?php
56
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
56
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
57 57
 	}
58
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
58
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59 59
 
60 60
 } else {
61 61
 
@@ -66,103 +66,103 @@  discard block
 block discarded – undo
66 66
 	 * @return string
67 67
 	 */
68 68
 	function espresso_version() {
69
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.4.rc.004' );
69
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.4.rc.004');
70 70
 	}
71 71
 
72 72
 	// define versions
73
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
74
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
75
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
76
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
77
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
78
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
79
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
73
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
74
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
75
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
76
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
77
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
78
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
79
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
80 80
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
81
-	if ( ! defined( 'DS' ) ) {
82
-		define( 'DS', '/' );
81
+	if ( ! defined('DS')) {
82
+		define('DS', '/');
83 83
 	}
84
-	if ( ! defined( 'PS' ) ) {
85
-		define( 'PS', PATH_SEPARATOR );
84
+	if ( ! defined('PS')) {
85
+		define('PS', PATH_SEPARATOR);
86 86
 	}
87
-	if ( ! defined( 'SP' ) ) {
88
-		define( 'SP', ' ' );
87
+	if ( ! defined('SP')) {
88
+		define('SP', ' ');
89 89
 	}
90
-	if ( ! defined( 'EENL' ) ) {
91
-		define( 'EENL', "\n" );
90
+	if ( ! defined('EENL')) {
91
+		define('EENL', "\n");
92 92
 	}
93
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
93
+	define('EE_SUPPORT_EMAIL', '[email protected]');
94 94
 	// define the plugin directory and URL
95
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
96
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
95
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
96
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
98 98
 	// main root folder paths
99
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
100
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
101
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
102
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
103
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
104
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
105
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
106
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
99
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
100
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
101
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
102
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
103
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
104
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
105
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
106
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
107 107
 	// core system paths
108
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
109
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
110
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
111
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
112
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
113
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
114
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
115
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
116
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
117
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
118
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
119
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
108
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
109
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
110
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
111
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
112
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
113
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
114
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
115
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
116
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
117
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
118
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
119
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
120 120
 	// gateways
121
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
122
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
121
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
122
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
123 123
 	// asset URL paths
124
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
125
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
126
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
127
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
128
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
129
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
124
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
125
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
126
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
127
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
128
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
129
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
130 130
 	// define upload paths
131 131
 	$uploads = wp_upload_dir();
132 132
 	// define the uploads directory and URL
133
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
134
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
133
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
134
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
135 135
 	// define the templates directory and URL
136
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
136
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
137
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
138 138
 	// define the gateway directory and URL
139
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
139
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
140
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
141 141
 	// languages folder/path
142
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
143
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
142
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
143
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
144 144
 	//check for dompdf fonts in uploads
145
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
146
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
145
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
146
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
147 147
 	}
148 148
 	//ajax constants
149
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
150
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
149
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
150
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
151 151
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
152 152
 	//you're better to use this than its straight value (currently -1) in case you ever
153 153
 	//want to change its default value! or find when -1 means infinity
154
-	define( 'EE_INF_IN_DB', -1 );
155
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
156
-	define( 'EE_DEBUG', false );
154
+	define('EE_INF_IN_DB', -1);
155
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
156
+	define('EE_DEBUG', false);
157 157
 
158 158
 	/**
159 159
 	 *    espresso_plugin_activation
160 160
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
161 161
 	 */
162 162
 	function espresso_plugin_activation() {
163
-		update_option( 'ee_espresso_activation', true );
163
+		update_option('ee_espresso_activation', true);
164 164
 	}
165
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
165
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
166 166
 
167 167
 
168 168
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		//	}
177 177
 		//
178 178
 	}
179
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
179
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
180 180
 
181 181
 
182 182
 
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	function espresso_load_error_handling() {
188 188
 		// load debugging tools
189
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
190
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
189
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
190
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
191 191
 			EEH_Debug_Tools::instance();
192 192
 		}
193 193
 		// load error handling
194
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
195
-			require_once( EE_CORE . 'EE_Error.core.php' );
194
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
195
+			require_once(EE_CORE.'EE_Error.core.php');
196 196
 		} else {
197
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
197
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
198 198
 		}
199 199
 	}
200 200
 
@@ -208,25 +208,25 @@  discard block
 block discarded – undo
208 208
 	 * @param    string $full_path_to_file
209 209
 	 * @throws    EE_Error
210 210
 	 */
211
-	function espresso_load_required( $classname, $full_path_to_file ) {
211
+	function espresso_load_required($classname, $full_path_to_file) {
212 212
 		static $error_handling_loaded = false;
213
-		if ( ! $error_handling_loaded ) {
213
+		if ( ! $error_handling_loaded) {
214 214
 			espresso_load_error_handling();
215 215
 			$error_handling_loaded = true;
216 216
 		}
217
-		if ( is_readable( $full_path_to_file ) ) {
218
-			require_once( $full_path_to_file );
217
+		if (is_readable($full_path_to_file)) {
218
+			require_once($full_path_to_file);
219 219
 		} else {
220
-			throw new EE_Error ( sprintf(
221
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
220
+			throw new EE_Error(sprintf(
221
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
222 222
 				$classname
223
-			) );
223
+			));
224 224
 		}
225 225
 	}
226 226
 
227
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
228
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
229
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
227
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
228
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
229
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
230 230
 	new EE_Bootstrap();
231 231
 
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 
237 237
 
238
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
238
+if ( ! function_exists('espresso_deactivate_plugin')) {
239 239
 	/**
240 240
 	*    deactivate_plugin
241 241
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
245 245
 	* @return    void
246 246
 	*/
247
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
248
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
249
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
247
+	function espresso_deactivate_plugin($plugin_basename = '') {
248
+		if ( ! function_exists('deactivate_plugins')) {
249
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
250 250
 		}
251
-		unset( $_GET[ 'activate' ] );
252
-		unset( $_REQUEST[ 'activate' ] );
253
-		deactivate_plugins( $plugin_basename );
251
+		unset($_GET['activate']);
252
+		unset($_REQUEST['activate']);
253
+		deactivate_plugins($plugin_basename);
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Resource_Manager.lib.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 * @return void
881 881
 	 */
882 882
 	public function deactivate_messenger( $messenger_name ) {
883
-        $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
883
+		$this->_initialize_collections();
884
+		if ( $messenger_name instanceof EE_messenger ) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887 887
 		unset( $this->_active_messengers[ $messenger_name ] );
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899 899
 	public function deactivate_message_type( $message_type_name ) {
900
-        $this->_initialize_collections();
900
+		$this->_initialize_collections();
901 901
 		if ( $message_type_name instanceof EE_message_type ) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929 929
 	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
930
-        $this->_initialize_collections();
930
+		$this->_initialize_collections();
931 931
 		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932 932
 			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
933 933
 		}
Please login to merge, or discard this patch.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 * @return void
135 135
 	 */
136 136
 	protected function _initialize_collections() {
137
-		if ( $this->_initialized ) {
137
+		if ($this->_initialized) {
138 138
 			return;
139 139
 		}
140 140
 		$this->_initialized = true;
141 141
 		$this->_messenger_collection_loader->load_messengers_from_folder();
142 142
 		$this->_message_type_collection_loader->load_message_types_from_folder();
143
-		$this->get_has_activated_messengers_option( true );
143
+		$this->get_has_activated_messengers_option(true);
144 144
 		$this->_set_active_messengers_and_message_types();
145 145
 	}
146 146
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @param string $messenger_name
171 171
 	 * @return \EE_messenger
172 172
 	 */
173
-	public function get_messenger( $messenger_name ) {
174
-		return $this->messenger_collection()->get_by_info( $messenger_name );
173
+	public function get_messenger($messenger_name) {
174
+		return $this->messenger_collection()->get_by_info($messenger_name);
175 175
 	}
176 176
 
177 177
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 	 * @param string $messenger
183 183
 	 * @return EE_messenger | null
184 184
 	 */
185
-	public function get_active_messenger( $messenger ) {
185
+	public function get_active_messenger($messenger) {
186 186
 		$this->_initialize_collections();
187
-		return ! empty( $this->_active_messengers[ $messenger ] ) ? $this->_active_messengers[ $messenger ] : null;
187
+		return ! empty($this->_active_messengers[$messenger]) ? $this->_active_messengers[$messenger] : null;
188 188
 	}
189 189
 
190 190
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 * @return \EE_messenger[]
194 194
 	 */
195 195
 	public function installed_messengers() {
196
-		if ( empty( $this->_installed_messengers ) ) {
196
+		if (empty($this->_installed_messengers)) {
197 197
 			$this->_installed_messengers = array();
198 198
 			$this->messenger_collection()->rewind();
199
-			while ( $this->messenger_collection()->valid() ) {
200
-				$this->_installed_messengers[ $this->messenger_collection()->current()->name ] = $this->messenger_collection()->current();
199
+			while ($this->messenger_collection()->valid()) {
200
+				$this->_installed_messengers[$this->messenger_collection()->current()->name] = $this->messenger_collection()->current();
201 201
 				$this->messenger_collection()->next();
202 202
 			}
203 203
 		}
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 * @return \EE_messenger
212 212
 	 * @throws \EE_Error
213 213
 	 */
214
-	public function valid_messenger( $messenger_name ) {
215
-		$messenger = $this->get_messenger( $messenger_name );
216
-		if ( $messenger instanceof EE_messenger ) {
214
+	public function valid_messenger($messenger_name) {
215
+		$messenger = $this->get_messenger($messenger_name);
216
+		if ($messenger instanceof EE_messenger) {
217 217
 			return $messenger;
218 218
 		}
219 219
 		throw new EE_Error(
220 220
 			sprintf(
221
-				__( 'The "%1$s" messenger is either invalid or not installed', 'event_espresso' ),
221
+				__('The "%1$s" messenger is either invalid or not installed', 'event_espresso'),
222 222
 				$messenger_name
223 223
 			)
224 224
 		);
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param string $message_type_name
251 251
 	 * @return \EE_message_type
252 252
 	 */
253
-	public function get_message_type( $message_type_name ) {
254
-		return $this->message_type_collection()->get_by_info( $message_type_name );
253
+	public function get_message_type($message_type_name) {
254
+		return $this->message_type_collection()->get_by_info($message_type_name);
255 255
 	}
256 256
 
257 257
 
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	 * @param string $message_type_name
264 264
 	 * @return \EE_message_type|null
265 265
 	 */
266
-	public function get_active_message_type_for_messenger( $messenger_name, $message_type_name ) {
267
-		return $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
268
-			? $this->get_message_type( $message_type_name )
266
+	public function get_active_message_type_for_messenger($messenger_name, $message_type_name) {
267
+		return $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)
268
+			? $this->get_message_type($message_type_name)
269 269
 			: null;
270 270
 	}
271 271
 
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return bool
281 281
 	 */
282
-	public function is_message_type_active_for_messenger( $messenger_name, $message_type_name ) {
282
+	public function is_message_type_active_for_messenger($messenger_name, $message_type_name) {
283 283
 		$this->_initialize_collections();
284
-		return ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
284
+		return ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
285 285
 	}
286 286
 
287 287
 
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 * @param string $messenger_name  the name of the messenger to check if active.
293 293
 	 * @return bool
294 294
 	 */
295
-	public function is_messenger_active( $messenger_name ) {
295
+	public function is_messenger_active($messenger_name) {
296 296
 		$this->_initialize_collections();
297
-		return ! empty( $this->_active_message_types[ $messenger_name ] );
297
+		return ! empty($this->_active_message_types[$messenger_name]);
298 298
 	}
299 299
 
300 300
 
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	 * @param string $message_type_name  The slug of the message type getting the settings for.
306 306
 	 * @return array
307 307
 	 */
308
-	public function get_message_type_settings_for_messenger( $messenger_name, $message_type_name ) {
308
+	public function get_message_type_settings_for_messenger($messenger_name, $message_type_name) {
309 309
 		$settings = array();
310
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
311
-			$settings =  isset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] )
312
-				? $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings']
310
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
311
+			$settings = isset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'])
312
+				? $this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings']
313 313
 				: array();
314 314
 		}
315 315
 		return $settings;
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	 * @param string $messenger_name
325 325
 	 * @return bool
326 326
 	 */
327
-	public function messenger_has_active_message_types( $messenger_name ) {
327
+	public function messenger_has_active_message_types($messenger_name) {
328 328
 		$this->_initialize_collections();
329 329
 		return
330
-			! empty( $this->_active_message_types[ $messenger_name ] )
331
-			&& ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ] );
330
+			! empty($this->_active_message_types[$messenger_name])
331
+			&& ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types']);
332 332
 	}
333 333
 
334 334
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 	 * @param string $messenger_name The messenger being checked
342 342
 	 * @return EE_message_type[]|array    (empty array if no active_message_types)
343 343
 	 */
344
-	public function get_active_message_types_for_messenger( $messenger_name ) {
344
+	public function get_active_message_types_for_messenger($messenger_name) {
345 345
 		$message_types = array();
346
-		if ( ! $this->messenger_has_active_message_types( $messenger_name ) ) {
346
+		if ( ! $this->messenger_has_active_message_types($messenger_name)) {
347 347
 			return $message_types;
348 348
 		}
349 349
 		$installed_message_types = $this->installed_message_types();
350
-		foreach ( $installed_message_types as $message_type_name => $message_type ) {
351
-			if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
352
-				$message_types[ $message_type_name ] = $message_type;
350
+		foreach ($installed_message_types as $message_type_name => $message_type) {
351
+			if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
352
+				$message_types[$message_type_name] = $message_type;
353 353
 			}
354 354
 		}
355 355
 		return $message_types;
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 	public function list_of_active_message_types() {
368 368
 		$active_message_type_names = array();
369 369
 		$this->_initialize_collections();
370
-		foreach ( $this->_active_message_types as $messenger => $messenger_settings ) {
371
-			if ( ! isset( $messenger_settings['settings'][ $messenger . '-message_types' ] ) ) {
370
+		foreach ($this->_active_message_types as $messenger => $messenger_settings) {
371
+			if ( ! isset($messenger_settings['settings'][$messenger.'-message_types'])) {
372 372
 				continue;
373 373
 			}
374
-			foreach ( $messenger_settings['settings'][ $messenger . '-message_types' ] as $message_type_name => $message_type_config ) {
375
-				if ( ! in_array( $message_type_name, $active_message_type_names ) ) {
374
+			foreach ($messenger_settings['settings'][$messenger.'-message_types'] as $message_type_name => $message_type_config) {
375
+				if ( ! in_array($message_type_name, $active_message_type_names)) {
376 376
 					$active_message_type_names[] = $message_type_name;
377 377
 				}
378 378
 			}
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 		$active_message_types = array();
393 393
 		$installed_message_types = $this->installed_message_types();
394 394
 		$active_message_type_names = $this->list_of_active_message_types();
395
-		foreach ( $active_message_type_names as $active_message_type_name ) {
396
-			if ( isset( $installed_message_types[ $active_message_type_name ] ) ) {
397
-				$active_message_types[ $active_message_type_name ] = $installed_message_types[ $active_message_type_name ];
395
+		foreach ($active_message_type_names as $active_message_type_name) {
396
+			if (isset($installed_message_types[$active_message_type_name])) {
397
+				$active_message_types[$active_message_type_name] = $installed_message_types[$active_message_type_name];
398 398
 			}
399 399
 		}
400 400
 		return $active_message_types;
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 	 * @return \EE_message_type[]
407 407
 	 */
408 408
 	public function installed_message_types() {
409
-		if ( empty( $this->_installed_message_types ) ) {
409
+		if (empty($this->_installed_message_types)) {
410 410
 			$this->message_type_collection()->rewind();
411
-			while ( $this->message_type_collection()->valid() ) {
412
-				$this->_installed_message_types[ $this->message_type_collection()->current()->name ] = $this->message_type_collection()->current();
411
+			while ($this->message_type_collection()->valid()) {
412
+				$this->_installed_message_types[$this->message_type_collection()->current()->name] = $this->message_type_collection()->current();
413 413
 				$this->message_type_collection()->next();
414 414
 			}
415 415
 		}
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
 	 * @return \EE_message_type
423 423
 	 * @throws \EE_Error
424 424
 	 */
425
-	public function valid_message_type( $message_type_name ) {
426
-		$message_type = $this->get_message_type( $message_type_name );
427
-		if ( $message_type instanceof EE_message_type ) {
425
+	public function valid_message_type($message_type_name) {
426
+		$message_type = $this->get_message_type($message_type_name);
427
+		if ($message_type instanceof EE_message_type) {
428 428
 			return $message_type;
429 429
 		}
430 430
 		throw new EE_Error(
431 431
 			sprintf(
432
-				__( 'The "%1$s" message type is either invalid or not installed', 'event_espresso' ),
432
+				__('The "%1$s" message type is either invalid or not installed', 'event_espresso'),
433 433
 				$message_type_name
434 434
 			)
435 435
 		);
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 	 * @return boolean
446 446
 	 * @throws \EE_Error
447 447
 	 */
448
-	public function valid_message_type_for_messenger( EE_messenger $messenger, $message_type_name ) {
448
+	public function valid_message_type_for_messenger(EE_messenger $messenger, $message_type_name) {
449 449
 		$valid_message_types = $messenger->get_valid_message_types();
450
-		if ( ! in_array( $message_type_name, $valid_message_types ) ) {
450
+		if ( ! in_array($message_type_name, $valid_message_types)) {
451 451
 			throw new EE_Error(
452 452
 				sprintf(
453 453
 					__(
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return array
476 476
 	 */
477
-	public function get_active_messengers_option( $reset = false) {
478
-		if ( $reset ) {
479
-			$this->_active_message_types = get_option( 'ee_active_messengers', array() );
477
+	public function get_active_messengers_option($reset = false) {
478
+		if ($reset) {
479
+			$this->_active_message_types = get_option('ee_active_messengers', array());
480 480
 		}
481 481
 		return $this->_active_message_types;
482 482
 	}
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 *                                 representing this data is used.
491 491
 	 * @return bool FALSE if not updated, TRUE if updated.
492 492
 	 */
493
-	public function update_active_messengers_option( $active_messenger_settings = array() ) {
494
-		$active_messenger_settings = empty( $active_messenger_settings ) ? $this->_active_message_types : $active_messenger_settings;
493
+	public function update_active_messengers_option($active_messenger_settings = array()) {
494
+		$active_messenger_settings = empty($active_messenger_settings) ? $this->_active_message_types : $active_messenger_settings;
495 495
 		//make sure _active_message_types is updated (this is the internal cache for the settings).
496 496
 		$this->_active_message_types = $active_messenger_settings;
497
-		return update_option( 'ee_active_messengers', $active_messenger_settings );
497
+		return update_option('ee_active_messengers', $active_messenger_settings);
498 498
 	}
499 499
 
500 500
 
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @return array
511 511
 	 */
512
-	public function get_has_activated_messengers_option( $reset = false ) {
513
-		if ( $reset || empty( $this->_has_activated_messengers_and_message_types ) ) {
514
-			$this->_has_activated_messengers_and_message_types = get_option( 'ee_has_activated_messenger', array() );
512
+	public function get_has_activated_messengers_option($reset = false) {
513
+		if ($reset || empty($this->_has_activated_messengers_and_message_types)) {
514
+			$this->_has_activated_messengers_and_message_types = get_option('ee_has_activated_messenger', array());
515 515
 		}
516 516
 		return $this->_has_activated_messengers_and_message_types;
517 517
 	}
@@ -526,15 +526,15 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @return bool FALSE if not updated, TRUE if updated.
528 528
 	 */
529
-	public function update_has_activated_messengers_option( $has_activated_messengers = array() ) {
529
+	public function update_has_activated_messengers_option($has_activated_messengers = array()) {
530 530
 		//make sure the option has been retrieved from first so we don't overwrite it accidentally.
531
-		if ( empty( $has_activated_messengers ) && empty( $this->_has_activated_messengers_and_message_types ) ) {
531
+		if (empty($has_activated_messengers) && empty($this->_has_activated_messengers_and_message_types)) {
532 532
 			$this->get_has_activated_messengers_option();
533 533
 		}
534
-		$has_activated_messengers = empty( $has_activated_messengers )
534
+		$has_activated_messengers = empty($has_activated_messengers)
535 535
 			? $this->_has_activated_messengers_and_message_types
536 536
 			: $has_activated_messengers;
537
-		return update_option( 'ee_has_activated_messenger', $has_activated_messengers );
537
+		return update_option('ee_has_activated_messenger', $has_activated_messengers);
538 538
 	}
539 539
 
540 540
 
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 		//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
557 557
 		// list of activated messengers as set via the admin
558 558
 		// note calling `get_active_messengers_options` also initializes the _active_message_types property.
559
-		$this->get_active_messengers_option( true );
560
-		$this->ensure_messengers_are_active( array(), false, true );
559
+		$this->get_active_messengers_option(true);
560
+		$this->ensure_messengers_are_active(array(), false, true);
561 561
 		$this->update_active_messengers_option();
562 562
 		$this->update_has_activated_messengers_option();
563 563
 	}
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
 	 * @param bool   $update_option  Whether to update the option in the db or not.
576 576
 	 * @return boolean true if either already active or successfully activated.
577 577
 	 */
578
-	public function ensure_messenger_is_active( $messenger_name, $update_option = true ) {
579
-		if ( ! isset( $this->_active_messengers[ $messenger_name ] ) ) {
578
+	public function ensure_messenger_is_active($messenger_name, $update_option = true) {
579
+		if ( ! isset($this->_active_messengers[$messenger_name])) {
580 580
 			try {
581
-				$this->activate_messenger( $messenger_name, array(), $update_option );
582
-			} catch( EE_Error $e ) {
581
+				$this->activate_messenger($messenger_name, array(), $update_option);
582
+			} catch (EE_Error $e) {
583 583
 				EE_Error::add_error(
584 584
 					$e->getMessage(),
585 585
 					__FILE__,
@@ -606,25 +606,25 @@  discard block
 block discarded – undo
606 606
 	 *                                and a messenger is indicated as active, but is NOT installed, then it will automatically be
607 607
 	 *                                deactivated.
608 608
 	 */
609
-	public function ensure_messengers_are_active( $messenger_names = array(), $update_option = true, $verify = false ) {
610
-		$messenger_names = empty( $messenger_names ) ? array_keys( $this->_active_message_types ) : $messenger_names;
609
+	public function ensure_messengers_are_active($messenger_names = array(), $update_option = true, $verify = false) {
610
+		$messenger_names = empty($messenger_names) ? array_keys($this->_active_message_types) : $messenger_names;
611 611
 
612 612
 		$not_installed = array();
613
-		foreach( $messenger_names as $messenger_name ) {
614
-			if ( $verify && ! $this->messenger_collection()->has_by_name( $messenger_name ) ) {
613
+		foreach ($messenger_names as $messenger_name) {
614
+			if ($verify && ! $this->messenger_collection()->has_by_name($messenger_name)) {
615 615
 				$not_installed[] = $messenger_name;
616
-				$this->deactivate_messenger( $messenger_name );
616
+				$this->deactivate_messenger($messenger_name);
617 617
 				continue;
618 618
 			}
619
-			$this->ensure_messenger_is_active( $messenger_name, $update_option );
619
+			$this->ensure_messenger_is_active($messenger_name, $update_option);
620 620
 		}
621 621
 
622
-		if ( ! empty( $not_installed_messenger ) ) {
622
+		if ( ! empty($not_installed_messenger)) {
623 623
 			EE_Error::add_error(
624 624
 				sprintf(
625
-					__( 'The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso' ),
625
+					__('The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso'),
626 626
 					'<br />',
627
-					implode( ', ', $not_installed_messenger )
627
+					implode(', ', $not_installed_messenger)
628 628
 				),
629 629
 				__FILE__, __FUNCTION__, __LINE__
630 630
 			);
@@ -643,18 +643,18 @@  discard block
 block discarded – undo
643 643
 	 * @return bool  Returns true if already is active or if was activated successfully.
644 644
 	 * @throws \EE_Error
645 645
 	 */
646
-	public function ensure_message_type_is_active( $message_type_name, $messenger_name, $update_option = true ) {
646
+	public function ensure_message_type_is_active($message_type_name, $messenger_name, $update_option = true) {
647 647
 		// grab the messenger to work with.
648
-		$messenger = $this->valid_messenger( $messenger_name );
649
-		if ( $this->valid_message_type_for_messenger( $messenger, $message_type_name ) ) {
648
+		$messenger = $this->valid_messenger($messenger_name);
649
+		if ($this->valid_message_type_for_messenger($messenger, $message_type_name)) {
650 650
 			//ensure messenger is active (that's an inherent coupling between active message types and the
651 651
 			//messenger they are being activated for.
652 652
 			try {
653
-				if ( ! $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
653
+				if ( ! $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
654 654
 					//all is good so let's just get it active
655
-					$this->activate_messenger( $messenger_name, array( $message_type_name ), $update_option );
655
+					$this->activate_messenger($messenger_name, array($message_type_name), $update_option);
656 656
 				}
657
-			} catch( EE_Error $e ) {
657
+			} catch (EE_Error $e) {
658 658
 				EE_Error::add_error(
659 659
 					$e->getMessage(),
660 660
 					__FILE__,
@@ -678,14 +678,14 @@  discard block
 block discarded – undo
678 678
 	 * @param string $messenger_name      The name of the messenger that the message types are to be activated on.
679 679
 	 * @param bool   $update_option       Whether to persist the activation to the database or not (default true).
680 680
 	 */
681
-	public function ensure_message_types_are_active( $message_type_names, $messenger_name, $update_option = true ) {
681
+	public function ensure_message_types_are_active($message_type_names, $messenger_name, $update_option = true) {
682 682
 		$message_type_names = (array) $message_type_names;
683
-		foreach ( $message_type_names as $message_type_name ) {
683
+		foreach ($message_type_names as $message_type_name) {
684 684
 			// note, intentionally not updating option here because we're in a loop.
685 685
 			// We'll follow the instructions of the incoming $update_option argument after the loop.
686
-			$this->ensure_message_type_is_active( $message_type_name, $messenger_name, false );
686
+			$this->ensure_message_type_is_active($message_type_name, $messenger_name, false);
687 687
 		}
688
-		if ( $update_option ) {
688
+		if ($update_option) {
689 689
 			$this->update_active_messengers_option();
690 690
 			$this->update_has_activated_messengers_option();
691 691
 		}
@@ -712,24 +712,24 @@  discard block
 block discarded – undo
712 712
 	) {
713 713
 		$templates = array();
714 714
 		// grab the messenger to work with.
715
-		$messenger = $this->messenger_collection()->get_by_info( $messenger_name );
715
+		$messenger = $this->messenger_collection()->get_by_info($messenger_name);
716 716
 		// it's inactive. Activate it.
717
-		if ( $messenger instanceof EE_messenger ) {
718
-			$this->_active_messengers[ $messenger->name ] = $messenger;
717
+		if ($messenger instanceof EE_messenger) {
718
+			$this->_active_messengers[$messenger->name] = $messenger;
719 719
 			//activate incoming message types set to be activated with messenger.
720
-			$message_type_names = $this->_activate_message_types( $messenger, $message_type_names );
720
+			$message_type_names = $this->_activate_message_types($messenger, $message_type_names);
721 721
 			// setup any initial settings for the messenger if necessary.
722
-			$this->add_settings_for_messenger( $messenger->name );
723
-			if ( $update_active_messengers_option ) {
722
+			$this->add_settings_for_messenger($messenger->name);
723
+			if ($update_active_messengers_option) {
724 724
 				$this->update_active_messengers_option();
725 725
 				$this->update_has_activated_messengers_option();
726 726
 			}
727 727
 			//generate new templates if necessary and ensure all related templates that are already in the database are
728 728
 			//marked active.  Note, this will also deactivate a message type for a messenger if the template
729 729
 			//cannot be successfully created during its attempt (only happens for global template attempts).
730
-			if ( ! empty( $message_type_names ) ) {
731
-				$templates = EEH_MSG_Template::generate_new_templates( $messenger->name, $message_type_names, 0, true );
732
-				EEH_MSG_Template::update_to_active( array( $messenger->name ), $message_type_names );
730
+			if ( ! empty($message_type_names)) {
731
+				$templates = EEH_MSG_Template::generate_new_templates($messenger->name, $message_type_names, 0, true);
732
+				EEH_MSG_Template::update_to_active(array($messenger->name), $message_type_names);
733 733
 			}
734 734
 		}
735 735
 		return $templates;
@@ -748,29 +748,29 @@  discard block
 block discarded – undo
748 748
 	 *
749 749
 	 * @return array
750 750
 	 */
751
-	protected function _activate_message_types( EE_messenger $messenger, $message_type_names = array() ) {
751
+	protected function _activate_message_types(EE_messenger $messenger, $message_type_names = array()) {
752 752
 		//If $message_type_names is empty, AND $this->_active_message_types is empty, then that means
753 753
 		//things have never been initialized (which should happen on EEH_Activation::generate_message_templates).
754 754
 		//So ONLY then do we need to actually grab defaults and cycle through them.  Otherwise we
755 755
 		//only override _active_message_types when an explicit array of $message_type_names has been provided.
756
-		$message_type_names = empty( $message_type_names ) && ! isset( $this->_active_message_types[ $messenger->name ] )
756
+		$message_type_names = empty($message_type_names) && ! isset($this->_active_message_types[$messenger->name])
757 757
 			? $messenger->get_default_message_types()
758 758
 			: (array) $message_type_names;
759 759
 
760 760
 		//now we ALWAYS need to make sure that the messenger is active for the message types we're activating!
761
-		if ( ! isset( $this->_active_message_types[ $messenger->name ] ) ) {
762
-			$this->_active_message_types[ $messenger->name ]['settings'] = array();
761
+		if ( ! isset($this->_active_message_types[$messenger->name])) {
762
+			$this->_active_message_types[$messenger->name]['settings'] = array();
763 763
 		}
764 764
 
765
-		if ( $message_type_names ) {
765
+		if ($message_type_names) {
766 766
 			// cycle thru message types
767
-			foreach ( $message_type_names as $message_type_name ) {
767
+			foreach ($message_type_names as $message_type_name) {
768 768
 				//only register the message type as active IF it isn't already active
769 769
 				//and if its actually installed.
770 770
 				if (
771
-					! $this->is_message_type_active_for_messenger( $messenger->name, $message_type_name )
771
+					! $this->is_message_type_active_for_messenger($messenger->name, $message_type_name)
772 772
 				) {
773
-					$this->add_settings_for_message_type( $messenger->name, $message_type_name );
773
+					$this->add_settings_for_message_type($messenger->name, $message_type_name);
774 774
 					$this->_set_messenger_has_activated_message_type(
775 775
 						$messenger,
776 776
 						$message_type_name
@@ -793,24 +793,24 @@  discard block
 block discarded – undo
793 793
 	 * @param  string       $message_type_name The name of the message type adding the settings for
794 794
 	 * @param  array        $new_settings     Any new settings being set for the message type and messenger
795 795
 	 */
796
-	public function add_settings_for_message_type( $messenger_name, $message_type_name, $new_settings = array() ) {
796
+	public function add_settings_for_message_type($messenger_name, $message_type_name, $new_settings = array()) {
797 797
 		// get installed message type from collection
798
-		$message_type = $this->message_type_collection()->get_by_info( $message_type_name );
799
-		$existing_settings = $this->get_message_type_settings_for_messenger( $messenger_name, $message_type_name );
798
+		$message_type = $this->message_type_collection()->get_by_info($message_type_name);
799
+		$existing_settings = $this->get_message_type_settings_for_messenger($messenger_name, $message_type_name);
800 800
 		//we need to setup any initial settings for message types
801
-		if ( $message_type instanceof EE_message_type ) {
801
+		if ($message_type instanceof EE_message_type) {
802 802
 			$default_settings = $message_type->get_admin_settings_fields();
803
-			foreach ( $default_settings as $field => $values ) {
804
-				if ( isset( $new_settings[ $field ] ) ) {
805
-					$existing_settings[ $field ] = $new_settings[ $field ];
803
+			foreach ($default_settings as $field => $values) {
804
+				if (isset($new_settings[$field])) {
805
+					$existing_settings[$field] = $new_settings[$field];
806 806
 					continue;
807 807
 				}
808
-				if ( ! isset( $existing_settings[ $field ] ) ) {
809
-					$existing_settings[ $field ] = $values['default'];
808
+				if ( ! isset($existing_settings[$field])) {
809
+					$existing_settings[$field] = $values['default'];
810 810
 				}
811 811
 			}
812 812
 		}
813
-		$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] = $existing_settings;
813
+		$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'] = $existing_settings;
814 814
 	}
815 815
 
816 816
 
@@ -823,20 +823,20 @@  discard block
 block discarded – undo
823 823
 	 * @param \EE_messenger $messenger
824 824
 	 * @param string        $message_type_name
825 825
 	 */
826
-	protected function _set_messenger_has_activated_message_type( EE_messenger $messenger, $message_type_name ) {
826
+	protected function _set_messenger_has_activated_message_type(EE_messenger $messenger, $message_type_name) {
827 827
 
828 828
 		//if _has_activated_messengers_and_message_types is empty then lets ensure its initialized
829
-		if ( empty( $this->_has_activated_messengers_and_message_types ) ) {
829
+		if (empty($this->_has_activated_messengers_and_message_types)) {
830 830
 			$this->get_has_activated_messengers_option();
831 831
 		}
832 832
 
833 833
 		// make sure this messenger has a record in the has_activated array
834
-		if ( ! isset( $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
835
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ] = array();
834
+		if ( ! isset($this->_has_activated_messengers_and_message_types[$messenger->name])) {
835
+			$this->_has_activated_messengers_and_message_types[$messenger->name] = array();
836 836
 		}
837 837
 		// check if message type has already been added
838
-		if ( ! in_array( $message_type_name, $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
839
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ][] = $message_type_name;
838
+		if ( ! in_array($message_type_name, $this->_has_activated_messengers_and_message_types[$messenger->name])) {
839
+			$this->_has_activated_messengers_and_message_types[$messenger->name][] = $message_type_name;
840 840
 		}
841 841
 	}
842 842
 
@@ -851,20 +851,20 @@  discard block
 block discarded – undo
851 851
 	 * @param string        $messenger_name The name of the messenger the settings is being added for.
852 852
 	 * @param array         $new_settings   An array of settings to update the existing settings.
853 853
 	 */
854
-	public function add_settings_for_messenger( $messenger_name, $new_settings = array() ) {
855
-		$messenger = $this->get_messenger( $messenger_name );
856
-		if ( $messenger instanceof EE_messenger ) {
854
+	public function add_settings_for_messenger($messenger_name, $new_settings = array()) {
855
+		$messenger = $this->get_messenger($messenger_name);
856
+		if ($messenger instanceof EE_messenger) {
857 857
 			$msgr_settings = $messenger->get_admin_settings_fields();
858
-			if ( ! empty( $msgr_settings ) ) {
859
-				foreach ( $msgr_settings as $field => $value ) {
858
+			if ( ! empty($msgr_settings)) {
859
+				foreach ($msgr_settings as $field => $value) {
860 860
 					//is there a new setting for this?
861
-					if ( isset( $new_settings[ $field ] ) ) {
862
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $new_settings[ $field ];
861
+					if (isset($new_settings[$field])) {
862
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $new_settings[$field];
863 863
 						continue;
864 864
 					}
865 865
 					//only set the default if it isn't already set.
866
-					if ( ! isset( $this->_active_message_types[ $messenger->name ]['settings'][ $field ] ) ) {
867
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $value;
866
+					if ( ! isset($this->_active_message_types[$messenger->name]['settings'][$field])) {
867
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $value;
868 868
 					}
869 869
 				}
870 870
 			}
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 	 * @param  string|EE_messenger $messenger_name name of messenger
880 880
 	 * @return void
881 881
 	 */
882
-	public function deactivate_messenger( $messenger_name ) {
882
+	public function deactivate_messenger($messenger_name) {
883 883
         $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
884
+        if ($messenger_name instanceof EE_messenger) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887
-		unset( $this->_active_messengers[ $messenger_name ] );
888
-		unset( $this->_active_message_types[ $messenger_name ] );
889
-		$this->_message_template_group_model->deactivate_message_template_groups_for( $messenger_name );
887
+		unset($this->_active_messengers[$messenger_name]);
888
+		unset($this->_active_message_types[$messenger_name]);
889
+		$this->_message_template_group_model->deactivate_message_template_groups_for($messenger_name);
890 890
 		$this->update_active_messengers_option();
891 891
 	}
892 892
 
@@ -896,22 +896,22 @@  discard block
 block discarded – undo
896 896
 	 *
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899
-	public function deactivate_message_type( $message_type_name ) {
899
+	public function deactivate_message_type($message_type_name) {
900 900
         $this->_initialize_collections();
901
-		if ( $message_type_name instanceof EE_message_type ) {
901
+		if ($message_type_name instanceof EE_message_type) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
904
-		foreach ( $this->_active_message_types as $messenger_name => $settings ) {
904
+		foreach ($this->_active_message_types as $messenger_name => $settings) {
905 905
 			unset(
906
-				$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]
906
+				$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]
907 907
 			);
908 908
 
909 909
 			//we always record (even on deactivation) that a message type has been activated because there should at
910 910
 			//least be a record in the "has_activated" option that it WAS active at one point.
911
-			$messenger = $this->get_messenger( $messenger_name );
912
-			$this->_set_messenger_has_activated_message_type( $messenger, $message_type_name );
911
+			$messenger = $this->get_messenger($messenger_name);
912
+			$this->_set_messenger_has_activated_message_type($messenger, $message_type_name);
913 913
 		}
914
-		$this->_message_template_group_model->deactivate_message_template_groups_for( '', $message_type_name );
914
+		$this->_message_template_group_model->deactivate_message_template_groups_for('', $message_type_name);
915 915
 		$this->update_active_messengers_option();
916 916
 		$this->update_has_activated_messengers_option();
917 917
 	}
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
 	 * @param string $message_type_name  Name of message type being deactivated.
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929
-	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
929
+	public function deactivate_message_type_for_messenger($message_type_name, $messenger_name) {
930 930
         $this->_initialize_collections();
931
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932
-			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
931
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
932
+			unset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
933 933
 		}
934
-		$this->_message_template_group_model->deactivate_message_template_groups_for( array( $messenger_name ), array( $message_type_name ) );
934
+		$this->_message_template_group_model->deactivate_message_template_groups_for(array($messenger_name), array($message_type_name));
935 935
 		$this->update_active_messengers_option();
936 936
 	}
937 937
 
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 	 *
949 949
 	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
950 950
 	 */
951
-	public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) {
951
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) {
952 952
 		//get the $messengers the message type says it can be used with.
953
-		foreach ( $message_type->with_messengers() as $generating_messenger => $secondary_messengers ) {
953
+		foreach ($message_type->with_messengers() as $generating_messenger => $secondary_messengers) {
954 954
 			if (
955 955
 				$messenger->name === $generating_messenger
956
-				&& $this->is_message_type_active_for_messenger( $messenger->name, $message_type->name )
956
+				&& $this->is_message_type_active_for_messenger($messenger->name, $message_type->name)
957 957
 			) {
958 958
 				return true;
959 959
 			}
@@ -990,25 +990,25 @@  discard block
 block discarded – undo
990 990
 	 *                           or all contexts indexed by message type.
991 991
 	 * @return array
992 992
 	 */
993
-	public function get_all_contexts( $slugs_only = true ) {
993
+	public function get_all_contexts($slugs_only = true) {
994 994
 		$key = $slugs_only ? 'slugs' : 'all';
995 995
 		// check if contexts has been setup yet.
996
-		if ( empty( $this->_contexts[ $key ] ) ) {
996
+		if (empty($this->_contexts[$key])) {
997 997
 			// So let's get all active message type objects and loop through to get all unique contexts
998
-			foreach ( $this->get_active_message_type_objects() as $message_type ) {
999
-				if ( $message_type instanceof EE_message_type ) {
998
+			foreach ($this->get_active_message_type_objects() as $message_type) {
999
+				if ($message_type instanceof EE_message_type) {
1000 1000
 					$message_type_contexts = $message_type->get_contexts();
1001
-					if ( $slugs_only ) {
1002
-						foreach ( $message_type_contexts as $context => $context_details ) {
1003
-							$this->_contexts[ $key ][ $context ] = $context_details[ 'label' ];
1001
+					if ($slugs_only) {
1002
+						foreach ($message_type_contexts as $context => $context_details) {
1003
+							$this->_contexts[$key][$context] = $context_details['label'];
1004 1004
 						}
1005 1005
 					} else {
1006
-						$this->_contexts[ $key ][ $message_type->name ] = $message_type_contexts;
1006
+						$this->_contexts[$key][$message_type->name] = $message_type_contexts;
1007 1007
 					}
1008 1008
 				}
1009 1009
 			}
1010 1010
 		}
1011
-		return ! empty( $this->_contexts[ $key ] ) ? $this->_contexts[ $key ] : array();
1011
+		return ! empty($this->_contexts[$key]) ? $this->_contexts[$key] : array();
1012 1012
 	}
1013 1013
 
1014 1014
 
@@ -1027,9 +1027,9 @@  discard block
 block discarded – undo
1027 1027
 		$installed_message_types = $this->installed_message_types();
1028 1028
 		$all_message_types_valid = true;
1029 1029
 		//loop through list of active message types and verify they are installed.
1030
-		foreach( $list_of_active_message_type_names as $message_type_name ) {
1031
-			if ( ! isset( $installed_message_types[$message_type_name] ) ) {
1032
-				$this->deactivate_message_type( $message_type_name );
1030
+		foreach ($list_of_active_message_type_names as $message_type_name) {
1031
+			if ( ! isset($installed_message_types[$message_type_name])) {
1032
+				$this->deactivate_message_type($message_type_name);
1033 1033
 				$all_message_types_valid = false;
1034 1034
 			}
1035 1035
 		}
@@ -1048,10 +1048,10 @@  discard block
 block discarded – undo
1048 1048
 	 * @param $messenger_name
1049 1049
 	 * @return bool
1050 1050
 	 */
1051
-	public function has_message_type_been_activated_for_messenger( $message_type_name, $messenger_name ) {
1051
+	public function has_message_type_been_activated_for_messenger($message_type_name, $messenger_name) {
1052 1052
 		$has_activated = $this->get_has_activated_messengers_option();
1053
-		return isset( $has_activated[ $messenger_name ] )
1054
-			&& in_array( $message_type_name, $has_activated[ $messenger_name ] );
1053
+		return isset($has_activated[$messenger_name])
1054
+			&& in_array($message_type_name, $has_activated[$messenger_name]);
1055 1055
 	}
1056 1056
 }
1057 1057
 // End of file EE_Message_Resource_Manager.lib.php
Please login to merge, or discard this patch.