Completed
Branch BUG-9647-cpt-queries (303307)
by
unknown
31:50 queued 15:24
created
modules/ical/EED_Ical.module.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @return EED_Ical
33 33
 	 */
34 34
 	public static function instance() {
35
-		return parent::get_instance( __CLASS__ );
35
+		return parent::get_instance(__CLASS__);
36 36
 	}
37 37
 
38 38
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function set_hooks() {
47 47
 		// create download buttons
48
-		add_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10, 2 );
48
+		add_filter('FHEE__espresso_list_of_event_dates__datetime_html', array('EED_Ical', 'generate_add_to_iCal_button'), 10, 2);
49 49
 		 // process ics download request
50
-		EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' );
50
+		EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file');
51 51
 	}
52 52
 
53 53
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @param    WP $WP
71 71
 	 * @return    void
72 72
 	 */
73
-	public function run( $WP ) {}
73
+	public function run($WP) {}
74 74
 
75 75
 
76 76
 
@@ -82,30 +82,30 @@  discard block
 block discarded – undo
82 82
 	 * @param $datetime
83 83
 	 * @return    string
84 84
 	 */
85
-	public static function generate_add_to_iCal_button( $html, $datetime ) {
85
+	public static function generate_add_to_iCal_button($html, $datetime) {
86 86
 		// first verify a proper datetime object has been received
87
-		if ( $datetime instanceof EE_Datetime ) {
87
+		if ($datetime instanceof EE_Datetime) {
88 88
 			// set whether a link or submit button is shown
89
-			$iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' );
89
+			$iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit');
90 90
 			// generate a link to the route we registered in set_hooks()
91
-			$URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() );
91
+			$URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url());
92 92
 			// what type ?
93
-			switch ( $iCal_type ) {
93
+			switch ($iCal_type) {
94 94
 				// submit buttons appear as buttons and are very compatible with a theme's style
95 95
 				case 'submit' :
96
-					$html .= '<form id="download-iCal-frm-' . $datetime->ID() . '" class="download-iCal-frm" action="' . $URL . '" method="post" >';
97
-					$html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>';
96
+					$html .= '<form id="download-iCal-frm-'.$datetime->ID().'" class="download-iCal-frm" action="'.$URL.'" method="post" >';
97
+					$html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="'.__('Add to iCal Calendar', 'event_espresso').'"/>';
98 98
 					$html .= '</form>';
99 99
 					break;
100 100
 				// buttons are just links that have been styled to appear as buttons, but may not be blend with a theme as well as submit buttons
101 101
 				case 'button' :
102
-					$html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">';
102
+					$html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">';
103 103
 					$html .= ' <span class="dashicons dashicons-calendar"></span>';
104 104
 					$html .= '</a>';
105 105
 					break;
106 106
 				// links are just links that use the calendar dashicon
107 107
 				case 'icon' :
108
-					$html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">';
108
+					$html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">';
109 109
 					$html .= ' <span class="dashicons dashicons-calendar"></span>';
110 110
 					$html .= '</a>';
111 111
 					break;
@@ -123,72 +123,72 @@  discard block
 block discarded – undo
123 123
 	 *  @return 	void
124 124
 	 */
125 125
 	public static function download_ics_file() {
126
-		if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) {
127
-			$DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' ));
128
-			$datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID );
129
-			if ( $datetime instanceof EE_Datetime ) {
126
+		if (EE_Registry::instance()->REQ->is_set('ics_id')) {
127
+			$DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id'));
128
+			$datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID);
129
+			if ($datetime instanceof EE_Datetime) {
130 130
 				// get related event, venues, and event categories
131 131
 				$event = $datetime->event();
132 132
 				// get related category Term object and it's name
133 133
 				$category = $event->first_event_category();
134
-				if ( $category instanceof EE_Term ) {
134
+				if ($category instanceof EE_Term) {
135 135
 					$category = $category->name();
136 136
 				}
137 137
 				$location = '';
138 138
 				// get first related venue and convert to CSV string
139
-				$venue = $event->venues(array( 'limit'=>1 ));
140
-				if ( is_array( $venue ) && ! empty( $venue )) {
141
-					$venue = array_shift( $venue );
142
-					if ( $venue instanceof EE_Venue ) {
143
-						$location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE );
139
+				$venue = $event->venues(array('limit'=>1));
140
+				if (is_array($venue) && ! empty($venue)) {
141
+					$venue = array_shift($venue);
142
+					if ($venue instanceof EE_Venue) {
143
+						$location = espresso_venue_raw_address('inline', $venue->ID(), FALSE);
144 144
 					}
145 145
 				}
146 146
 				// set variables, escape strings, convert timestamps to ics format, etc
147
-				$filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics';
148
-				$organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name );
149
-				$UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() ));
150
-				$org_email = EED_Ical::_escape_ICal_data( $datetime->ID() );
151
-				$timestamp = date( EED_Ical::iCal_datetime_format );
152
-				$location = EED_Ical::_escape_ICal_data( $location );
153
-				$summary = EED_Ical::_escape_ICal_data( $event->name() );
154
-				$description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() ));
147
+				$filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics';
148
+				$organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name);
149
+				$UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID()));
150
+				$org_email = EED_Ical::_escape_ICal_data($datetime->ID());
151
+				$timestamp = date(EED_Ical::iCal_datetime_format);
152
+				$location = EED_Ical::_escape_ICal_data($location);
153
+				$summary = EED_Ical::_escape_ICal_data($event->name());
154
+				$description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description()));
155 155
 				$status = $datetime->get_active_status();
156 156
 				$status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed';
157
-				$status = EED_Ical::_escape_ICal_data( $status );
158
-				$categories = EED_Ical::_escape_ICal_data( $category );
159
-				$url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() ));
160
-				$dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() ));
161
-				$dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() ));
157
+				$status = EED_Ical::_escape_ICal_data($status);
158
+				$categories = EED_Ical::_escape_ICal_data($category);
159
+				$url = EED_Ical::_escape_ICal_data(get_permalink($event->ID()));
160
+				$dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start()));
161
+				$dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end()));
162 162
 				// set headers
163
-				header( 'Content-type: text/calendar; charset=utf-8' );
164
-				header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
165
-				header( 'Cache-Control: private, max-age=0, must-revalidate' );
166
-				header( 'Pragma: public' );
167
-				header( 'Content-Type: application/octet-stream' );
168
-				header( 'Content-Type: application/force-download' );
169
-				header( 'Cache-Control: no-cache, must-revalidate' );
170
-				header( 'Content-Transfer-Encoding: binary' );
171
-				header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date
172
-				ini_set( 'zlib.output_compression', '0' );
163
+				header('Content-type: text/calendar; charset=utf-8');
164
+				header('Content-Disposition: attachment; filename="'.$filename.'"');
165
+				header('Cache-Control: private, max-age=0, must-revalidate');
166
+				header('Pragma: public');
167
+				header('Content-Type: application/octet-stream');
168
+				header('Content-Type: application/force-download');
169
+				header('Cache-Control: no-cache, must-revalidate');
170
+				header('Content-Transfer-Encoding: binary');
171
+				header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date
172
+				ini_set('zlib.output_compression', '0');
173 173
 				// echo the output
174
-				echo "BEGIN:VCALENDAR" . PHP_EOL;
175
-				echo "VERSION:2.0" . PHP_EOL;
176
-				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL;
177
-				echo "CALSCALE:GREGORIAN" . PHP_EOL;
178
-				echo "BEGIN:VEVENT" . PHP_EOL;
179
-				echo "UID:{$UID}" . PHP_EOL;
180
-				echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL;
181
-				echo "DTSTAMP:{$timestamp}" . PHP_EOL;
182
-				echo "LOCATION:{$location}" . PHP_EOL;
183
-				echo "SUMMARY:{$summary}" . PHP_EOL;
184
-				echo "DESCRIPTION:{$description}" . PHP_EOL;
185
-				echo "STATUS:{$status}" . PHP_EOL;
186
-				echo "CATEGORIES:{$categories}" . PHP_EOL;
187
-				echo "URL;VALUE=URI:{$url}" . PHP_EOL;
188
-				echo "DTSTART:{$dtt_start}" . PHP_EOL;
189
-				echo "DTEND:{$dtt_end}" . PHP_EOL;
190
-				echo "END:VEVENT" . PHP_EOL;
191
-				echo "END:VCALENDAR" . PHP_EOL;
174
+				echo "BEGIN:VCALENDAR".PHP_EOL;
175
+				echo "VERSION:2.0".PHP_EOL;
176
+				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL;
177
+				echo "CALSCALE:GREGORIAN".PHP_EOL;
178
+				echo "BEGIN:VEVENT".PHP_EOL;
179
+				echo "UID:{$UID}".PHP_EOL;
180
+				echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL;
181
+				echo "DTSTAMP:{$timestamp}".PHP_EOL;
182
+				echo "LOCATION:{$location}".PHP_EOL;
183
+				echo "SUMMARY:{$summary}".PHP_EOL;
184
+				echo "DESCRIPTION:{$description}".PHP_EOL;
185
+				echo "STATUS:{$status}".PHP_EOL;
186
+				echo "CATEGORIES:{$categories}".PHP_EOL;
187
+				echo "URL;VALUE=URI:{$url}".PHP_EOL;
188
+				echo "DTSTART:{$dtt_start}".PHP_EOL;
189
+				echo "DTEND:{$dtt_end}".PHP_EOL;
190
+				echo "END:VEVENT".PHP_EOL;
191
+				echo "END:VCALENDAR".PHP_EOL;
192 192
 			}
193 193
 		}
194 194
 		die();
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 	 *  	@param	string $string
204 204
 	 *  	@return	string
205 205
 	 */
