wp/wp-admin/includes/class-wp-community-events.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-admin/includes/class-wp-community-events.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-admin/includes/class-wp-community-events.php	Mon Oct 14 18:28:13 2019 +0200
@@ -95,8 +95,8 @@
 		// include an unmodified $wp_version
 		include( ABSPATH . WPINC . '/version.php' );
 
-		$api_url      = 'http://api.wordpress.org/events/1.0/';
-		$request_args = $this->get_request_args( $location_search, $timezone );
+		$api_url                    = 'http://api.wordpress.org/events/1.0/';
+		$request_args               = $this->get_request_args( $location_search, $timezone );
 		$request_args['user-agent'] = 'WordPress/' . $wp_version . '; ' . home_url( '/' );
 
 		if ( wp_http_supports( array( 'ssl' ) ) ) {
@@ -203,7 +203,7 @@
 
 		// Wrap the args in an array compatible with the second parameter of `wp_remote_get()`.
 		return array(
-			'body' => $args
+			'body' => $args,
 		);
 	}
 
@@ -233,7 +233,7 @@
 	 *                      or false on failure.
 	 */
 	public static function get_unsafe_client_ip() {
-		$client_ip = $netmask = false;
+		$client_ip = false;
 
 		// In order of preference, with the best ones for this purpose first.
 		$address_headers = array(
@@ -308,7 +308,7 @@
 
 		if ( isset( $location['ip'] ) ) {
 			$key = 'community-events-' . md5( $location['ip'] );
-		} else if ( isset( $location['latitude'], $location['longitude'] ) ) {
+		} elseif ( isset( $location['latitude'], $location['longitude'] ) ) {
 			$key = 'community-events-' . md5( $location['latitude'] . $location['longitude'] );
 		}
 
@@ -425,7 +425,7 @@
 			$response_body['events'] = array_slice( $response_body['events'], 0, 3 );
 			$trimmed_event_types     = wp_list_pluck( $response_body['events'], 'type' );
 
-			// Make sure the soonest upcoming WordCamps is pinned in the list.
+			// Make sure the soonest upcoming WordCamp is pinned in the list.
 			if ( ! in_array( 'wordcamp', $trimmed_event_types ) && $wordcamps ) {
 				array_pop( $response_body['events'] );
 				array_push( $response_body['events'], $wordcamps[0] );
@@ -452,11 +452,13 @@
 			return;
 		}
 
-		error_log( sprintf(
-			'%s: %s. Details: %s',
-			__METHOD__,
-			trim( $message, '.' ),
-			wp_json_encode( $details )
-		) );
+		error_log(
+			sprintf(
+				'%s: %s. Details: %s',
+				__METHOD__,
+				trim( $message, '.' ),
+				wp_json_encode( $details )
+			)
+		);
 	}
 }