206
-	private static function _escape_ICal_data( $string = '' ) {
207
-		return preg_replace( '/([\,;])/', '\\\$1', $string );
206
+	private static function _escape_ICal_data($string = '') {
207
+		return preg_replace('/([\,;])/', '\\\$1', $string);
208 208
 	}
209 209
 
210 210
 	/**
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 	 *  	@param	string $description
215 215
 	 *  	@return	string
216 216
 	 */
217
-	private static function _escape_ICal_description( $description = '' ) {
217
+	private static function _escape_ICal_description($description = '') {
218 218
 			
219 219
 			//Escape spcial chars within the decription
220
-			$description = EED_Ical::_escape_ICal_data( $description );
220
+			$description = EED_Ical::_escape_ICal_data($description);
221 221
 
222 222
 		    //Remove line breaks and output in iCal format
223
-		    $description = str_replace( array( "\r\n", "\n"), '\n', $description );
223
+		    $description = str_replace(array("\r\n", "\n"), '\n', $description);
224 224
 
225 225
 		return $description;
226 226
 	}
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_SPCO_JSON_Response.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -107,71 +107,71 @@  discard block
 block discarded – undo
107 107
 	public function __toString() {
108 108
 		$JSON_response = array();
109 109
 		// grab notices
110
-		$notices = EE_Error::get_notices( FALSE );
111
-		$this->set_attention( isset( $notices['attention'] ) ? $notices['attention'] : '' );
112
-		$this->set_errors( isset( $notices['errors'] ) ? $notices['errors'] : '' );
113
-		$this->set_success( isset( $notices['success'] ) ? $notices['success'] : '' );
110
+		$notices = EE_Error::get_notices(FALSE);
111
+		$this->set_attention(isset($notices['attention']) ? $notices['attention'] : '');
112
+		$this->set_errors(isset($notices['errors']) ? $notices['errors'] : '');
113
+		$this->set_success(isset($notices['success']) ? $notices['success'] : '');
114 114
 		// add notices to JSON response, but only if they exist
115
-		if ( $this->attention() ) {
115
+		if ($this->attention()) {
116 116
 			$JSON_response['attention'] = $this->attention();
117 117
 		}
118
-		if ( $this->errors() ) {
118
+		if ($this->errors()) {
119 119
 			$JSON_response['errors'] = $this->errors();
120 120
 		}
121
-		if ( $this->unexpected_errors() ) {
121
+		if ($this->unexpected_errors()) {
122 122
 			$JSON_response['unexpected_errors'] = $this->unexpected_errors();
123 123
 		}
124
-		if ( $this->success() ) {
124
+		if ($this->success()) {
125 125
 			$JSON_response['success'] = $this->success();
126 126
 		}
127 127
 		// but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked
128
-		if ( ! isset( $JSON_response[ 'attention' ] ) && ! isset( $JSON_response[ 'errors' ] ) && ! isset( $JSON_response[ 'success' ] ) ) {
128
+		if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) {
129 129
 			$JSON_response['success'] = null;
130 130
 		}
131 131
 		// set redirect_url, IF it exists
132
-		if ( $this->redirect_url() ) {
132
+		if ($this->redirect_url()) {
133 133
 			$JSON_response['redirect_url'] = $this->redirect_url();
134 134
 		}
135 135
 		// set registration_time_limit, IF it exists
136
-		if ( $this->registration_time_limit() ) {
136
+		if ($this->registration_time_limit()) {
137 137
 			$JSON_response['registration_time_limit'] = $this->registration_time_limit();
138 138
 		}
139 139
 		// set payment_amount, IF it exists
140
-		if ( $this->payment_amount() !== null ) {
141
-			$JSON_response[ 'payment_amount' ] = $this->payment_amount();
140
+		if ($this->payment_amount() !== null) {
141
+			$JSON_response['payment_amount'] = $this->payment_amount();
142 142
 		}
143 143
 		// grab generic return data
144 144
 		$return_data = $this->return_data();
145 145
 		// add billing form validation rules
146
-		if ( $this->validation_rules() ) {
146
+		if ($this->validation_rules()) {
147 147
 			$return_data['validation_rules'] = $this->validation_rules();
148 148
 		}
149 149
 		// set reg_step_html, IF it exists
150
-		if ( $this->reg_step_html() ) {
150
+		if ($this->reg_step_html()) {
151 151
 			$return_data['reg_step_html'] = $this->reg_step_html();
152 152
 		}
153 153
 		// set method of payment, IF it exists
154
-		if ( $this->method_of_payment() ) {
154
+		if ($this->method_of_payment()) {
155 155
 			$return_data['method_of_payment'] = $this->method_of_payment();
156 156
 		}
157 157
 		// set "plz_select_method_of_payment" message, IF it exists
158
-		if ( $this->plz_select_method_of_payment() ) {
158
+		if ($this->plz_select_method_of_payment()) {
159 159
 			$return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment();
160 160
 		}
161 161
 		// set redirect_form, IF it exists
162
-		if ( $this->redirect_form() ) {
162
+		if ($this->redirect_form()) {
163 163
 			$return_data['redirect_form'] = $this->redirect_form();
164 164
 		}
165 165
 		// and finally, add return_data array to main JSON response array, IF it contains anything
166 166
 		// why did we add some of the above properties to the return data array?
167 167
 		// because it is easier and cleaner in the Javascript to deal with this way
168
-		if ( ! empty( $return_data )) {
168
+		if ( ! empty($return_data)) {
169 169
 			$JSON_response['return_data'] = $return_data;
170 170
 		}
171 171
 		// filter final array
172
-		$JSON_response = apply_filters( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response );
172
+		$JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response);
173 173
 		// return encoded array
174
-		return json_encode( $JSON_response );
174
+		return json_encode($JSON_response);
175 175
 	}
176 176
 
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @param string $attention
181 181
 	 */
182
-	public function set_attention( $attention ) {
182
+	public function set_attention($attention) {
183 183
 		$this->_attention = $attention;
184 184
 	}
185 185
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	/**
198 198
 	 * @param string $errors
199 199
 	 */
200
-	public function set_errors( $errors ) {
200
+	public function set_errors($errors) {
201 201
 		$this->_errors = $errors;
202 202
 	}
203 203
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	/**
225 225
 	 * @param string $unexpected_errors
226 226
 	 */
227
-	public function set_unexpected_errors( $unexpected_errors ) {
227
+	public function set_unexpected_errors($unexpected_errors) {
228 228
 		$this->_unexpected_errors = $unexpected_errors;
229 229
 	}
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	/**
234 234
 	 * @param string $success
235 235
 	 */
236
-	public function set_success( $success ) {
236
+	public function set_success($success) {
237 237
 		$this->_success = $success;
238 238
 	}
239 239
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	/**
252 252
 	 * @param string $method_of_payment
253 253
 	 */
254
-	public function set_method_of_payment( $method_of_payment ) {
254
+	public function set_method_of_payment($method_of_payment) {
255 255
 		$this->_method_of_payment = $method_of_payment;
256 256
 	}
257 257
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	/**
279 279
 	 * @param float $payment_amount
280 280
 	 */
281
-	public function set_payment_amount( $payment_amount ) {
282
-		$this->_payment_amount = EEH_Money::convert_to_float_from_localized_money( $payment_amount );
281
+	public function set_payment_amount($payment_amount) {
282
+		$this->_payment_amount = EEH_Money::convert_to_float_from_localized_money($payment_amount);
283 283
 	}
284 284
 
285 285
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	/**
288 288
 	 * @param string $next_step_html
289 289
 	 */
290
-	public function set_reg_step_html( $next_step_html ) {
290
+	public function set_reg_step_html($next_step_html) {
291 291
 		$this->_reg_step_html = $next_step_html;
292 292
 	}
293 293
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	/**
306 306
 	 * @param string $redirect_form
307 307
 	 */
308
-	public function set_redirect_form( $redirect_form ) {
308
+	public function set_redirect_form($redirect_form) {
309 309
 		$this->_redirect_form = $redirect_form;
310 310
 	}
311 311
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @return string
316 316
 	 */
317 317
 	public function redirect_form() {
318
-		return ! empty( $this->_redirect_form ) ? $this->_redirect_form : FALSE;
318
+		return ! empty($this->_redirect_form) ? $this->_redirect_form : FALSE;
319 319
 	}
320 320
 
321 321
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	/**
324 324
 	 * @param string $plz_select_method_of_payment
325 325
 	 */
326
-	public function set_plz_select_method_of_payment( $plz_select_method_of_payment ) {
326
+	public function set_plz_select_method_of_payment($plz_select_method_of_payment) {
327 327
 		$this->_plz_select_method_of_payment = $plz_select_method_of_payment;
328 328
 	}
329 329
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	/**
342 342
 	 * @param string $redirect_url
343 343
 	 */
344
-	public function set_redirect_url( $redirect_url ) {
344
+	public function set_redirect_url($redirect_url) {
345 345
 		$this->_redirect_url = $redirect_url;
346 346
 	}
347 347
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	/**
369 369
 	 * @param string $registration_time_limit
370 370
 	 */
371
-	public function set_registration_time_limit( $registration_time_limit ) {
371
+	public function set_registration_time_limit($registration_time_limit) {
372 372
 		$this->_registration_time_limit = $registration_time_limit;
373 373
 	}
374 374
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	/**
378 378
 	 * @param array $return_data
379 379
 	 */
380
-	public function set_return_data( $return_data ) {
381
-		$this->_return_data = array_merge( $this->_return_data, $return_data );
380
+	public function set_return_data($return_data) {
381
+		$this->_return_data = array_merge($this->_return_data, $return_data);
382 382
 	}
383 383
 
384 384
 
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
 	/**
396 396
 	 * @param array $validation_rules
397 397
 	 */
398
-	public function add_validation_rules( $validation_rules = array() ) {
399
-		if ( is_array( $validation_rules ) && ! empty( $validation_rules )) {
400
-			$this->_validation_rules = array_merge( $this->_validation_rules, $validation_rules );
398
+	public function add_validation_rules($validation_rules = array()) {
399
+		if (is_array($validation_rules) && ! empty($validation_rules)) {
400
+			$this->_validation_rules = array_merge($this->_validation_rules, $validation_rules);
401 401
 		}
402 402
 	}
403 403
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @return array | bool
408 408
 	 */
409 409
 	public function validation_rules() {
410
-		return ! empty( $this->_validation_rules ) ? $this->_validation_rules : FALSE;
410
+		return ! empty($this->_validation_rules) ? $this->_validation_rules : FALSE;
411 411
 	}
412 412
 
413 413
 
Please login to merge, or discard this patch.
modules/core_rest_api/EED_Core_Rest_Api.module.php 1 patch
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\core\libraries\rest_api\Calculated_Model_Fields;
3 3
 
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		self::$_field_calculator = new Calculated_Model_Fields();
38
-		return parent::get_instance( __CLASS__ );
38
+		return parent::get_instance(__CLASS__);
39 39
 	}
40 40
 
41 41
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 
66 66
 
67 67
 	public static function set_hooks_both() {
68
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 );
69
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 );
70
-		add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 );
71
-		add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) );
68
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10);
69
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5);
70
+		add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2);
71
+		add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index'));
72 72
 		EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
73 73
 	}
74 74
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * Loads all the hooks which make requests to old versions of the API
87 87
 	 * appear the same as they always did
88 88
 	 */
89
-	public static function set_hooks_for_changes(){
89
+	public static function set_hooks_for_changes() {
90 90
 		self::_set_hooks_for_changes();
91 91
 	}
92 92
 	/**
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
 	 * appear the same as they always did
95 95
 	 */
96 96
 	protected static function _set_hooks_for_changes() {
97
-		$folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false );
98
-		foreach( $folder_contents as $classname_in_namespace => $filepath ) {
97
+		$folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false);
98
+		foreach ($folder_contents as $classname_in_namespace => $filepath) {
99 99
 			//ignore the base parent class
100
-			if( $classname_in_namespace === 'Changes_In_Base' ) {
100
+			if ($classname_in_namespace === 'Changes_In_Base') {
101 101
 				continue;
102 102
 			}
103
-			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
104
-			if ( class_exists( $full_classname )) {
103
+			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace;
104
+			if (class_exists($full_classname)) {
105 105
 				$instance_of_class = new $full_classname;
106
-				if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) {
106
+				if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) {
107 107
 					$instance_of_class->set_hooks();
108 108
 				}
109 109
 			}
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
 	 * so we actually prefer to only do it when an EE plugin is activated or upgraded
117 117
 	 */
118 118
 	public static function register_routes() {
119
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
120
-			foreach( $relative_urls as $endpoint => $routes ) {
121
-				foreach( $routes as $route ) {
119
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
120
+			foreach ($relative_urls as $endpoint => $routes) {
121
+				foreach ($routes as $route) {
122 122
 					register_rest_route(
123 123
 						$namespace,
124 124
 						$endpoint,
125 125
 						array(
126
-							'callback' => $route[ 'callback' ],
127
-							'methods' => $route[ 'methods' ],
128
-							'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(),
126
+							'callback' => $route['callback'],
127
+							'methods' => $route['methods'],
128
+							'args' => isset($route['args']) ? $route['args'] : array(),
129 129
 						)
130 130
 					);
131 131
 				}
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 	 * next time the WP API is used
140 140
 	 */
141 141
 	public static function invalidate_cached_route_data_on_version_change() {
142
-		if( EE_System::instance()->detect_req_type() != EE_System::req_type_normal ) {
142
+		if (EE_System::instance()->detect_req_type() != EE_System::req_type_normal) {
143 143
 			EED_Core_Rest_Api::invalidate_cached_route_data();
144 144
 		}
145
-		foreach( EE_Registry::instance()->addons as $addon ){
146
-			if( $addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal ) {
145
+		foreach (EE_Registry::instance()->addons as $addon) {
146
+			if ($addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal) {
147 147
 				EED_Core_Rest_Api::invalidate_cached_route_data();
148 148
 			}
149 149
 		}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public static function invalidate_cached_route_data() {
156 156
 		//delete the saved EE REST API routes
157
-		delete_option( EED_Core_Rest_Api::saved_routes_option_names );
157
+		delete_option(EED_Core_Rest_Api::saved_routes_option_names);
158 158
 	}
159 159
 
160 160
 	/**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 * }
167 167
 	 */
168 168
 	public static function get_ee_route_data() {
169
-		$ee_routes = get_option( self::saved_routes_option_names, null );
170
-		if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){
169
+		$ee_routes = get_option(self::saved_routes_option_names, null);
170
+		if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
171 171
 			self::save_ee_routes();
172
-			$ee_routes = get_option( self::saved_routes_option_names, array() );
172
+			$ee_routes = get_option(self::saved_routes_option_names, array());
173 173
 		}
174 174
 		return $ee_routes;
175 175
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @return void
181 181
 	 */
182 182
 	public static function save_ee_routes() {
183
-		if( EE_Maintenance_Mode::instance()->models_can_query() ){
183
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
184 184
 			$instance = self::instance();
185 185
 			$routes = apply_filters(
186 186
 				'EED_Core_Rest_Api__save_ee_routes__routes',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					$instance->_register_rpc_routes()
192 192
 				)
193 193
 			);
194
-			update_option( self::saved_routes_option_names, $routes, true );
194
+			update_option(self::saved_routes_option_names, $routes, true);
195 195
 		}
196 196
 	}
197 197
 
@@ -208,24 +208,24 @@  discard block
 block discarded – undo
208 208
 		unset($models_to_register['Extra_Meta']);
209 209
 		unset($models_to_register['Extra_Join']);
210 210
 		$model_routes = array( );
211
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
211
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
212 212
 
213
-			foreach ( $models_to_register as $model_name => $model_classname ) {
214
-				$model = \EE_Registry::instance()->load_model( $model_name );
213
+			foreach ($models_to_register as $model_name => $model_classname) {
214
+				$model = \EE_Registry::instance()->load_model($model_name);
215 215
 				//yes we could just register one route for ALL models, but then they wouldn't show up in the index
216
-				$ee_namespace = self::ee_api_namespace . $version;
217
-				$plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name );
218
-				$singular_model_route = $plural_model_route . '/(?P<id>\d+)' ;
219
-				$model_routes[ $ee_namespace ][ $plural_model_route ] = array(
216
+				$ee_namespace = self::ee_api_namespace.$version;
217
+				$plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
218
+				$singular_model_route = $plural_model_route.'/(?P<id>\d+)';
219
+				$model_routes[$ee_namespace][$plural_model_route] = array(
220 220
 						array(
221 221
 							'callback' => array(
222 222
 								'EventEspresso\core\libraries\rest_api\controllers\model\Read',
223 223
 								'handle_request_get_all' ),
224 224
 							'methods' => WP_REST_Server::READABLE,
225 225
 							'hidden_endpoint' => $hidden_endpoint,
226
-							'args' => $this->_get_read_query_params( $model, $version ),
226
+							'args' => $this->_get_read_query_params($model, $version),
227 227
 							'_links' => array(
228
-								'self' => rest_url( $ee_namespace . $singular_model_route ),
228
+								'self' => rest_url($ee_namespace.$singular_model_route),
229 229
 							)
230 230
 						),
231 231
 //						array(
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
 //							'hidden_endpoint' => $hidden_endpoint
237 237
 //						)
238 238
 					);
239
-				$model_routes[ $ee_namespace ][ $singular_model_route ] = array(
239
+				$model_routes[$ee_namespace][$singular_model_route] = array(
240 240
 						array(
241 241
 							'callback' => array(
242 242
 								'EventEspresso\core\libraries\rest_api\controllers\model\Read',
243 243
 								'handle_request_get_one' ),
244 244
 							'methods' => WP_REST_Server::READABLE,
245 245
 							'hidden_endpoint' => $hidden_endpoint,
246
-							'args' => $this->_get_response_selection_query_params( $model, $version)
246
+							'args' => $this->_get_response_selection_query_params($model, $version)
247 247
 						),
248 248
 //						array(
249 249
 //							'callback' => array(
@@ -254,19 +254,19 @@  discard block
 block discarded – undo
254 254
 //							),
255 255
 				);
256 256
 				//@todo: also handle  DELETE for a single item
257
-				foreach ( $model->relation_settings() as $relation_name => $relation_obj ) {
257
+				foreach ($model->relation_settings() as $relation_name => $relation_obj) {
258 258
 					$related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name(
259 259
 						$relation_name,
260 260
 						$relation_obj
261 261
 					);
262
-					$model_routes[ $ee_namespace ][ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array(
262
+					$model_routes[$ee_namespace][$singular_model_route.'/'.$related_model_name_endpoint_part] = array(
263 263
 							array(
264 264
 								'callback' => array(
265 265
 									'EventEspresso\core\libraries\rest_api\controllers\model\Read',
266 266
 									'handle_request_get_related' ),
267 267
 								'methods' => WP_REST_Server::READABLE,
268 268
 								'hidden_endpoint' => $hidden_endpoint,
269
-								'args' => $this->_get_read_query_params( $relation_obj->get_other_model(), $version ),
269
+								'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
270 270
 							),
271 271
 //							array(
272 272
 //								'callback' => array(
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 	 */
291 291
 	protected function _register_rpc_routes() {
292 292
 		$routes = array();
293
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
294
-			$ee_namespace = self::ee_api_namespace . $version;
293
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
294
+			$ee_namespace = self::ee_api_namespace.$version;
295 295
 			$this_versions_routes = array();
296 296
 			//checkin endpoint
297
-			$this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array(
297
+			$this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(
298 298
 				array(
299 299
 					'callback' => array(
300 300
 						'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 						'force' => array(
306 306
 							'required' => false,
307 307
 							'default' => false,
308
-							'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' )
308
+							'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso')
309 309
 						)
310 310
 					)
311 311
 				)
312 312
 			);
313
-			$routes[ $ee_namespace ] = apply_filters(
313
+			$routes[$ee_namespace] = apply_filters(
314 314
 				'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
315 315
 				$this_versions_routes,
316 316
 				$version,
@@ -326,19 +326,19 @@  discard block
 block discarded – undo
326 326
 	 * @param string $version
327 327
 	 * @return array
328 328
 	 */
329
-	protected function _get_response_selection_query_params( \EEM_Base $model, $version ) {
329
+	protected function _get_response_selection_query_params(\EEM_Base $model, $version) {
330 330
 		return apply_filters(
331 331
 			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
332 332
 			array(
333 333
 				'include' => array(
334 334
 					'required' => false,
335 335
 					'default' => '*',
336
-					'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ),
336
+					'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'),
337 337
 				),
338 338
 				'calculate' => array(
339 339
 					'required' => false,
340 340
 					'default' => '',
341
-					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model( $model )
341
+					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model($model)
342 342
 				)
343 343
 			),
344 344
 			$model,
@@ -356,43 +356,43 @@  discard block
 block discarded – undo
356 356
 	 * @return array    describing the args acceptable when querying this model
357 357
 	 * @throws \EE_Error
358 358
 	 */
359
-	protected function _get_read_query_params( \EEM_Base $model, $version ) {
359
+	protected function _get_read_query_params(\EEM_Base $model, $version) {
360 360
 		$default_orderby = array();
361
-		foreach( $model->get_combined_primary_key_fields() as $key_field ) {
362
-			$default_orderby[ $key_field->get_name() ] = 'ASC';
361
+		foreach ($model->get_combined_primary_key_fields() as $key_field) {
362
+			$default_orderby[$key_field->get_name()] = 'ASC';
363 363
 		}
364 364
 		return array_merge(
365
-			$this->_get_response_selection_query_params( $model, $version ),
365
+			$this->_get_response_selection_query_params($model, $version),
366 366
 			array(
367 367
 				'where' => array(
368 368
 					'required' => false,
369 369
 					'default' => array(),
370
-					'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso' ),
370
+					'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso'),
371 371
 					),
372 372
 				'limit' => array(
373 373
 					'required' => false,
374 374
 					'default' => EED_Core_Rest_Api::get_default_query_limit(),
375
-					'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso' )
375
+					'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso')
376 376
 				),
377 377
 				'order_by' => array(
378 378
 					'required' => false,
379 379
 					'default' => $default_orderby,
380
-					'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso' )
380
+					'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso')
381 381
 				),
382 382
 				'group_by' => array(
383 383
 					'required' => false,
384 384
 					'default' => null,
385
-					'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso' )
385
+					'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso')
386 386
 				),
387 387
 				'having' => array(
388 388
 					'required' => false,
389 389
 					'default' => null,
390
-					'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso' )
390
+					'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso')
391 391
 				),
392 392
 				'caps' => array(
393 393
 					'required' => false,
394 394
 					'default' => EEM_Base::caps_read,
395
-					'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso' )
395
+					'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso')
396 396
 				),
397 397
 			)
398 398
 		);
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	protected function _register_config_routes() {
406 406
 		$config_routes = array();
407
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
408
-			$config_routes[ self::ee_api_namespace . $version ][ 'config' ] = array(
407
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
408
+			$config_routes[self::ee_api_namespace.$version]['config'] = array(
409 409
 					array(
410 410
 						'callback' => array(
411 411
 							'EventEspresso\core\libraries\rest_api\controllers\config\Read',
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	protected function _register_meta_routes() {
426 426
 		$meta_routes = array();
427
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
428
-			$meta_routes[ self::ee_api_namespace . $version ][ '/resources' ] = array(
427
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
428
+			$meta_routes[self::ee_api_namespace.$version]['/resources'] = array(
429 429
 				array(
430 430
 					'callback' => array(
431 431
 						'EventEspresso\core\libraries\rest_api\controllers\model\Meta',
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
 	 * @param array $route_data
447 447
 	 * @return array
448 448
 	 */
449
-	public static function hide_old_endpoints( $route_data ) {
450
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
451
-			foreach( $relative_urls as $endpoint => $routes ) {
452
-				foreach( $routes as $route ) {
453
-					if( $route[ 'hidden_endpoint' ] ) {
454
-						$full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' );
455
-						unset( $route_data[ $full_route ] );
449
+	public static function hide_old_endpoints($route_data) {
450
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
451
+			foreach ($relative_urls as $endpoint => $routes) {
452
+				foreach ($routes as $route) {
453
+					if ($route['hidden_endpoint']) {
454
+						$full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/');
455
+						unset($route_data[$full_route]);
456 456
 					}
457 457
 				}
458 458
 			}
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	 */
492 492
 	public static function latest_rest_api_version() {
493 493
 		$versions_served = \EED_Core_Rest_Api::versions_served();
494
-		return end( array_keys( $versions_served ) );
494
+		return end(array_keys($versions_served));
495 495
 	}
496 496
 
497 497
 	/**
@@ -505,32 +505,32 @@  discard block
 block discarded – undo
505 505
 	public static function versions_served() {
506 506
 		$versions_served = array();
507 507
 		$possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
508
-		$lowest_compatible_version = end( $possibly_served_versions);
509
-		reset( $possibly_served_versions );
510
-		$versions_served_historically = array_keys( $possibly_served_versions );
511
-		$latest_version = end( $versions_served_historically );
512
-		reset( $versions_served_historically );
508
+		$lowest_compatible_version = end($possibly_served_versions);
509
+		reset($possibly_served_versions);
510
+		$versions_served_historically = array_keys($possibly_served_versions);
511
+		$latest_version = end($versions_served_historically);
512
+		reset($versions_served_historically);
513 513
 		//for each version of core we have ever served:
514
-		foreach ( $versions_served_historically as $key_versioned_endpoint ) {
514
+		foreach ($versions_served_historically as $key_versioned_endpoint) {
515 515
 			//if it's not above the current core version, and it's compatible with the current version of core
516
-			if( $key_versioned_endpoint == $latest_version ) {
516
+			if ($key_versioned_endpoint == $latest_version) {
517 517
 				//don't hide the latest version in the index
518
-				$versions_served[ $key_versioned_endpoint ] = false;
519
-			} else if(
518
+				$versions_served[$key_versioned_endpoint] = false;
519
+			} else if (
520 520
 				$key_versioned_endpoint < EED_Core_Rest_Api::core_version()
521 521
 				&& $key_versioned_endpoint >= $lowest_compatible_version
522 522
 			) {
523 523
 				//include, but hide, previous versions which are still supported
524
-				$versions_served[ $key_versioned_endpoint ] = true;
525
-			} elseif(
524
+				$versions_served[$key_versioned_endpoint] = true;
525
+			} elseif (
526 526
 				apply_filters(
527 527
 					'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
528 528
 					false,
529 529
 					$possibly_served_versions
530 530
 				)
531
-			){
531
+			) {
532 532
 				//if a version is no longer supported, don't include it in index or list of versions served
533
-				$versions_served[ $key_versioned_endpoint ] = true;
533
+				$versions_served[$key_versioned_endpoint] = true;
534 534
 			}
535 535
 		}
536 536
 		return $versions_served;
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	 * @return string
544 544
 	 */
545 545
 	public static function core_version() {
546
-		return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) );
546
+		return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3)));
547 547
 	}
548 548
 
549 549
 	/**
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	 * @param  WP $WP
569 569
 	 * @return    void
570 570
 	 */
571
-	public function run( $WP ) {
571
+	public function run($WP) {
572 572
 
573 573
 	}
574 574
 
Please login to merge, or discard this patch.
modules/feeds/EED_Feeds.module.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return EED_Feeds
30 30
 	 */
31 31
 	public static function instance() {
32
-		return parent::get_instance( __CLASS__ );
32
+		return parent::get_instance(__CLASS__);
33 33
 	}
34 34
 
35 35
 
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	 *  @return 	void
42 42
 	 */
43 43
 	public static function set_hooks() {
44
-		add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 );
45
-		add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1  );
46
-		add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 );
47
-		add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 );
44
+		add_action('parse_request', array('EED_Feeds', 'parse_request'), 10);
45
+		add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1);
46
+		add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2);
47
+		add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2);
48 48
 	}
49 49
 
50 50
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *  @access 	public
65 65
 	 *  @return 	void
66 66
 	 */
67
-	public function run( $WP ) {
67
+	public function run($WP) {
68 68
 	}
69 69
 
70 70
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 *  @param 	type	rss2, atom, rss, rdf, rssjs
77 77
 	 *  @return 	string
78 78
 	 */
79
-	public static function default_feed( $type = 'rss2' ) {
79
+	public static function default_feed($type = 'rss2') {
80 80
 		 //rss2, atom, rss, rdf, rssjs
81 81
 		$type = 'rss2';
82 82
 		return $type;
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 	 *  @return 	void
93 93
 	 */
94 94
 	public static function parse_request() {
95
-		if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) {
95
+		if (EE_Registry::instance()->REQ->is_set('post_type')) {
96 96
 			// define path to templates
97
-			define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
97
+			define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
98 98
 			// what kinda post_type are we dealing with ?
99
-			switch( EE_Registry::instance()->REQ->get( 'post_type' )) {
99
+			switch (EE_Registry::instance()->REQ->get('post_type')) {
100 100
 				case 'espresso_events' :
101 101
 					// for rss2, atom, rss, rdf
102
-					add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 );
103
-					add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 );
102
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1);
103
+					add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1);
104 104
 					// for json ( also uses the above filter )
105
-					add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 );
105
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1);
106 106
 					break;
107 107
 				case 'espresso_venues' :
108 108
 					// for rss2, atom, rss, rdf
109
-					add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 );
110
-					add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 );
109
+					add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1);
110
+					add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1);
111 111
 					// for json ( also uses the above filter )
112
-					add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 );
112
+					add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1);
113 113
 					break;
114 114
 			}
115 115
 		}
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 *  @param 	string 	$SQL	the JOIN clause for the comment feed query
128 128
 	 *  @return 	void
129 129
 	 */
130
-	public static function comment_feed_join( $SQL ) {
130
+	public static function comment_feed_join($SQL) {
131 131
 		global $wpdb;
132 132
 		// check for wp_posts table in JOIN clause
133
-		if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) {
134
-			add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' );
133
+		if (strpos($SQL, $wpdb->posts) !== FALSE) {
134
+			add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true');
135 135
 		}
136 136
 		return $SQL;
137 137
 	}
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 *  @param 	string 	$SQL	the WHERE clause for the comment feed query
149 149
 	 *  @return 	void
150 150
 	 */
151
-	public static function comment_feed_where( $SQL ) {
151
+	public static function comment_feed_where($SQL) {
152 152
 		global $wp_query, $wpdb;
153
-		if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) {
153
+		if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) {
154 154
 			$SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'";
155 155
 		}
156 156
 		return $SQL;
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	 *  @param 	string 	$content
167 167
 	 *  @return 	void
168 168
 	 */
169
-	public static function the_event_feed( $content ) {
170
-		if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) {
169
+	public static function the_event_feed($content) {
170
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) {
171 171
  			global $post;
172 172
 			$template_args = array(
173 173
 				'EVT_ID' => $post->ID,
174 174
 				'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content
175 175
 			);
176
-			$content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE );
176
+			$content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE);
177 177
 		}
178 178
 		return  $content;
179 179
 	}
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 	 *  @param 	object 	$item
189 189
 	 *  @return 	void
190 190
 	 */
191
-	public static function the_event_rssjs_feed( $item ) {
192
-		if ( is_feed() && isset( $item->description )) {
193
-			$item->description = EED_Feeds::the_event_feed( $item->description );
191
+	public static function the_event_rssjs_feed($item) {
192
+		if (is_feed() && isset($item->description)) {
193
+			$item->description = EED_Feeds::the_event_feed($item->description);
194 194
 		}
195 195
 		return $item;
196 196
 	}
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 	 *  @param 	string 	$content
206 206
 	 *  @return 	void
207 207
 	 */
208
-	public static function the_venue_feed( $content ) {
209
-		if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) {
208
+	public static function the_venue_feed($content) {
209
+		if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) {
210 210
  			global $post;
211 211
 			$template_args = array(
212 212
 				'VNU_ID' => $post->ID,
213 213
 				'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content
214 214
 			);
215
-			$content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE );
215
+			$content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE);
216 216
 		}
217 217
 		return $content;
218 218
 	}
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 	 *  @param 	object 	$item
228 228
 	 *  @return 	void
229 229
 	 */
230
-	public static function the_venue_rssjs_feed( $item ) {
231
-		if ( is_feed() && isset( $item->description )) {
232
-			$item->description = EED_Feeds::the_venue_feed( $item->description );
230
+	public static function the_venue_rssjs_feed($item) {
231
+		if (is_feed() && isset($item->description)) {
232
+			$item->description = EED_Feeds::the_venue_feed($item->description);
233 233
 		}
234 234
 		return $item;
235 235
 	}
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @return EED_Bot_Trap
19 19
 	 */
20 20
 	public static function instance() {
21
-		return parent::get_instance( __CLASS__ );
21
+		return parent::get_instance(__CLASS__);
22 22
 	}
23 23
 
24 24
 
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function set_hooks() {
33 33
 		if (
34
-			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
34
+			apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35 35
 			EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37
-			define( 'EE_BOT_TRAP_BASE_URL', plugin_dir_url( __FILE__ ) . DS );
37
+			define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
38 38
 			add_action(
39 39
 				'AHEE__ticket_selector_chart__template__after_ticket_selector',
40
-				array( 'EED_Bot_Trap', 'generate_bot_trap' ),
40
+				array('EED_Bot_Trap', 'generate_bot_trap'),
41 41
 				10, 2
42 42
 			);
43 43
 			add_action(
44 44
 				'EED_Ticket_Selector__process_ticket_selections__before',
45
-				array( 'EED_Bot_Trap', 'process_bot_trap' ),
45
+				array('EED_Bot_Trap', 'process_bot_trap'),
46 46
 				1, 2
47 47
 			);
48 48
 			// redirect bots to bogus success page
49
-			EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
49
+			EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
50 50
 		}
51 51
 	}
52 52
 
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	public static function set_hooks_admin() {
62 62
 		add_action(
63 63
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
64
-			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
64
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
65 65
 			10
66 66
 		);
67 67
 		add_filter(
68 68
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
69
-			array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ),
69
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
70 70
 			10, 1
71 71
 		);
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param    WP $WP
81 81
 	 * @return    void
82 82
 	 */
83
-	public function run( $WP ) {}
83
+	public function run($WP) {}
84 84
 
85 85
 
86 86
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function generate_bot_trap() {
94
-		$do_not_enter = __( 'please do not enter anything in this input', 'event_espresso' );
94
+		$do_not_enter = __('please do not enter anything in this input', 'event_espresso');
95 95
 		$html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">';
96
-		$html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter  . '</label>';
96
+		$html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>';
97 97
 		$html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>';
98 98
 		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
99
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
100
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
101
-			$html .= EE_Encryption::instance()->encrypt( time() );
99
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
100
+			EE_Registry::instance()->load_core('EE_Encryption');
101
+			$html .= EE_Encryption::instance()->encrypt(time());
102 102
 		} else {
103 103
 			$html .= time();
104 104
 		}
@@ -117,35 +117,35 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public static function process_bot_trap() {
119 119
 		// what's your email address Mr. Bot ?
120
-		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) && $_REQUEST[ 'tkt-slctr-request-processor-email' ] == '' ? true : false;
120
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) && $_REQUEST['tkt-slctr-request-processor-email'] == '' ? true : false;
121 121
 		// get encrypted timestamp for when the form was originally displayed
122
-		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) : '';
122
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) : '';
123 123
 		// decrypt and convert to absolute  integer
124
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
125
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
126
-			$bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) );
124
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
125
+			EE_Registry::instance()->load_core('EE_Encryption');
126
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
127 127
 		} else {
128
-			$bot_trap_timestamp = absint( $bot_trap_timestamp );
128
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
129 129
 		}
130 130
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
131
-		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) ? true : false;
131
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) ? true : false;
132 132
 		// are we human ?
133
-		if ( $empty_trap && ! $suspicious_timing ) {
133
+		if ($empty_trap && ! $suspicious_timing) {
134 134
 			return;
135 135
 		}
136 136
 		// UH OH...
137 137
 		$redirect_url = add_query_arg(
138
-			array( 'ee' => 'ticket_selection_received' ),
138
+			array('ee' => 'ticket_selection_received'),
139 139
 			EE_Registry::instance()->CFG->core->reg_page_url()
140 140
 		);
141
-		if ( $suspicious_timing ) {
141
+		if ($suspicious_timing) {
142 142
 			$redirect_url = add_query_arg(
143
-				array( 'ee-notice' => urlencode( __( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ),
143
+				array('ee-notice' => urlencode(__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))),
144 144
 				$redirect_url
145 145
 			);
146 146
 		}
147 147
 		wp_safe_redirect(
148
-			apply_filters( 'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url )
148
+			apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url)
149 149
 		);
150 150
 		exit();
151 151
 	}
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 	 * @return    void
161 161
 	 */
162 162
 	public static function display_bot_trap_success() {
163
-		add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' );
164
-		$bot_notice = __( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' );
165
-		$bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice;
166
-		EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) );
163
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
164
+		$bot_notice = __('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso');
165
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice;
166
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
167 167
 	}
168 168
 
169 169
 
@@ -197,20 +197,20 @@  discard block
 block discarded – undo
197 197
 				'html_id'         			=> 'bot_trap_settings',
198 198
 				'layout_strategy' 	=> new EE_Admin_Two_Column_Layout(),
199 199
 				'subsections'     		=> array(
200
-					'bot_trap_hdr' 		=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'Bot Trap Settings', 'event_espresso' ) ) ),
200
+					'bot_trap_hdr' 		=> new EE_Form_Section_HTML(EEH_HTML::h2(__('Bot Trap Settings', 'event_espresso'))),
201 201
 					'use_bot_trap' 		=> new EE_Yes_No_Input(
202 202
 						array(
203
-							'html_label_text' 	=> __( 'Enable Bot Trap', 'event_espresso' ),
204
-							'html_help_text' 		=>  __( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ),
205
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
203
+							'html_label_text' 	=> __('Enable Bot Trap', 'event_espresso'),
204
+							'html_help_text' 		=>  __('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'),
205
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
206 206
 							'required'        		=> false
207 207
 						)
208 208
 					),
209 209
 					'use_encryption' 		=> new EE_Yes_No_Input(
210 210
 						array(
211
-							'html_label_text' 	=> __( 'Encrypt Bot Trap Data', 'event_espresso' ),
212
-							'html_help_text' 		=>  __( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ),
213
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
211
+							'html_label_text' 	=> __('Encrypt Bot Trap Data', 'event_espresso'),
212
+							'html_help_text' 		=>  __('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'),
213
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
214 214
 							'required'        		=> false
215 215
 						)
216 216
 					),
@@ -228,30 +228,30 @@  discard block
 block discarded – undo
228 228
 	 * @param \EE_Registration_Config $EE_Registration_Config
229 229
 	 * @return \EE_Registration_Config
230 230
 	 */
231
-	public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) {
231
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) {
232 232
 		try {
233 233
 			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
234 234
 			// if not displaying a form, then check for form submission
235
-			if ( $bot_trap_settings_form->was_submitted() ) {
235
+			if ($bot_trap_settings_form->was_submitted()) {
236 236
 				// capture form data
237 237
 				$bot_trap_settings_form->receive_form_submission();
238 238
 				// validate form data
239
-				if ( $bot_trap_settings_form->is_valid() ) {
239
+				if ($bot_trap_settings_form->is_valid()) {
240 240
 					// grab validated data from form
241 241
 					$valid_data = $bot_trap_settings_form->valid_data();
242
-					if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) {
243
-						$EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ];
244
-						$EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ];
242
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
243
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
244
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
245 245
 					} else {
246
-						EE_Error::add_error( __( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
246
+						EE_Error::add_error(__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
247 247
 					}
248 248
 				} else {
249
-					if ( $bot_trap_settings_form->submission_error_message() != '' ) {
250
-						EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
249
+					if ($bot_trap_settings_form->submission_error_message() != '') {
250
+						EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
251 251
 					}
252 252
 				}
253 253
 			}
254
-		} catch ( EE_Error $e ) {
254
+		} catch (EE_Error $e) {
255 255
 			$e->get_error();
256 256
 		}
257 257
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
admin_pages/maintenance/Maintenance_Admin_Page.core.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 class Maintenance_Admin_Page extends EE_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35 35
 	}
36 36
 
37 37
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 
48 48
 	protected function _ajax_hooks() {
49
-		add_action('wp_ajax_migration_step',array($this,'migration_step'));
50
-		add_action('wp_ajax_add_error_to_migrations_ran',array($this,'add_error_to_migrations_ran'));
49
+		add_action('wp_ajax_migration_step', array($this, 'migration_step'));
50
+		add_action('wp_ajax_add_error_to_migrations_ran', array($this, 'add_error_to_migrations_ran'));
51 51
 	}
52 52
 
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$this->_admin_page_title = EE_MAINTENANCE_LABEL;
57 57
 		$this->_labels = array(
58 58
 			'buttons' => array(
59
-				'reset_capabilities' => __( 'Reset Event Espresso Capabilities', 'event_espresso' )
59
+				'reset_capabilities' => __('Reset Event Espresso Capabilities', 'event_espresso')
60 60
 				)
61 61
 			);
62 62
 	}
@@ -155,23 +155,23 @@  discard block
 block discarded – undo
155 155
 	 * default maintenance page. If we're in maintenance mode level 2, then we need to show
156 156
 	 * the migration scripts and all that UI.
157 157
 	 */
158
-	public function _maintenance(){
158
+	public function _maintenance() {
159 159
 		//it all depends if we're in maintenance model level 1 (frontend-only) or
160 160
 		//level 2 (everything except maintenance page)
161
-		try{
161
+		try {
162 162
 			//get the current maintenance level and check if
163 163
 			//we are removed
164 164
 			$mm = EE_Maintenance_Mode::instance()->level();
165 165
 			$placed_in_mm = EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
166
-			if( $mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm){
166
+			if ($mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) {
167 167
 				//we just took the site out of maintenance mode, so notify the user.
168 168
 				//unfortunately this message appears to be echoed on the NEXT page load...
169 169
 				//oh well, we should really be checking for this on addon deactivation anyways
170
-				EE_Error::add_attention( __( 'Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso' ) );
171
-				$this->_process_notices( array( 'page' => 'espresso_maintenance_settings'), false );
170
+				EE_Error::add_attention(__('Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso'));
171
+				$this->_process_notices(array('page' => 'espresso_maintenance_settings'), false);
172 172
 			}
173 173
 			//in case an exception is thrown while trying to handle migrations
174
-			switch(EE_Maintenance_Mode::instance()->level()){
174
+			switch (EE_Maintenance_Mode::instance()->level()) {
175 175
 				case EE_Maintenance_Mode::level_0_not_in_maintenance:
176 176
 				case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
177 177
 					$show_maintenance_switch = true;
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 				case EE_Maintenance_Mode::level_2_complete_maintenance:
184 184
 					$show_maintenance_switch = false;
185 185
 					$show_migration_progress = true;
186
-					if(isset($this->_req_data['continue_migration'])){
186
+					if (isset($this->_req_data['continue_migration'])) {
187 187
 						$show_backup_db_text = false;
188
-					}else{
188
+					} else {
189 189
 						$show_backup_db_text = true;
190 190
 					}
191 191
 					$scripts_needing_to_run = EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts();
192 192
 					$addons_should_be_upgraded_first = EE_Data_Migration_Manager::instance()->addons_need_updating();
193 193
 					$script_names = array();
194 194
 					$current_script = NULL;
195
-					foreach($scripts_needing_to_run as $script){
196
-						if($script instanceof EE_Data_Migration_Script_Base){
197
-							if( ! $current_script){
195
+					foreach ($scripts_needing_to_run as $script) {
196
+						if ($script instanceof EE_Data_Migration_Script_Base) {
197
+							if ( ! $current_script) {
198 198
 								$current_script = $script;
199 199
 								$current_script->migration_page_hooks();
200 200
 							}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			}
206 206
 			$most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true);
207 207
 			$exception_thrown = false;
208
-		}catch(EE_Error $e){
208
+		} catch (EE_Error $e) {
209 209
 
210 210
 			EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage());
211 211
 			//now, just so we can display the page correctly, make a error migration script stage object
@@ -215,53 +215,53 @@  discard block
 block discarded – undo
215 215
 			$exception_thrown = true;
216 216
 		}
217 217
 		$current_db_state = EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set();
218
-		if($exception_thrown ||
219
-				(	$most_recent_migration &&
218
+		if ($exception_thrown ||
219
+				($most_recent_migration &&
220 220
 					$most_recent_migration instanceof EE_Data_Migration_Script_Base &&
221 221
 					$most_recent_migration->is_broken()
222
-				)){
223
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';
224
-			$this->_template_args[ 'support_url' ] = 'http://eventespresso.com/support/forums/';
225
-			$this->_template_args[ 'next_url' ] = EEH_URL::add_query_args_and_nonce(array( 'action' => 'confirm_migration_crash_report_sent', 'success' => '0' ), EE_MAINTENANCE_ADMIN_URL );
226
-		}elseif($addons_should_be_upgraded_first){
227
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php';
228
-		}else{
229
-			if($most_recent_migration &&
230
-					$most_recent_migration instanceof EE_Data_Migration_Script_Base  &&
231
-					$most_recent_migration->can_continue()){
222
+				)) {
223
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_was_borked_page.template.php';
224
+			$this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/';
225
+			$this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce(array('action' => 'confirm_migration_crash_report_sent', 'success' => '0'), EE_MAINTENANCE_ADMIN_URL);
226
+		}elseif ($addons_should_be_upgraded_first) {
227
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_upgrade_addons_before_migrating.template.php';
228
+		} else {
229
+			if ($most_recent_migration &&
230
+					$most_recent_migration instanceof EE_Data_Migration_Script_Base &&
231
+					$most_recent_migration->can_continue()) {
232 232
 				$show_backup_db_text = false;
233 233
 				$show_continue_current_migration_script = true;
234 234
 				$show_most_recent_migration = true;
235
-			}elseif(isset($this->_req_data['continue_migration'])){
235
+			}elseif (isset($this->_req_data['continue_migration'])) {
236 236
 				$show_most_recent_migration = true;
237 237
 				$show_continue_current_migration_script = false;
238
-			}else{
238
+			} else {
239 239
 				$show_most_recent_migration = false;
240 240
 				$show_continue_current_migration_script = false;
241 241
 			}
242 242
 
243
-			if(isset($current_script)){
243
+			if (isset($current_script)) {
244 244
 				$migrates_to = $current_script->migrates_to_version();
245
-				$plugin_slug = $migrates_to[ 'slug' ];
246
-				$new_version = $migrates_to[ 'version' ];
247
-				$this->_template_args = array_merge($this->_template_args,array(
248
-					'current_db_state'=>  sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3,$plugin_slug),
249
-					'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'),$new_version,$plugin_slug) : NULL));
245
+				$plugin_slug = $migrates_to['slug'];
246
+				$new_version = $migrates_to['version'];
247
+				$this->_template_args = array_merge($this->_template_args, array(
248
+					'current_db_state'=>  sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3, $plugin_slug),
249
+					'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'), $new_version, $plugin_slug) : NULL));
250 250
 			}
251 251
 
252
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php';
252
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_page.template.php';
253 253
 			$this->_template_args = array_merge(
254 254
 				$this->_template_args,
255 255
 				array(
256
-					'show_most_recent_migration' => $show_most_recent_migration,//flag for showing the most recent migration's status and/or errors
257
-					'show_migration_progress' => $show_migration_progress,//flag for showing the option to run migrations and see their progress
258
-					'show_backup_db_text' => $show_backup_db_text,//flag for showing text telling the user to backup their DB
259
-					'show_maintenance_switch'=> $show_maintenance_switch,//flag for showing the option to change maintenance mode between levels 0 and 1
260
-					'script_names'=>$script_names,//array of names of scripts that have run
261
-					'show_continue_current_migration_script'=>$show_continue_current_migration_script,//flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
256
+					'show_most_recent_migration' => $show_most_recent_migration, //flag for showing the most recent migration's status and/or errors
257
+					'show_migration_progress' => $show_migration_progress, //flag for showing the option to run migrations and see their progress
258
+					'show_backup_db_text' => $show_backup_db_text, //flag for showing text telling the user to backup their DB
259
+					'show_maintenance_switch'=> $show_maintenance_switch, //flag for showing the option to change maintenance mode between levels 0 and 1
260
+					'script_names'=>$script_names, //array of names of scripts that have run
261
+					'show_continue_current_migration_script'=>$show_continue_current_migration_script, //flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
262 262
 					'reset_db_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL),
263
-					'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'),EE_MAINTENANCE_ADMIN_URL),
264
-					'ultimate_db_state'=>  sprintf(__("EE%s", 'event_espresso'),espresso_version()),
263
+					'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'), EE_MAINTENANCE_ADMIN_URL),
264
+					'ultimate_db_state'=>  sprintf(__("EE%s", 'event_espresso'), espresso_version()),
265 265
 				)
266 266
 			);
267 267
 		//make sure we have the form fields helper available. It usually is, but sometimes it isn't
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			'status_fatal_error'=>  EE_Data_Migration_Manager::status_fatal_error,
276 276
 			'status_completed'=>  EE_Data_Migration_Manager::status_completed));
277 277
 		}
278
-		$this->_template_args['most_recent_migration'] = $most_recent_migration;//the actual most recently ran migration
278
+		$this->_template_args['most_recent_migration'] = $most_recent_migration; //the actual most recently ran migration
279 279
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
280 280
 		$this->display_admin_page_with_sidebar();
281 281
 	}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	/**
286 286
 	 * returns JSON and executes another step of the currently-executing data migration (called via ajax)
287 287
 	 */
288
-	public function migration_step(){
288
+	public function migration_step() {
289 289
 		$this->_template_args['data'] = EE_Data_Migration_Manager::instance()->response_to_migration_ajax_request();
290 290
 		$this->_return_json();
291 291
 	}
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * Can be used by js when it notices a response with HTML in it in order
297 297
 	 * to log the malformed response
298 298
 	 */
299
-	public function add_error_to_migrations_ran(){
299
+	public function add_error_to_migrations_ran() {
300 300
 		EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($this->_req_data['message']);
301 301
 		$this->_template_args['data'] = array('ok'=>true);
302 302
 		$this->_return_json();
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 	/**
308 308
 	 * changes the maintenance level, provided there are still no migration scripts that shoudl run
309 309
 	 */
310
-	public function _change_maintenance_level(){
310
+	public function _change_maintenance_level() {
311 311
 		$new_level = intval($this->_req_data['maintenance_mode_level']);
312
-		if( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
312
+		if ( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
313 313
 			EE_Maintenance_Mode::instance()->set_maintenance_level($new_level);
314 314
 			$success = true;
315
-		}else{
315
+		} else {
316 316
 			EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
317
-			$success= false;
317
+			$success = false;
318 318
 		}
319 319
 		$this->_redirect_after_action($success, 'Maintenance Mode', __("Updated", "event_espresso"));
320 320
 	}
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 	/**
325 325
 	 * a tab with options for reseting and/or deleting EE data
326 326
 	 */
327
-	public function _data_reset_and_delete(){
328
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php';
329
-		$this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button( 'reset_capabilities', 'reset_capabilities', array(),  'button button-primary' );
327
+	public function _data_reset_and_delete() {
328
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_data_reset_and_delete.template.php';
329
+		$this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button('reset_capabilities', 'reset_capabilities', array(), 'button button-primary');
330 330
 		$this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_db'), EE_MAINTENANCE_ADMIN_URL);
331 331
 		$this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL);
332 332
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
 	protected function _reset_capabilities() {
339
-		EE_Registry::instance()->CAP->init_caps( true );
340
-		EE_Error::add_success( __('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso' ) );
341
-		$this->_redirect_after_action( FALSE, '', '', array( 'action' => 'data_reset' ), TRUE );
339
+		EE_Registry::instance()->CAP->init_caps(true);
340
+		EE_Error::add_success(__('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso'));
341
+		$this->_redirect_after_action(FALSE, '', '', array('action' => 'data_reset'), TRUE);
342 342
 	}
343 343
 
344 344
 	/**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	protected function _reattempt_migration() {
350 350
 		EE_Data_Migration_Manager::instance()->reattempt();
351
-		$this->_redirect_after_action( FALSE, '', '', array( 'action' => 'default' ), TRUE );
351
+		$this->_redirect_after_action(FALSE, '', '', array('action' => 'default'), TRUE);
352 352
 	}
353 353
 
354 354
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	/**
358 358
 	 * shows the big ol' System Information page
359 359
 	 */
360
-	public function _system_status(){
361
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php';
360
+	public function _system_status() {
361
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_system_stati_page.template.php';
362 362
 		$this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati();
363 363
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
364 364
 		$this->display_admin_page_with_sidebar();
@@ -366,30 +366,30 @@  discard block
 block discarded – undo
366 366
 
367 367
 
368 368
 
369
-	public function _send_migration_crash_report(){
369
+	public function _send_migration_crash_report() {
370 370
 		$from = $this->_req_data['from'];
371 371
 		$from_name = $this->_req_data['from_name'];
372 372
 		$body = $this->_req_data['body'];
373
-		try{
373
+		try {
374 374
 		$success = wp_mail(EE_SUPPORT_EMAIL,
375 375
 				'Migration Crash Report',
376
-				$body."/r/n<br>".  print_r(EEM_System_Status::instance()->get_system_stati(),true),
376
+				$body."/r/n<br>".print_r(EEM_System_Status::instance()->get_system_stati(), true),
377 377
 				array(
378 378
 					"from:$from_name<$from>",
379 379
 //					'content-type:text/html charset=UTF-8'
380 380
 					));
381
-		}catch( Exception $e ){
381
+		} catch (Exception $e) {
382 382
 			$success = FALSE;
383 383
 		}
384
-		$this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"),array('success'=>$success,'action'=>'confirm_migration_crash_report_sent'));
384
+		$this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"), array('success'=>$success, 'action'=>'confirm_migration_crash_report_sent'));
385 385
 	}
386 386
 
387 387
 
388 388
 
389
-	public function _confirm_migration_crash_report_sent(){
390
-		try{
389
+	public function _confirm_migration_crash_report_sent() {
390
+		try {
391 391
 			$most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true);
392
-		}catch(EE_Error $e){
392
+		} catch (EE_Error $e) {
393 393
 
394 394
 			EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage());
395 395
 			//now, just so we can display the page correctly, make a error migration script stage object
@@ -397,14 +397,14 @@  discard block
 block discarded – undo
397 397
 			$most_recent_migration = new EE_DMS_Unknown_1_0_0();
398 398
 			$most_recent_migration->add_error($e->getMessage());
399 399
 		}
400
-		$success = $this->_req_data['success']=='1' ? true : false;
400
+		$success = $this->_req_data['success'] == '1' ? true : false;
401 401
 		$this->_template_args['success'] = $success;
402
-		$this->_template_args[ 'most_recent_migration' ] = $most_recent_migration;
402
+		$this->_template_args['most_recent_migration'] = $most_recent_migration;
403 403
 		$this->_template_args['reset_db_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL);
404
-		$this->_template_args[ 'reset_db_page_url' ] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL);
405
-		$this->_template_args[ 'reattempt_action_url' ] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL );
406
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php';
407
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path,$this->_template_args,TRUE);
404
+		$this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL);
405
+		$this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL);
406
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_confirm_migration_crash_report_sent.template.php';
407
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
408 408
 		$this->display_admin_page_with_sidebar();
409 409
 	}
410 410
 
@@ -417,18 +417,18 @@  discard block
 block discarded – undo
417 417
 	 * @param boolean $nuke_old_ee4_data controls whether or not we
418 418
 	 * destroy the old ee4 data, or just try initializing ee4 default data
419 419
 	 */
420
-	public function _reset_db( $nuke_old_ee4_data = TRUE ){
420
+	public function _reset_db($nuke_old_ee4_data = TRUE) {
421 421
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
422 422
 
423
-		if( $nuke_old_ee4_data ){
423
+		if ($nuke_old_ee4_data) {
424 424
 			EEH_Activation::delete_all_espresso_cpt_data();
425
-			EEH_Activation::delete_all_espresso_tables_and_data( FALSE );
425
+			EEH_Activation::delete_all_espresso_tables_and_data(FALSE);
426 426
 			EEH_Activation::remove_cron_tasks();
427 427
 		}
428 428
 		//make sure when we reset the registry's config that it
429 429
 		//switches to using the new singleton
430
-		EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset( TRUE );
431
-		EE_System::instance()->initialize_db_if_no_migrations_required( TRUE );
430
+		EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(TRUE);
431
+		EE_System::instance()->initialize_db_if_no_migrations_required(TRUE);
432 432
 		EE_System::instance()->redirect_to_about_ee();
433 433
 	}
434 434
 
@@ -437,20 +437,20 @@  discard block
 block discarded – undo
437 437
 	/**
438 438
 	 * Deletes ALL EE tables, Records, and Options from the database.
439 439
 	 */
440
-	public function _delete_db(){
440
+	public function _delete_db() {
441 441
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
442 442
 		EEH_Activation::delete_all_espresso_cpt_data();
443 443
 		EEH_Activation::delete_all_espresso_tables_and_data();
444 444
 		EEH_Activation::remove_cron_tasks();
445 445
 		EEH_Activation::deactivate_event_espresso();
446
-		wp_safe_redirect( admin_url( 'plugins.php' ));
446
+		wp_safe_redirect(admin_url('plugins.php'));
447 447
 		exit;
448 448
 	}
449 449
 
450 450
 	/**
451 451
 	 * sets up EE4 to rerun the migrations from ee3 to ee4
452 452
 	 */
453
-	public function _rerun_migration_from_ee3(){
453
+	public function _rerun_migration_from_ee3() {
454 454
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
455 455
 		EEH_Activation::delete_all_espresso_cpt_data();
456 456
 		EEH_Activation::delete_all_espresso_tables_and_data(false);
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 		wp_enqueue_script('ee_admin_js');
478 478
 //		wp_enqueue_media();
479 479
 //		wp_enqueue_script('media-upload');
480
-		wp_enqueue_script('ee-maintenance',EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js',array('jquery'),EVENT_ESPRESSO_VERSION,true);
480
+		wp_enqueue_script('ee-maintenance', EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
481 481
 
482
-		wp_register_style( 'espresso_maintenance', EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION );
482
+		wp_register_style('espresso_maintenance', EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION);
483 483
 		wp_enqueue_style('espresso_maintenance');
484 484
 	}
485 485
 
Please login to merge, or discard this patch.
admin_pages/payments/Payments_Admin_Page.core.php 1 patch
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
45 45
 	 * @return \Payments_Admin_Page
46 46
 	 */
47
-	public function __construct( $routing = TRUE ) {
48
-		parent::__construct( $routing );
47
+	public function __construct($routing = TRUE) {
48
+		parent::__construct($routing);
49 49
 	}
50 50
 
51 51
 
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 	protected function _set_page_config() {
131 131
 		$payment_method_list_config = array(
132 132
 			'nav'           => array(
133
-				'label' => __( 'Payment Methods', 'event_espresso' ),
133
+				'label' => __('Payment Methods', 'event_espresso'),
134 134
 				'order' => 10
135 135
 			),
136 136
 			'metaboxes'     => $this->_default_espresso_metaboxes,
137 137
 			'help_tabs'     => array_merge(
138 138
 				array(
139 139
 					'payment_methods_overview_help_tab' => array(
140
-						'title'    => __( 'Payment Methods Overview', 'event_espresso' ),
140
+						'title'    => __('Payment Methods Overview', 'event_espresso'),
141 141
 						'filename' => 'payment_methods_overview'
142 142
 					)
143 143
 				),
144 144
 				$this->_add_payment_method_help_tabs() ),
145
-			'help_tour'     => array( 'Payment_Methods_Selection_Help_Tour' ),
145
+			'help_tour'     => array('Payment_Methods_Selection_Help_Tour'),
146 146
 			'require_nonce' => false
147 147
 		);
148 148
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 					)
161 161
 				),
162 162
 				//'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),
163
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
163
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164 164
 				'require_nonce' => FALSE
165 165
 			),
166 166
 			'payment_log'=>array(
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _add_payment_method_help_tabs(){
182
+	protected function _add_payment_method_help_tabs() {
183 183
 		EE_Registry::instance()->load_lib('Payment_Method_Manager');
184 184
 		$payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();
185 185
 		$all_pmt_help_tabs_config = array();
186
-		foreach( $payment_method_types as $payment_method_type ){
187
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) {
186
+		foreach ($payment_method_types as $payment_method_type) {
187
+			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) {
188 188
 				continue;
189 189
 			}
190
-			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){
191
-				$template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array();
192
-				$template_args[ 'admin_page_obj' ] = $this;
190
+			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) {
191
+				$template_args = isset($config['template_args']) ? $config['template_args'] : array();
192
+				$template_args['admin_page_obj'] = $this;
193 193
 				$all_pmt_help_tabs_config[$help_tab_name] = array(
194 194
 					'title'=>$config['title'],
195 195
 					'content'=>EEH_Template::display_template( 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
 	public function load_scripts_styles() {
219
-		wp_enqueue_script( 'ee_admin_js' );
220
-		wp_enqueue_script( 'ee-text-links' );
221
-		wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
219
+		wp_enqueue_script('ee_admin_js');
220
+		wp_enqueue_script('ee-text-links');
221
+		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
222 222
 	}
223 223
 
224 224
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 	public function load_scripts_styles_default() {
229 229
 		//styles
230
-		wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );
231
-		wp_enqueue_style( 'espresso_payments' );
232
-		wp_enqueue_style( 'ee-text-links' );
230
+		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION);
231
+		wp_enqueue_style('espresso_payments');
232
+		wp_enqueue_style('ee-text-links');
233 233
 		//scripts
234 234
 	}
235 235
 
@@ -243,44 +243,44 @@  discard block
 block discarded – undo
243 243
 		 * to the loading process.  However, people MUST setup the details for the payment method so its safe to do a
244 244
 		 * recheck here.
245 245
 		 */
246
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
246
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
247 247
 		EEM_Payment_Method::instance()->verify_button_urls();
248 248
 		//setup tabs, one for each payment method type
249 249
 		$tabs = array();
250 250
 		$payment_methods = array();
251
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
251
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
252 252
 			// we don't want to show admin-only PMTs for now
253
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
253
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
254 254
 				continue;
255 255
 			}
256 256
 			//check access
257
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
257
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
258 258
 				continue;
259 259
 			}
260 260
 			//check for any active pms of that type
261
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
262
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
261
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
262
+			if ( ! $payment_method instanceof EE_Payment_Method) {
263 263
 				$payment_method = EE_Payment_Method::new_instance(
264 264
 					array(
265
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
265
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
266 266
 						'PMD_type'					=>$pmt_obj->system_name(),
267 267
 						'PMD_name'				=>$pmt_obj->pretty_name(),
268 268
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
269 269
 					)
270 270
 				);
271 271
 			}
272
-			$payment_methods[ $payment_method->slug() ] = $payment_method;
272
+			$payment_methods[$payment_method->slug()] = $payment_method;
273 273
 		}
274
-		$payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods );
275
-		foreach( $payment_methods as $payment_method ) {
276
-			if ( $payment_method instanceof EE_Payment_Method ) {
274
+		$payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods);
275
+		foreach ($payment_methods as $payment_method) {
276
+			if ($payment_method instanceof EE_Payment_Method) {
277 277
 				add_meta_box(
278 278
 					//html id
279
-					'espresso_' . $payment_method->slug() . '_payment_settings',
279
+					'espresso_'.$payment_method->slug().'_payment_settings',
280 280
 					//title
281
-					sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ),
281
+					sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
282 282
 					//callback
283
-					array( $this, 'payment_method_settings_meta_box' ),
283
+					array($this, 'payment_method_settings_meta_box'),
284 284
 					//post type
285 285
 					null,
286 286
 					//context
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
 					//priority
289 289
 					'default',
290 290
 					//callback args
291
-					array( 'payment_method' => $payment_method )
291
+					array('payment_method' => $payment_method)
292 292
 				);
293 293
 				//setup for tabbed content
294
-				$tabs[ $payment_method->slug() ] = array(
294
+				$tabs[$payment_method->slug()] = array(
295 295
 					'label' => $payment_method->admin_name(),
296 296
 					'class' => $payment_method->active() ? 'gateway-active' : '',
297
-					'href'  => 'espresso_' . $payment_method->slug() . '_payment_settings',
298
-					'title' => __( 'Modify this Payment Method', 'event_espresso' ),
297
+					'href'  => 'espresso_'.$payment_method->slug().'_payment_settings',
298
+					'title' => __('Modify this Payment Method', 'event_espresso'),
299 299
 					'slug'  => $payment_method->slug()
300 300
 				);
301 301
 			}
302 302
 		}
303
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
303
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
304 304
 		$this->display_admin_page_with_sidebar();
305 305
 
306 306
 	}
@@ -311,20 +311,20 @@  discard block
 block discarded – undo
311 311
 	 *   _get_active_payment_method_slug
312 312
 	 * 	@return string
313 313
 	 */
314
-	protected function _get_active_payment_method_slug(){
314
+	protected function _get_active_payment_method_slug() {
315 315
 		$payment_method_slug = FALSE;
316 316
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
317
-		if ( isset( $this->_req_data['payment_method'] )) {
317
+		if (isset($this->_req_data['payment_method'])) {
318 318
 			// if they provided the current payment method, use it
319
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
319
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
320 320
 		}
321
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
321
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
322 322
 		// if that didn't work or wasn't provided, find another way to select the current pm
323
-		if ( ! $this->_verify_payment_method( $payment_method )) {
323
+		if ( ! $this->_verify_payment_method($payment_method)) {
324 324
 			// like, looking for an active one
325
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
325
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
326 326
 			// test that one as well
327
-			if ( $this->_verify_payment_method( $payment_method )) {
327
+			if ($this->_verify_payment_method($payment_method)) {
328 328
 				$payment_method_slug = $payment_method->slug();
329 329
 			} else {
330 330
 				$payment_method_slug = 'paypal_standard';
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	 * @param \EE_Payment_Method $payment_method
343 343
 	 * @return boolean
344 344
 	 */
345
-	protected function _verify_payment_method( $payment_method ){
345
+	protected function _verify_payment_method($payment_method) {
346 346
 		if (
347 347
 			$payment_method instanceof EE_Payment_Method &&
348 348
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
349
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
349
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
350 350
 		) {
351 351
 			return TRUE;
352 352
 		}
@@ -363,21 +363,21 @@  discard block
 block discarded – undo
363 363
 	 * @return string
364 364
 	 * @throws EE_Error
365 365
 	 */
366
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
367
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
368
-		if ( ! $payment_method instanceof EE_Payment_Method ){
369
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
366
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
367
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
368
+		if ( ! $payment_method instanceof EE_Payment_Method) {
369
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
370 370
 		}
371 371
 		$payment_method_scopes = $payment_method->active();
372 372
 		// if the payment method really exists show its form, otherwise the activation template
373
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
374
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
375
-				if ( $form->form_data_present_in( $this->_req_data )) {
376
-					$form->receive_form_submission( $this->_req_data );
373
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
374
+				$form = $this->_generate_payment_method_settings_form($payment_method);
375
+				if ($form->form_data_present_in($this->_req_data)) {
376
+					$form->receive_form_submission($this->_req_data);
377 377
 				}
378
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
378
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
379 379
 		} else {
380
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
380
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
381 381
 		}
382 382
 	}
383 383
 
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
 	 * @param \EE_Payment_Method $payment_method
391 391
 	 * @return \EE_Form_Section_Proper
392 392
 	 */
393
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
394
-		if ( ! $payment_method instanceof EE_Payment_Method ){
393
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
394
+		if ( ! $payment_method instanceof EE_Payment_Method) {
395 395
 			return new EE_Form_Section_Proper();
396 396
 		}
397 397
 		return new EE_Form_Section_Proper(
398 398
 			array(
399
-				'name' 	=> $payment_method->slug() . '_settings_form',
400
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
399
+				'name' 	=> $payment_method->slug().'_settings_form',
400
+				'html_id' 	=> $payment_method->slug().'_settings_form',
401 401
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
402 402
 					array(
403 403
 						'action' 						=> 'update_payment_method',
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 				'subsections' 			=> apply_filters(
410 410
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
411 411
 					array(
412
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
413
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
414
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
415
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
416
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
417
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
412
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
413
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
414
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
415
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
416
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
417
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
418 418
 					),
419 419
 					$payment_method
420 420
 				)
@@ -431,19 +431,19 @@  discard block
 block discarded – undo
431 431
 	 * @param \EE_Payment_Method $payment_method
432 432
 	 * @return \EE_Form_Section_Proper
433 433
 	 */
434
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
435
-		if ( $payment_method->type_obj()->requires_https() ) {
434
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
435
+		if ($payment_method->type_obj()->requires_https()) {
436 436
 			return new EE_Form_Section_HTML(
437 437
 				EEH_HTML::tr(
438 438
 					EEH_HTML::th(
439 439
 						EEH_HTML::label(
440
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
440
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
441 441
 						)
442
-					) .
442
+					).
443 443
 					EEH_HTML::td(
444
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
445
-						EEH_HTML::br() .
446
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
444
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
445
+						EEH_HTML::br().
446
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
447 447
 					)
448 448
 				)
449 449
 			);
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 	 * @param \EE_Payment_Method $payment_method
462 462
 	 * @return \EE_Form_Section_Proper
463 463
 	 */
464
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
465
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
464
+	protected function _currency_support(EE_Payment_Method $payment_method) {
465
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
466 466
 			return new EE_Form_Section_HTML(
467 467
 				EEH_HTML::tr(
468 468
 					EEH_HTML::th(
469 469
 						EEH_HTML::label(
470
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
470
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
471 471
 						)
472
-					) .
472
+					).
473 473
 					EEH_HTML::td(
474 474
 						EEH_HTML::strong(
475 475
 							sprintf(
476
-								__( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
476
+								__('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
477 477
 								EE_Config::instance()->currency->code
478 478
 							)
479 479
 						)
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
 	 * @param \EE_Payment_Method $payment_method
494 494
 	 * @return \EE_Form_Section_HTML
495 495
 	 */
496
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
496
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
497 497
 		//modify the form so we only have/show fields that will be implemented for this version
498
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
498
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
499 499
 	}
500 500
 
501 501
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	 * @return \EE_Payment_Method_Form
509 509
 	 * @throws \EE_Error
510 510
 	 */
511
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
512
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
511
+	protected function _simplify_form($form_section, $payment_method_name = '') {
512
+		if ($form_section instanceof EE_Payment_Method_Form) {
513 513
 			$form_section->exclude(
514 514
 				array(
515 515
 					'PMD_type', //dont want them changing the type
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 			);
521 521
 			return $form_section;
522 522
 		} else {
523
-			throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name ));
523
+			throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name));
524 524
 		}
525 525
 	}
526 526
 
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 	 * @param \EE_Payment_Method $payment_method
534 534
 	 * @return \EE_Form_Section_HTML
535 535
 	 */
536
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
536
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
537 537
 		$update_button = new EE_Submit_Input(
538 538
 			array(
539
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
540
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
539
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
540
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
541 541
 				'html_label' => EEH_HTML::nbsp()
542 542
 			)
543 543
 		);
544 544
 		return new EE_Form_Section_HTML(
545
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
545
+			EEH_HTML::no_row(EEH_HTML::br(2)).
546 546
 			EEH_HTML::tr(
547
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
547
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
548 548
 				EEH_HTML::td(
549 549
 					$update_button->get_html_for_input()
550 550
 				)
@@ -561,11 +561,11 @@  discard block
 block discarded – undo
561 561
 	 * @param \EE_Payment_Method $payment_method
562 562
 	 * @return \EE_Form_Section_Proper
563 563
 	 */
564
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
565
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
564
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
565
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
566 566
 		return new EE_Form_Section_HTML(
567 567
 			EEH_HTML::tr(
568
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
568
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
569 569
 				EEH_HTML::td(
570 570
 					EEH_HTML::link(
571 571
 						EE_Admin_Page::add_query_args_and_nonce(
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 						),
578 578
 						$link_text_and_title,
579 579
 						$link_text_and_title,
580
-						'deactivate_' . $payment_method->slug(),
580
+						'deactivate_'.$payment_method->slug(),
581 581
 						'espresso-button button-secondary'
582 582
 					)
583 583
 				)
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	 * @param \EE_Payment_Method $payment_method
594 594
 	 * @return \EE_Form_Section_Proper
595 595
 	 */
596
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
597
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
596
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
597
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
598 598
 		return new EE_Form_Section_Proper(
599 599
 			array(
600
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
601
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
600
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
601
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
602 602
 				'action' 	=> '#',
603 603
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
604 604
 				'subsections' 			=> apply_filters(
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 						new EE_Form_Section_HTML(
608 608
 							EEH_HTML::tr(
609 609
 								EEH_HTML::th(
610
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
611
-								) .
610
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
611
+								).
612 612
 								EEH_HTML::td(
613 613
 									EEH_HTML::link(
614 614
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 										),
621 621
 										$link_text_and_title,
622 622
 										$link_text_and_title,
623
-										'activate_' . $payment_method->slug(),
623
+										'activate_'.$payment_method->slug(),
624 624
 										'espresso-button-green button-primary'
625 625
 									)
626 626
 								)
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 	protected function _fine_print() {
643 643
 		return new EE_Form_Section_HTML(
644 644
 			EEH_HTML::tr(
645
-				EEH_HTML::th() .
645
+				EEH_HTML::th().
646 646
 				EEH_HTML::td(
647
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
647
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
648 648
 				)
649 649
 			)
650 650
 		);
@@ -656,15 +656,15 @@  discard block
 block discarded – undo
656 656
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
657 657
 	 * @global WP_User $current_user
658 658
 	 */
659
-	protected function _activate_payment_method(){
660
-		if(isset($this->_req_data['payment_method_type'])){
659
+	protected function _activate_payment_method() {
660
+		if (isset($this->_req_data['payment_method_type'])) {
661 661
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
662 662
 			//see if one exists
663
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
664
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
663
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
664
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
665 665
 
666
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
667
-		}else{
666
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
667
+		} else {
668 668
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
669 669
 		}
670 670
 	}
@@ -672,14 +672,14 @@  discard block
 block discarded – undo
672 672
 	/**
673 673
 	 * Deactivates the payment method with the specified slug, and redirects.
674 674
 	 */
675
-	protected function _deactivate_payment_method(){
676
-		if(isset($this->_req_data['payment_method'])){
675
+	protected function _deactivate_payment_method() {
676
+		if (isset($this->_req_data['payment_method'])) {
677 677
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
678 678
 			//deactivate it
679 679
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
680
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
681
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
682
-		}else{
680
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
681
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
682
+		} else {
683 683
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
684 684
 		}
685 685
 	}
@@ -693,39 +693,39 @@  discard block
 block discarded – undo
693 693
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
694 694
 	 * @return void
695 695
 	 */
696
-	protected function _update_payment_method(){
697
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
696
+	protected function _update_payment_method() {
697
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
698 698
 			//ok let's find which gateway form to use based on the form input
699 699
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
700 700
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
701 701
 			$correct_pmt_form_to_use = NULL;
702 702
 			$pmt_obj = NULL;
703
-			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){
703
+			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
704 704
 				/** @var $pmt_obj EE_PMT_Base */
705 705
 				//get the form and simplify it, like what we do when we display it
706 706
 				$pmt_form = $pmt_obj->settings_form();
707 707
 				$this->_simplify_form($pmt_form);
708
-				if($pmt_form->form_data_present_in($this->_req_data)){
708
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
709 709
 					$correct_pmt_form_to_use = $pmt_form;
710 710
 					break;
711 711
 				}
712 712
 			}
713 713
 			//if we couldn't find the correct payment method type...
714
-			if( ! $correct_pmt_form_to_use ){
714
+			if ( ! $correct_pmt_form_to_use) {
715 715
 				EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
716 716
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
717 717
 			}
718 718
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
719
-			if($correct_pmt_form_to_use->is_valid()){
719
+			if ($correct_pmt_form_to_use->is_valid()) {
720 720
 				$correct_pmt_form_to_use->save();
721 721
 				$pm = $correct_pmt_form_to_use->get_model_object();
722 722
 				/** @var $pm EE_Payment_Method */
723
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
724
-			}else{
723
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug()));
724
+			} else {
725 725
 				EE_Error::add_error(
726 726
 					sprintf(
727 727
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
728
-						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )
728
+						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso')
729 729
 					),
730 730
 					__FILE__,
731 731
 					__FUNCTION__,
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	protected function _payment_settings() {
743 743
 
744 744
 		$this->_template_args['values'] = $this->_yes_no_values;
745
-		$this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE;
745
+		$this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE;
746 746
 
747
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
748
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
749
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
747
+		$this->_set_add_edit_form_tags('update_payment_settings');
748
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
749
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
750 750
 		$this->display_admin_page_with_sidebar();
751 751
 
752 752
 	}
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
 	*		@return array
761 761
 	*/
762 762
 	protected function _update_payment_settings() {
763
-		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
764
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
763
+		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE;
764
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
765 765
 
766 766
 
767
-		$what = __('Payment Settings','event_espresso');
768
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
769
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
767
+		$what = __('Payment Settings', 'event_espresso');
768
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
769
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
770 770
 
771 771
 	}
772 772
 	protected function _payment_log_overview_list_table() {
@@ -792,18 +792,18 @@  discard block
 block discarded – undo
792 792
 	 * @param bool $count
793 793
 	 * @return array
794 794
 	 */
795
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
796
-		EE_Registry::instance()->load_model( 'Change_Log' );
795
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
796
+		EE_Registry::instance()->load_model('Change_Log');
797 797
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
798
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
798
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
799 799
 		//check if they've selected a specific payment method
800
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
800
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
801 801
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
802 802
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
803 803
 		}
804 804
 		//take into account search
805
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
806
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
805
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
806
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
807 807
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
808 808
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
809 809
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -818,48 +818,48 @@  discard block
 block discarded – undo
818 818
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
819 819
 
820 820
 		}
821
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
821
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
822 822
 			//add date
823
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
824
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
823
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
824
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
825 825
 			//make sure our timestamps start and end right at the boundaries for each day
826
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
827
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
826
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
827
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
828 828
 
829 829
 			//convert to timestamps
830
-			$start_date = strtotime( $start_date );
831
-			$end_date = strtotime( $end_date );
830
+			$start_date = strtotime($start_date);
831
+			$end_date = strtotime($end_date);
832 832
 
833 833
 			//makes sure start date is the lowest value and vice versa
834
-			$start_date = min( $start_date, $end_date );
835
-			$end_date = max( $start_date, $end_date );
834
+			$start_date = min($start_date, $end_date);
835
+			$end_date = max($start_date, $end_date);
836 836
 
837 837
 			//convert for query
838
-			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
839
-			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
838
+			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
839
+			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
840 840
 
841
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
841
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
842 842
 
843 843
 		}
844
-		if($count){
844
+		if ($count) {
845 845
 			return EEM_Change_Log::instance()->count($query_params);
846 846
 		}
847
-		if(isset($this->_req_data['order'])){
848
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
847
+		if (isset($this->_req_data['order'])) {
848
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
849 849
 			$query_params['order_by'] = array('LOG_time' => $sort);
850
-		}else{
850
+		} else {
851 851
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
852 852
 		}
853
-		$offset = ($current_page-1)*$per_page;
853
+		$offset = ($current_page - 1) * $per_page;
854 854
 
855
-		if( ! isset($this->_req_data['download_results'])){
856
-			$query_params['limit'] = array( $offset, $per_page );
855
+		if ( ! isset($this->_req_data['download_results'])) {
856
+			$query_params['limit'] = array($offset, $per_page);
857 857
 		}
858 858
 
859 859
 
860 860
 
861 861
 		//now they've requested to instead just download the file instead of viewing it.
862
-		if(isset($this->_req_data['download_results'])){
862
+		if (isset($this->_req_data['download_results'])) {
863 863
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
864 864
 			header('Content-Disposition: attachment');
865 865
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -881,36 +881,36 @@  discard block
 block discarded – undo
881 881
 	 * @param EE_Change_Log $logB
882 882
 	 * @return int
883 883
 	 */
884
-	protected function _sort_logs_again($logA,$logB){
884
+	protected function _sort_logs_again($logA, $logB) {
885 885
 		$timeA = $logA->get_raw('LOG_time');
886 886
 		$timeB = $logB->get_raw('LOG_time');
887
-		if($timeA == $timeB){
887
+		if ($timeA == $timeB) {
888 888
 			return 0;
889 889
 		}
890 890
 		$comparison = $timeA < $timeB ? -1 : 1;
891
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
891
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
892 892
 			return $comparison * -1;
893
-		}else{
893
+		} else {
894 894
 			return $comparison;
895 895
 		}
896 896
 	}
897 897
 
898 898
 	protected function _payment_log_details() {
899
-		EE_Registry::instance()->load_model( 'Change_Log' );
899
+		EE_Registry::instance()->load_model('Change_Log');
900 900
 		/** @var $payment_log EE_Change_Log */
901 901
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
902 902
 		$payment_method = NULL;
903 903
 		$transaction = NULL;
904
-		if( $payment_log instanceof EE_Change_Log ){
905
-			if( $payment_log->object() instanceof EE_Payment ){
904
+		if ($payment_log instanceof EE_Change_Log) {
905
+			if ($payment_log->object() instanceof EE_Payment) {
906 906
 				$payment_method = $payment_log->object()->payment_method();
907 907
 				$transaction = $payment_log->object()->transaction();
908
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
908
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
909 909
 				$payment_method = $payment_log->object();
910 910
 			}
911 911
 		}
912 912
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
913
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
913
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
914 914
 			array(
915 915
 				'payment_log'=>$payment_log,
916 916
 				'payment_method'=>$payment_method,
Please login to merge, or discard this patch.
admin_pages/payments/Payment_Log_Admin_List_Table.class.php 1 patch
Spacing   +28 added lines, -28 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
 /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param \EE_Admin_Page $admin_page
36 36
 	 * @return Payment_Log_Admin_List_Table
37 37
 	 */
38
-	public function __construct( $admin_page ) {
38
+	public function __construct($admin_page) {
39 39
 		parent::__construct($admin_page);
40 40
 	}
41 41
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 //		}else{
53 53
 //			$this->_data = $this->_admin_page->get_questions( $this->_per_page,$this->_current_page, FALSE );
54 54
 //		}
55
-		$this->_all_data_count = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE );
56
-		add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',array($this,'add_download_logs_checkbox'));
55
+		$this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE);
56
+		add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_download_logs_checkbox'));
57 57
 	}
58 58
 
59 59
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters
64 64
 	 * @return void
65 65
 	 */
66
-	public function add_download_logs_checkbox(){
67
-		echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='".  __( 'Download Results', 'event_espresso' )."'>";
66
+	public function add_download_logs_checkbox() {
67
+		echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='".__('Download Results', 'event_espresso')."'>";
68 68
 	}
69 69
 
70 70
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _set_properties() {
77 77
 		$this->_wp_list_args = array(
78
-			'singular' => __('payment log', 'event_espresso' ),
79
-			'plural' => __('payment logs', 'event_espresso' ),
78
+			'singular' => __('payment log', 'event_espresso'),
79
+			'plural' => __('payment logs', 'event_espresso'),
80 80
 			'ajax' => TRUE, //for now,
81 81
 			'screen' => $this->_admin_page->get_current_screen()->id
82 82
 			);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			);
91 91
 
92 92
 		$this->_sortable_columns = array(
93
-			'LOG_time' => array( 'LOG_time' => TRUE ),
93
+			'LOG_time' => array('LOG_time' => TRUE),
94 94
 			);
95 95
 
96 96
 		$this->_hidden_columns = array(
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
 		$filters = array();
109 109
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
110 110
 		$payment_methods = EEM_Payment_Method::instance()->get_all();
111
-		$payment_method_names = array(array('id'=>'all','text'=>  __("All", 'event_espresso')),array('id'=>'0','text'=>  __("Unknown Payment Method", 'event_espresso')));
112
-		foreach($payment_methods as $payment_method){
113
-			$payment_method_names[] = array('id'=>$payment_method->ID(),'text'=>$payment_method->admin_name());
111
+		$payment_method_names = array(array('id'=>'all', 'text'=>  __("All", 'event_espresso')), array('id'=>'0', 'text'=>  __("Unknown Payment Method", 'event_espresso')));
112
+		foreach ($payment_methods as $payment_method) {
113
+			$payment_method_names[] = array('id'=>$payment_method->ID(), 'text'=>$payment_method->admin_name());
114 114
 		}
115 115
 		$filters[] = EEH_Form_Fields::select_input('_payment_method', $payment_method_names, isset($this->_req_data['_payment_method']) ? $this->_req_data['_payment_method'] : 'all');
116
-		$start_date = isset( $this->_req_data['payment-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-6 months' ));
117
-		$end_date = isset( $this->_req_data['payment-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ) : date( 'm/d/Y' );
116
+		$start_date = isset($this->_req_data['payment-filter-start-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) : date('m/d/Y', strtotime('-6 months'));
117
+		$end_date = isset($this->_req_data['payment-filter-end-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) : date('m/d/Y');
118 118
 		ob_start();
119 119
 		?>
120
-		<label for="txn-filter-start-date"><?php _e( 'Display Transactions from ', 'event_espresso' ); ?></label>
120
+		<label for="txn-filter-start-date"><?php _e('Display Transactions from ', 'event_espresso'); ?></label>
121 121
 		<input id="payment-filter-start-date" class="datepicker" type="text" value="<?php echo $start_date; ?>" name="payment-filter-start-date" size="15"/>
122
-		<label for="txn-filter-end-date"><?php _e( ' until ', 'event_espresso' ); ?></label>
122
+		<label for="txn-filter-end-date"><?php _e(' until ', 'event_espresso'); ?></label>
123 123
 		<input id="payment-filter-end-date" class="datepicker" type="text" value="<?php echo $end_date; ?>" name="payment-filter-end-date" size="15"/>
124 124
 		<?php
125 125
 		$filters[] = ob_get_clean();
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	protected function _add_view_counts() {
136
-		$this->_views['all']['count'] = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE );
136
+		$this->_views['all']['count'] = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE);
137 137
 	}
138 138
 
139 139
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return string
145 145
 	 */
146 146
 	public function column_cb($item) {
147
-		return sprintf( '<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID() );
147
+		return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
148 148
 	}
149 149
 
150 150
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param \EE_Change_Log $item
171 171
 	 * @return string
172 172
 	 */
173
-	public function column_LOG_time(EE_Change_Log $item){
173
+	public function column_LOG_time(EE_Change_Log $item) {
174 174
 		return $item->get_datetime('LOG_time');
175 175
 	}
176 176
 
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 	 * @param \EE_Change_Log $item
182 182
 	 * @return string
183 183
 	 */
184
-	public function column_PMD_ID(EE_Change_Log $item){
185
-		if($item->object() instanceof EE_Payment_Method){
184
+	public function column_PMD_ID(EE_Change_Log $item) {
185
+		if ($item->object() instanceof EE_Payment_Method) {
186 186
 			return $item->object()->admin_name();
187
-		}elseif($item->object() instanceof EE_Payment && $item->object()->payment_method()){
187
+		}elseif ($item->object() instanceof EE_Payment && $item->object()->payment_method()) {
188 188
 			return $item->object()->payment_method()->admin_name();
189
-		}else{
189
+		} else {
190 190
 			return __("No longer exists", 'event_espresso');
191 191
 		}
192 192
 	}
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 	 * @param \EE_Change_Log $item
199 199
 	 * @return string
200 200
 	 */
201
-	public function column_TXN_ID(EE_Change_Log $item){
202
-		if($item->object() instanceof EE_Payment){
203
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID() )) {
204
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID() ), TXN_ADMIN_URL );
205
-				return '<a href="'.$view_txn_lnk_url.'"  title="' . sprintf( esc_attr__( 'click to view transaction #%s', 'event_espresso' ),  $item->object()->TXN_ID() ) . '">' . sprintf( __( 'view txn %s', 'event_espresso' ),  $item->object()->TXN_ID() ) . '</a>';
201
+	public function column_TXN_ID(EE_Change_Log $item) {
202
+		if ($item->object() instanceof EE_Payment) {
203
+			if (EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID())) {
204
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID()), TXN_ADMIN_URL);
205
+				return '<a href="'.$view_txn_lnk_url.'"  title="'.sprintf(esc_attr__('click to view transaction #%s', 'event_espresso'), $item->object()->TXN_ID()).'">'.sprintf(__('view txn %s', 'event_espresso'), $item->object()->TXN_ID()).'</a>';
206 206
 			}
207 207
 		} else {
208 208
 			return __("Unable to find transaction", 'event_espresso');
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
 
@@ -582,115 +582,115 @@  discard block
 block discarded – undo
582 582
 		$default_map_settings = new stdClass();
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		// for event details pages (reg page)
585
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
586
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
587
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
588
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
589
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
590
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
591
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
585
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
586
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
587
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
588
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
589
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
590
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
591
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
592 592
 		// for event list pages
593
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
594
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
595
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
596
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
597
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
598
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
599
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
593
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
594
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
595
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
596
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
597
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
598
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
599
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
600 600
 
601 601
 		$this->_template_args['map_settings'] =
602
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
603
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
602
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
603
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
604 604
 				: $default_map_settings;
605 605
 
606
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
607
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
608
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE );
606
+		$this->_set_add_edit_form_tags('update_google_map_settings');
607
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
608
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE);
609 609
 		$this->display_admin_page_with_sidebar();
610 610
 	}
611 611
 
612 612
 	protected function _update_google_map_settings() {
613 613
 
614 614
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
615
-			isset( $this->_req_data['use_google_maps'] )
616
-				? absint( $this->_req_data['use_google_maps'] )
615
+			isset($this->_req_data['use_google_maps'])
616
+				? absint($this->_req_data['use_google_maps'])
617 617
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
620
-			isset( $this->_req_data['event_details_map_width'] )
621
-				? absint( $this->_req_data['event_details_map_width'] )
620
+			isset($this->_req_data['event_details_map_width'])
621
+				? absint($this->_req_data['event_details_map_width'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
625
-			isset( $this->_req_data['event_details_map_height'] )
626
-				? absint( $this->_req_data['event_details_map_height'] )
625
+			isset($this->_req_data['event_details_map_height'])
626
+				? absint($this->_req_data['event_details_map_height'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
630
-			isset( $this->_req_data['event_details_map_zoom'] )
631
-				? absint( $this->_req_data['event_details_map_zoom'] )
630
+			isset($this->_req_data['event_details_map_zoom'])
631
+				? absint($this->_req_data['event_details_map_zoom'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
635
-			isset( $this->_req_data['event_details_display_nav'] )
636
-				? absint( $this->_req_data['event_details_display_nav'] )
635
+			isset($this->_req_data['event_details_display_nav'])
636
+				? absint($this->_req_data['event_details_display_nav'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
640
-			isset( $this->_req_data['event_details_nav_size'] )
641
-				? absint( $this->_req_data['event_details_nav_size'] )
640
+			isset($this->_req_data['event_details_nav_size'])
641
+				? absint($this->_req_data['event_details_nav_size'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
645
-			isset( $this->_req_data['event_details_control_type'] )
646
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
645
+			isset($this->_req_data['event_details_control_type'])
646
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
650
-			isset( $this->_req_data['event_details_map_align'] )
651
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
650
+			isset($this->_req_data['event_details_map_align'])
651
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
655
-			isset( $this->_req_data['event_list_map_width'] )
656
-				? absint( $this->_req_data['event_list_map_width'] )
655
+			isset($this->_req_data['event_list_map_width'])
656
+				? absint($this->_req_data['event_list_map_width'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
660
-			isset( $this->_req_data['event_list_map_height'] )
661
-				? absint( $this->_req_data['event_list_map_height'] )
660
+			isset($this->_req_data['event_list_map_height'])
661
+				? absint($this->_req_data['event_list_map_height'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
665
-			isset( $this->_req_data['event_list_map_zoom'] )
666
-				? absint( $this->_req_data['event_list_map_zoom'] )
665
+			isset($this->_req_data['event_list_map_zoom'])
666
+				? absint($this->_req_data['event_list_map_zoom'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
670
-			isset( $this->_req_data['event_list_display_nav'] )
671
-				? absint( $this->_req_data['event_list_display_nav'] )
670
+			isset($this->_req_data['event_list_display_nav'])
671
+				? absint($this->_req_data['event_list_display_nav'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
675
-			isset( $this->_req_data['event_list_nav_size'] )
676
-				? absint( $this->_req_data['event_list_nav_size'] )
675
+			isset($this->_req_data['event_list_nav_size'])
676
+				? absint($this->_req_data['event_list_nav_size'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
680
-			isset( $this->_req_data['event_list_control_type'] )
681
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
680
+			isset($this->_req_data['event_list_control_type'])
681
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
685
-			isset( $this->_req_data['event_list_map_align'] )
686
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
685
+			isset($this->_req_data['event_list_map_align'])
686
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
688 688
 
689
-		EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings );
689
+		EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings);
690 690
 
691 691
 		$what = 'Google Map Settings';
692
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ );
693
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
692
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__);
693
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
694 694
 
695 695
 	}
696 696
 
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 	protected function _venue_editor_metaboxes() {
700 700
 		$this->verify_cpt_object();
701 701
 
702
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
703
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
704
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
702
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
703
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
704
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
705 705
 
706 706
 	}
707 707
 
@@ -709,23 +709,23 @@  discard block
 block discarded – undo
709 709
 
710 710
 	public function venue_gmap_metabox() {
711 711
 		$template_args = array(
712
-			'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() ),
712
+			'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()),
713 713
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
714 714
 			);
715
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
716
-		EEH_Template::display_template( $template, $template_args );
715
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
716
+		EEH_Template::display_template($template, $template_args);
717 717
 	}
718 718
 
719 719
 
720 720
 
721 721
 	public function venue_address_metabox() {
722 722
 
723
-		$template_args['_venue'] =$this->_cpt_model_obj;
723
+		$template_args['_venue'] = $this->_cpt_model_obj;
724 724
 
725 725
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
726 726
 			$QFI = new EE_Question_Form_Input(
727
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
728
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
727
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
728
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
729 729
 				array(
730 730
 					'input_name' =>  'sta_id',
731 731
 					'input_id' => 'sta_id',
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 		);
738 738
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
739 739
 			$QFI = new EE_Question_Form_Input(
740
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
741
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
740
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
741
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
742 742
 				array(
743 743
 					'input_name' =>  'cnt_iso',
744 744
 					'input_id' => 'cnt_iso',
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 			)
750 750
 		);
751 751
 
752
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
753
-		EEH_Template::display_template( $template, $template_args );
752
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
753
+		EEH_Template::display_template($template, $template_args);
754 754
 	}
755 755
 
756 756
 
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 		$template_args = array(
763 763
 			'_venue' => $this->_cpt_model_obj
764 764
 			);
765
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
766
-		EEH_Template::display_template( $template, $template_args );
765
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
766
+		EEH_Template::display_template($template, $template_args);
767 767
 	}
768 768
 
769 769
 
@@ -786,52 +786,52 @@  discard block
 block discarded – undo
786 786
 	 * @param  object $post    Post object (with "blessed" WP properties)
787 787
 	 * @return void
788 788
 	 */
789
-	protected function _insert_update_cpt_item( $post_id, $post ) {
789
+	protected function _insert_update_cpt_item($post_id, $post) {
790 790
 
791
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
792
-			return;// get out we're not processing the saving of venues.
791
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
792
+			return; // get out we're not processing the saving of venues.
793 793
 		}
794 794
 
795
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
795
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
796 796
 
797 797
 		$venue_values = array(
798
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
799
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
800
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
801
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
802
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
803
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
804
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
805
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
806
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
807
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
810
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
798
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
799
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
800
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
801
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
802
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
803
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
804
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
805
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
806
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
807
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
810
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
811 811
 			);
812 812
 
813 813
 		//update venue
814
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
814
+		$success = $this->_venue_model->update($venue_values, array($wheres));
815 815
 
816 816
 		//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!
817
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
818
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
817
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
818
+		$venue = $this->_venue_model->get_one(array($get_one_where));
819 819
 
820 820
 		//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.
821
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
821
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
822 822
 
823 823
 		$att_success = TRUE;
824 824
 
825
-		foreach ( $venue_update_callbacks as $v_callback ) {
826
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
827
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
825
+		foreach ($venue_update_callbacks as $v_callback) {
826
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
827
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
828 828
 		}
829 829
 
830 830
 		//any errors?
831
-		if ( $success && !$att_success ) {
832
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
833
-		} else if ( $success === FALSE ) {
834
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
831
+		if ($success && ! $att_success) {
832
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
833
+		} else if ($success === FALSE) {
834
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
835 835
 		}
836 836
 	}
837 837
 
@@ -839,9 +839,9 @@  discard block
 block discarded – undo
839 839
 
840 840
 
841 841
 
842
-	public function trash_cpt_item( $post_id ) {
842
+	public function trash_cpt_item($post_id) {
843 843
 		$this->_req_data['VNU_ID'] = $post_id;
844
-		$this->_trash_or_restore_venue( 'trash', FALSE );
844
+		$this->_trash_or_restore_venue('trash', FALSE);
845 845
 	}
846 846
 
847 847
 
@@ -849,18 +849,18 @@  discard block
 block discarded – undo
849 849
 
850 850
 
851 851
 
852
-	public function restore_cpt_item( $post_id ) {
852
+	public function restore_cpt_item($post_id) {
853 853
 		$this->_req_data['VNU_ID'] = $post_id;
854
-		$this->_trash_or_restore_venue( 'draft', FALSE );
854
+		$this->_trash_or_restore_venue('draft', FALSE);
855 855
 	}
856 856
 
857 857
 
858 858
 
859 859
 
860 860
 
861
-	public function delete_cpt_item( $post_id ) {
861
+	public function delete_cpt_item($post_id) {
862 862
 		$this->_req_data['VNU_ID'] = $post_id;
863
-		$this->_delete_venue( FALSE );
863
+		$this->_delete_venue(FALSE);
864 864
 	}
865 865
 
866 866
 
@@ -875,15 +875,15 @@  discard block
 block discarded – undo
875 875
 
876 876
 
877 877
 
878
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
879
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
878
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
879
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
880 880
 
881 881
 		//loop thru venues
882
-		if ( $VNU_ID ) {
882
+		if ($VNU_ID) {
883 883
 			//clean status
884
-			$venue_status = sanitize_key( $venue_status );
884
+			$venue_status = sanitize_key($venue_status);
885 885
 			// grab status
886
-			if (!empty($venue_status)) {
886
+			if ( ! empty($venue_status)) {
887 887
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
888 888
 			} else {
889 889
 				$success = FALSE;
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 		}
898 898
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
899 899
 
900
-		if ( $redirect_after )
900
+		if ($redirect_after)
901 901
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
902 902
 
903 903
 	}
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
 
907 907
 
908 908
 
909
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
909
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
910 910
 		// clean status
911 911
 		$venue_status = sanitize_key($venue_status);
912 912
 		// grab status
913
-		if (!empty($venue_status)) {
913
+		if ( ! empty($venue_status)) {
914 914
 			$success = TRUE;
915 915
 			//determine the event id and set to array.
916 916
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -950,20 +950,20 @@  discard block
 block discarded – undo
950 950
 	 * @param  string $venue_status
951 951
 	 * @return void
952 952
 	 */
953
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
953
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
954 954
 		// grab venue id
955
-		if (! $VNU_ID) {
955
+		if ( ! $VNU_ID) {
956 956
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
957 957
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
958 958
 			return FALSE;
959 959
 		}
960 960
 
961
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
961
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
962 962
 
963 963
 		// clean status
964 964
 		$venue_status = sanitize_key($venue_status);
965 965
 		// grab status
966
-		if ( ! $venue_status ) {
966
+		if ( ! $venue_status) {
967 967
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
968 968
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
969 969
 			return FALSE;
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 				$hook = FALSE;
985 985
 		}
986 986
 		//use class to change status
987
-		$this->_cpt_model_obj->set_status( $venue_status );
987
+		$this->_cpt_model_obj->set_status($venue_status);
988 988
 		$success = $this->_cpt_model_obj->save();
989 989
 
990 990
 		if ($success === FALSE) {
@@ -1003,21 +1003,21 @@  discard block
 block discarded – undo
1003 1003
 	 * @param  bool $redirect_after
1004 1004
 	 * @return void
1005 1005
 	 */
1006
-	protected function _delete_venue( $redirect_after = true ) {
1006
+	protected function _delete_venue($redirect_after = true) {
1007 1007
 		//determine the venue id and set to array.
1008 1008
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1009
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1009
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1010 1010
 
1011 1011
 
1012 1012
 		// loop thru venues
1013 1013
 		if ($VNU_ID) {
1014
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1014
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1015 1015
 		} else {
1016 1016
 			$success = FALSE;
1017 1017
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1018 1018
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1019 1019
 		}
1020
-		if ( $redirect_after )
1020
+		if ($redirect_after)
1021 1021
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1022 1022
 	}
1023 1023
 
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 	//todo: put in parent
1050 1050
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1051 1051
 		// grab event id
1052
-		if (!$VNU_ID = absint($VNU_ID)) {
1052
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1053 1053
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1054 1054
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1055 1055
 			return FALSE;
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1070 1070
 			return FALSE;
1071 1071
 		}
1072
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1072
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1073 1073
 		return TRUE;
1074 1074
 	}
1075 1075
 
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 	/* QUERIES */
1081 1081
 
1082 1082
 
1083
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1083
+	public function get_venues($per_page = 10, $count = FALSE) {
1084 1084
 
1085
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1085
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1086 1086
 
1087
-		switch ( $_orderby ) {
1087
+		switch ($_orderby) {
1088 1088
 			case 'id':
1089 1089
 				$orderby = 'VNU_ID';
1090 1090
 				break;
@@ -1102,43 +1102,43 @@  discard block
 block discarded – undo
1102 1102
 		}
1103 1103
 
1104 1104
 
1105
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1105
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1106 1106
 
1107
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1108
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1109
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1107
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1108
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1109
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1110 1110
 
1111 1111
 
1112
-		$offset = ($current_page-1)*$per_page;
1112
+		$offset = ($current_page - 1) * $per_page;
1113 1113
 		$limit = array($offset, $per_page);
1114 1114
 
1115
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1115
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1116 1116
 		$where = array();
1117 1117
 
1118 1118
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1119
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1119
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1120 1120
 			$where['status'] = $this->_req_data['status'];
1121 1121
 		}
1122 1122
 
1123
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1123
+		if (isset($this->_req_data['venue_status'])) {
1124 1124
 			$where['status'] = $this->_req_data['venue_status'];
1125 1125
 		}
1126 1126
 
1127 1127
 
1128
-		if ( $category ) {
1128
+		if ($category) {
1129 1129
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1130 1130
 			$where['Term_Taxonomy.term_id'] = $category;
1131 1131
 		}
1132 1132
 
1133 1133
 
1134
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1135
-			$where['VNU_wp_user'] =  get_current_user_id();
1134
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1135
+			$where['VNU_wp_user'] = get_current_user_id();
1136 1136
 		} else {
1137
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1137
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1138 1138
 					$where['OR'] = array(
1139
-						'status*restrict_private' => array( '!=', 'private' ),
1139
+						'status*restrict_private' => array('!=', 'private'),
1140 1140
 						'AND'                     => array(
1141
-							'status*inclusive' => array( '=', 'private' ),
1141
+							'status*inclusive' => array('=', 'private'),
1142 1142
 							'VNU_wp_user'      => get_current_user_id()
1143 1143
 						)
1144 1144
 					);
@@ -1148,30 +1148,30 @@  discard block
 block discarded – undo
1148 1148
 
1149 1149
 
1150 1150
 
1151
-		if ( isset( $this->_req_data['s'] ) ) {
1152
-			$sstr = '%' . $this->_req_data['s'] . '%';
1151
+		if (isset($this->_req_data['s'])) {
1152
+			$sstr = '%'.$this->_req_data['s'].'%';
1153 1153
 			$where['OR'] = array(
1154
-				'VNU_name' => array('LIKE',$sstr ),
1155
-				'VNU_desc' => array('LIKE',$sstr ),
1156
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1157
-				'VNU_address' => array( 'LIKE', $sstr ),
1158
-				'VNU_address2' => array( 'LIKE', $sstr ),
1159
-				'VNU_city' => array( 'LIKE', $sstr ),
1160
-				'VNU_zip' => array( 'LIKE', $sstr ),
1161
-				'VNU_phone' => array( 'LIKE', $sstr ),
1162
-				'VNU_url' => array( 'LIKE', $sstr ),
1163
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1164
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1165
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1166
-				'Event.EVT_name' => array('LIKE', $sstr ),
1167
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1168
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1169
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1154
+				'VNU_name' => array('LIKE', $sstr),
1155
+				'VNU_desc' => array('LIKE', $sstr),
1156
+				'VNU_short_desc' => array('LIKE', $sstr),
1157
+				'VNU_address' => array('LIKE', $sstr),
1158
+				'VNU_address2' => array('LIKE', $sstr),
1159
+				'VNU_city' => array('LIKE', $sstr),
1160
+				'VNU_zip' => array('LIKE', $sstr),
1161
+				'VNU_phone' => array('LIKE', $sstr),
1162
+				'VNU_url' => array('LIKE', $sstr),
1163
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1164
+				'VNU_virtual_url' => array('LIKE', $sstr),
1165
+				'VNU_google_map_link' => array('LIKE', $sstr),
1166
+				'Event.EVT_name' => array('LIKE', $sstr),
1167
+				'Event.EVT_desc' => array('LIKE', $sstr),
1168
+				'Event.EVT_phone' => array('LIKE', $sstr),
1169
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1170 1170
 				);
1171 1171
 		}
1172 1172
 
1173 1173
 
1174
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1174
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1175 1175
 
1176 1176
 		return $venues;
1177 1177
 
@@ -1189,22 +1189,22 @@  discard block
 block discarded – undo
1189 1189
 	 * @return void
1190 1190
 	 */
1191 1191
 	private function _set_category_object() {
1192
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1192
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1193 1193
 			return; //already have the category object so get out.
1194 1194
 
1195 1195
 		//set default category object
1196 1196
 		$this->_set_empty_category_object();
1197 1197
 
1198 1198
 		//only set if we've got an id
1199
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1199
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1200 1200
 			return;
1201 1201
 		}
1202 1202
 
1203 1203
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1204
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1204
+		$term = get_term($category_id, 'espresso_venue_categories');
1205 1205
 
1206 1206
 
1207
-		if ( !empty( $term ) ) {
1207
+		if ( ! empty($term)) {
1208 1208
 			$this->_category->category_name = $term->name;
1209 1209
 			$this->_category->category_identifier = $term->slug;
1210 1210
 			$this->_category->category_desc = $term->description;
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 
1219 1219
 	private function _set_empty_category_object() {
1220 1220
 		$this->_category = new stdClass();
1221
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1221
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1222 1222
 		$this->_category->id = $this->_category->parent = 0;
1223 1223
 	}
1224 1224
 
1225 1225
 
1226 1226
 
1227 1227
 	protected function _category_list_table() {
1228
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1228
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1229 1229
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1230 1230
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1231 1231
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1241,13 +1241,13 @@  discard block
 block discarded – undo
1241 1241
 		$this->_set_add_edit_form_tags($route);
1242 1242
 
1243 1243
 		$this->_set_category_object();
1244
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1244
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1245 1245
 
1246 1246
 		$delete_action = 'delete_category';
1247 1247
 
1248
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1248
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1249 1249
 
1250
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1250
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1251 1251
 
1252 1252
 		//take care of contents
1253 1253
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1261,25 +1261,25 @@  discard block
 block discarded – undo
1261 1261
 			'type' => 'wp_editor',
1262 1262
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1263 1263
 			'class' => 'my_editor_custom',
1264
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1264
+			'wpeditor_args' => array('media_buttons' => FALSE)
1265 1265
 		);
1266
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1266
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1267 1267
 
1268
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1268
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1269 1269
 
1270 1270
 		//setup category select for term parents.
1271 1271
 		$category_select_values[] = array(
1272 1272
 			'text' => __('No Parent', 'event_espresso'),
1273 1273
 			'id' => 0
1274 1274
 			);
1275
-		foreach ( $all_terms as $term ) {
1275
+		foreach ($all_terms as $term) {
1276 1276
 			$category_select_values[] = array(
1277 1277
 				'text' => $term->name,
1278 1278
 				'id' => $term->term_id
1279 1279
 				);
1280 1280
 		}
1281 1281
 
1282
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1282
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1283 1283
 		$template_args = array(
1284 1284
 			'category' => $this->_category,
1285 1285
 			'category_select' => $category_select,
@@ -1288,15 +1288,15 @@  discard block
 block discarded – undo
1288 1288
 			'disable' => '',
1289 1289
 			'disabled_message' =>FALSE
1290 1290
 			);
1291
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1292
-		return EEH_Template::display_template($template, $template_args, TRUE );
1291
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1292
+		return EEH_Template::display_template($template, $template_args, TRUE);
1293 1293
 	}
1294 1294
 
1295 1295
 
1296 1296
 	protected function _delete_categories() {
1297
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1297
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1298 1298
 
1299
-		foreach ( $cat_ids as $cat_id ) {
1299
+		foreach ($cat_ids as $cat_id) {
1300 1300
 			$this->_delete_category($cat_id);
1301 1301
 		}
1302 1302
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 		$query_args = array(
1305 1305
 			'action' => 'category_list'
1306 1306
 			);
1307
-		$this->_redirect_after_action(0,'','',$query_args);
1307
+		$this->_redirect_after_action(0, '', '', $query_args);
1308 1308
 
1309 1309
 	}
1310 1310
 
@@ -1313,58 +1313,58 @@  discard block
 block discarded – undo
1313 1313
 
1314 1314
 
1315 1315
 	protected function _delete_category($cat_id) {
1316
-		$cat_id = absint( $cat_id );
1317
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1316
+		$cat_id = absint($cat_id);
1317
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1318 1318
 	}
1319 1319
 
1320 1320
 
1321 1321
 
1322 1322
 	protected function _insert_or_update_category($new_category) {
1323 1323
 
1324
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1324
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1325 1325
 		$success = 0; //we already have a success message so lets not send another.
1326
-		if ( $cat_id ) {
1326
+		if ($cat_id) {
1327 1327
 			$query_args = array(
1328 1328
 				'action'     => 'edit_category',
1329 1329
 				'VEN_CAT_ID' => $cat_id
1330 1330
 			);
1331 1331
 		} else {
1332
-			$query_args = array( 'action' => 'add_category' );
1332
+			$query_args = array('action' => 'add_category');
1333 1333
 		}
1334
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1334
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1335 1335
 
1336 1336
 	}
1337 1337
 
1338 1338
 
1339 1339
 
1340
-	private function _insert_category( $update = FALSE ) {
1340
+	private function _insert_category($update = FALSE) {
1341 1341
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1342
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1343
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1344
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1342
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1343
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1344
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1345 1345
 
1346
-		if ( empty( $category_name ) ) {
1347
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1348
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1346
+		if (empty($category_name)) {
1347
+			$msg = __('You must add a name for the category.', 'event_espresso');
1348
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1349 1349
 			return false;
1350 1350
 		}
1351 1351
 
1352 1352
 
1353
-		$term_args=array(
1353
+		$term_args = array(
1354 1354
 			'name'=>$category_name,
1355 1355
 			'description'=>$category_desc,
1356 1356
 			'parent'=>$category_parent
1357 1357
 		);
1358 1358
 
1359
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1359
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1360 1360
 
1361
-		if ( !is_array( $insert_ids ) ) {
1362
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1363
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1361
+		if ( ! is_array($insert_ids)) {
1362
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1363
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1364 1364
 		} else {
1365 1365
 			$cat_id = $insert_ids['term_id'];
1366
-			$msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name );
1367
-			EE_Error::add_success( $msg );
1366
+			$msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name);
1367
+			EE_Error::add_success($msg);
1368 1368
 		}
1369 1369
 
1370 1370
 		return $cat_id;
@@ -1384,11 +1384,11 @@  discard block
 block discarded – undo
1384 1384
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1385 1385
 			);
1386 1386
 
1387
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1387
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1388 1388
 
1389
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1390
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1391
-			$EE_Export = EE_Export::instance( $this->_req_data );
1389
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1390
+			require_once(EE_CLASSES.'EE_Export.class.php');
1391
+			$EE_Export = EE_Export::instance($this->_req_data);
1392 1392
 			$EE_Export->export();
1393 1393
 		}
1394 1394
 
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 
1401 1401
 	protected function _import_categories() {
1402 1402
 
1403
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1403
+		require_once(EE_CLASSES.'EE_Import.class.php');
1404 1404
 		EE_Import::instance()->import();
1405 1405
 
1406 1406
 	}
@@ -1408,29 +1408,29 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
 
1410 1410
 
1411
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1411
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1412 1412
 
1413 1413
 		//testing term stuff
1414
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1416
-		$limit = ($current_page-1)*$per_page;
1417
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1418
-		if ( isset( $this->_req_data['s'] ) ) {
1419
-			$sstr = '%' . $this->_req_data['s'] . '%';
1414
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1416
+		$limit = ($current_page - 1) * $per_page;
1417
+		$where = array('taxonomy' => 'espresso_venue_categories');
1418
+		if (isset($this->_req_data['s'])) {
1419
+			$sstr = '%'.$this->_req_data['s'].'%';
1420 1420
 			$where['OR'] = array(
1421
-				'Term.name' => array( 'LIKE', $sstr),
1422
-				'description' => array( 'LIKE', $sstr )
1421
+				'Term.name' => array('LIKE', $sstr),
1422
+				'description' => array('LIKE', $sstr)
1423 1423
 				);
1424 1424
 		}
1425 1425
 
1426 1426
 		$query_params = array(
1427 1427
 			$where,
1428
-			'order_by' => array( $orderby => $order ),
1429
-			'limit' => $limit . ',' . $per_page,
1428
+			'order_by' => array($orderby => $order),
1429
+			'limit' => $limit.','.$per_page,
1430 1430
 			'force_join' => array('Term')
1431 1431
 			);
1432 1432
 
1433
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1433
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1434 1434
 
1435 1435
 		return $categories;
1436 1436
 	}
Please login to merge, or discard this patch.