Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-includes/widgets/class-wp-widget-tag-cloud.php 3 patches
Switch Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -128,38 +128,38 @@
 block discarded – undo
128 128
 		switch ( count( $taxonomies ) ) {
129 129
 
130 130
 		// No tag cloud supporting taxonomies found, display error message
131
-		case 0:
132
-			echo '<p>' . __( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ) . '</p>';
133
-			printf( $input, '' );
134
-			break;
135
-
136
-		// Just a single tag cloud supporting taxonomy found, no need to display options
137
-		case 1:
138
-			$keys = array_keys( $taxonomies );
139
-			$taxonomy = reset( $keys );
140
-			printf( $input, esc_attr( $taxonomy ) );
141
-			break;
142
-
143
-		// More than one tag cloud supporting taxonomy found, display options
144
-		default:
145
-			printf(
146
-				'<p><label for="%1$s">%2$s</label>' .
147
-				'<select class="widefat" id="%1$s" name="%3$s">',
148
-				$id,
149
-				__( 'Taxonomy:' ),
150
-				$name
151
-			);
152
-
153
-			foreach ( $taxonomies as $taxonomy => $tax ) {
131
+			case 0:
132
+				echo '<p>' . __( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ) . '</p>';
133
+				printf( $input, '' );
134
+				break;
135
+
136
+			// Just a single tag cloud supporting taxonomy found, no need to display options
137
+			case 1:
138
+				$keys = array_keys( $taxonomies );
139
+				$taxonomy = reset( $keys );
140
+				printf( $input, esc_attr( $taxonomy ) );
141
+				break;
142
+
143
+			// More than one tag cloud supporting taxonomy found, display options
144
+			default:
154 145
 				printf(
155
-					'<option value="%s"%s>%s</option>',
156
-					esc_attr( $taxonomy ),
157
-					selected( $taxonomy, $current_taxonomy, false ),
158
-					$tax->labels->name
146
+					'<p><label for="%1$s">%2$s</label>' .
147
+					'<select class="widefat" id="%1$s" name="%3$s">',
148
+					$id,
149
+					__( 'Taxonomy:' ),
150
+					$name
159 151
 				);
160
-			}
161 152
 
162
-			echo '</select></p>';
153
+				foreach ( $taxonomies as $taxonomy => $tax ) {
154
+					printf(
155
+						'<option value="%s"%s>%s</option>',
156
+						esc_attr( $taxonomy ),
157
+						selected( $taxonomy, $current_taxonomy, false ),
158
+						$tax->labels->name
159
+					);
160
+				}
161
+
162
+				echo '</select></p>';
163 163
 		}
164 164
 	}
165 165
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,8 +173,9 @@
 block discarded – undo
173 173
 	 * @return string Name of the current taxonomy if set, otherwise 'post_tag'.
174 174
 	 */
175 175
 	public function _get_current_taxonomy($instance) {
176
-		if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
177
-			return $instance['taxonomy'];
176
+		if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) ) {
177
+					return $instance['taxonomy'];
178
+		}
178 179
 
179 180
 		return 'post_tag';
180 181
 	}
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 		$widget_ops = array(
27
-			'description' => __( 'A cloud of your most used tags.' ),
27
+			'description' => __('A cloud of your most used tags.'),
28 28
 			'customize_selective_refresh' => true,
29 29
 		);
30
-		parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops );
30
+		parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
31 31
 	}
32 32
 
33 33
 	/**
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 *                        'before_widget', and 'after_widget'.
41 41
 	 * @param array $instance Settings for the current Tag Cloud widget instance.
42 42
 	 */
43
-	public function widget( $args, $instance ) {
43
+	public function widget($args, $instance) {
44 44
 		$current_taxonomy = $this->_get_current_taxonomy($instance);
45
-		if ( !empty($instance['title']) ) {
45
+		if ( ! empty($instance['title'])) {
46 46
 			$title = $instance['title'];
47 47
 		} else {
48
-			if ( 'post_tag' == $current_taxonomy ) {
48
+			if ('post_tag' == $current_taxonomy) {
49 49
 				$title = __('Tags');
50 50
 			} else {
51 51
 				$tax = get_taxonomy($current_taxonomy);
@@ -63,21 +63,21 @@  discard block
 block discarded – undo
63 63
 		 *
64 64
 		 * @param array $current_taxonomy The taxonomy to use in the tag cloud. Default 'tags'.
65 65
 		 */
66
-		$tag_cloud = wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(
66
+		$tag_cloud = wp_tag_cloud(apply_filters('widget_tag_cloud_args', array(
67 67
 			'taxonomy' => $current_taxonomy,
68 68
 			'echo' => false
69
-		) ) );
69
+		)));
70 70
 
71
-		if ( empty( $tag_cloud ) ) {
71
+		if (empty($tag_cloud)) {
72 72
 			return;
73 73
 		}
74 74
 
75 75
 		/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
76
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
76
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
77 77
 
78 78
 		echo $args['before_widget'];
79
-		if ( $title ) {
80
-			echo $args['before_title'] . $title . $args['after_title'];
79
+		if ($title) {
80
+			echo $args['before_title'].$title.$args['after_title'];
81 81
 		}
82 82
 
83 83
 		echo '<div class="tagcloud">';
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @param array $old_instance Old settings for this instance.
100 100
 	 * @return array Settings to save or bool false to cancel saving.
101 101
 	 */
102
-	public function update( $new_instance, $old_instance ) {
102
+	public function update($new_instance, $old_instance) {
103 103
 		$instance = array();
104
-		$instance['title'] = sanitize_text_field( $new_instance['title'] );
104
+		$instance['title'] = sanitize_text_field($new_instance['title']);
105 105
 		$instance['taxonomy'] = stripslashes($new_instance['taxonomy']);
106 106
 		return $instance;
107 107
 	}
@@ -114,50 +114,50 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param array $instance Current settings.
116 116
 	 */
117
-	public function form( $instance ) {
117
+	public function form($instance) {
118 118
 		$current_taxonomy = $this->_get_current_taxonomy($instance);
119
-		$title_id = $this->get_field_id( 'title' );
120
-		$instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
119
+		$title_id = $this->get_field_id('title');
120
+		$instance['title'] = ! empty($instance['title']) ? esc_attr($instance['title']) : '';
121 121
 
122
-		echo '<p><label for="' . $title_id .'">' . __( 'Title:' ) . '</label>
123
-			<input type="text" class="widefat" id="' . $title_id .'" name="' . $this->get_field_name( 'title' ) .'" value="' . $instance['title'] .'" />
122
+		echo '<p><label for="'.$title_id.'">'.__('Title:').'</label>
123
+			<input type="text" class="widefat" id="' . $title_id.'" name="'.$this->get_field_name('title').'" value="'.$instance['title'].'" />
124 124
 		</p>';
125 125
 
126
-		$taxonomies = get_taxonomies( array( 'show_tagcloud' => true ), 'object' );
127
-		$id = $this->get_field_id( 'taxonomy' );
128
-		$name = $this->get_field_name( 'taxonomy' );
129
-		$input = '<input type="hidden" id="' . $id . '" name="' . $name . '" value="%s" />';
126
+		$taxonomies = get_taxonomies(array('show_tagcloud' => true), 'object');
127
+		$id = $this->get_field_id('taxonomy');
128
+		$name = $this->get_field_name('taxonomy');
129
+		$input = '<input type="hidden" id="'.$id.'" name="'.$name.'" value="%s" />';
130 130
 
131
-		switch ( count( $taxonomies ) ) {
131
+		switch (count($taxonomies)) {
132 132
 
133 133
 		// No tag cloud supporting taxonomies found, display error message
134 134
 		case 0:
135
-			echo '<p>' . __( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ) . '</p>';
136
-			printf( $input, '' );
135
+			echo '<p>'.__('The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.').'</p>';
136
+			printf($input, '');
137 137
 			break;
138 138
 
139 139
 		// Just a single tag cloud supporting taxonomy found, no need to display options
140 140
 		case 1:
141
-			$keys = array_keys( $taxonomies );
142
-			$taxonomy = reset( $keys );
143
-			printf( $input, esc_attr( $taxonomy ) );
141
+			$keys = array_keys($taxonomies);
142
+			$taxonomy = reset($keys);
143
+			printf($input, esc_attr($taxonomy));
144 144
 			break;
145 145
 
146 146
 		// More than one tag cloud supporting taxonomy found, display options
147 147
 		default:
148 148
 			printf(
149
-				'<p><label for="%1$s">%2$s</label>' .
149
+				'<p><label for="%1$s">%2$s</label>'.
150 150
 				'<select class="widefat" id="%1$s" name="%3$s">',
151 151
 				$id,
152
-				__( 'Taxonomy:' ),
152
+				__('Taxonomy:'),
153 153
 				$name
154 154
 			);
155 155
 
156
-			foreach ( $taxonomies as $taxonomy => $tax ) {
156
+			foreach ($taxonomies as $taxonomy => $tax) {
157 157
 				printf(
158 158
 					'<option value="%s"%s>%s</option>',
159
-					esc_attr( $taxonomy ),
160
-					selected( $taxonomy, $current_taxonomy, false ),
159
+					esc_attr($taxonomy),
160
+					selected($taxonomy, $current_taxonomy, false),
161 161
 					$tax->labels->name
162 162
 				);
163 163
 			}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @return string Name of the current taxonomy if set, otherwise 'post_tag'.
177 177
 	 */
178 178
 	public function _get_current_taxonomy($instance) {
179
-		if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
179
+		if ( ! empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']))
180 180
 			return $instance['taxonomy'];
181 181
 
182 182
 		return 'post_tag';
Please login to merge, or discard this patch.
src/wp-includes/class-wp-http-curl.php 2 patches
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -81,129 +81,129 @@  discard block
 block discarded – undo
81 81
 			'headers' => array(), 'body' => null, 'cookies' => array()
82 82
 		);
83 83
 
84
-		$r = wp_parse_args( $args, $defaults );
84
+		$r = wp_parse_args($args, $defaults);
85 85
 
86
-		if ( isset( $r['headers']['User-Agent'] ) ) {
86
+		if (isset($r['headers']['User-Agent'])) {
87 87
 			$r['user-agent'] = $r['headers']['User-Agent'];
88
-			unset( $r['headers']['User-Agent'] );
89
-		} elseif ( isset( $r['headers']['user-agent'] ) ) {
88
+			unset($r['headers']['User-Agent']);
89
+		} elseif (isset($r['headers']['user-agent'])) {
90 90
 			$r['user-agent'] = $r['headers']['user-agent'];
91
-			unset( $r['headers']['user-agent'] );
91
+			unset($r['headers']['user-agent']);
92 92
 		}
93 93
 
94 94
 		// Construct Cookie: header if any cookies are set.
95
-		WP_Http::buildCookieHeader( $r );
95
+		WP_Http::buildCookieHeader($r);
96 96
 
97 97
 		$handle = curl_init();
98 98
 
99 99
 		// cURL offers really easy proxy support.
100 100
 		$proxy = new WP_HTTP_Proxy();
101 101
 
102
-		if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
102
+		if ($proxy->is_enabled() && $proxy->send_through_proxy($url)) {
103 103
 
104
-			curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
105
-			curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
106
-			curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
104
+			curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
105
+			curl_setopt($handle, CURLOPT_PROXY, $proxy->host());
106
+			curl_setopt($handle, CURLOPT_PROXYPORT, $proxy->port());
107 107
 
108
-			if ( $proxy->use_authentication() ) {
109
-				curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
110
-				curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
108
+			if ($proxy->use_authentication()) {
109
+				curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
110
+				curl_setopt($handle, CURLOPT_PROXYUSERPWD, $proxy->authentication());
111 111
 			}
112 112
 		}
113 113
 
114 114
 		$is_local = isset($r['local']) && $r['local'];
115 115
 		$ssl_verify = isset($r['sslverify']) && $r['sslverify'];
116
-		if ( $is_local ) {
116
+		if ($is_local) {
117 117
 			/** This filter is documented in wp-includes/class-wp-http-streams.php */
118
-			$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
119
-		} elseif ( ! $is_local ) {
118
+			$ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
119
+		} elseif ( ! $is_local) {
120 120
 			/** This filter is documented in wp-includes/class-wp-http-streams.php */
121
-			$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify );
121
+			$ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
122 122
 		}
123 123
 
124 124
 		/*
125 125
 		 * CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since.
126 126
 		 * a value of 0 will allow an unlimited timeout.
127 127
 		 */
128
-		$timeout = (int) ceil( $r['timeout'] );
129
-		curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
130
-		curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
128
+		$timeout = (int) ceil($r['timeout']);
129
+		curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, $timeout);
130
+		curl_setopt($handle, CURLOPT_TIMEOUT, $timeout);
131 131
 
132
-		curl_setopt( $handle, CURLOPT_URL, $url);
133
-		curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
134
-		curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false );
135
-		curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
132
+		curl_setopt($handle, CURLOPT_URL, $url);
133
+		curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
134
+		curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, ($ssl_verify === true) ? 2 : false);
135
+		curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify);
136 136
 
137
-		if ( $ssl_verify ) {
138
-			curl_setopt( $handle, CURLOPT_CAINFO, $r['sslcertificates'] );
137
+		if ($ssl_verify) {
138
+			curl_setopt($handle, CURLOPT_CAINFO, $r['sslcertificates']);
139 139
 		}
140 140
 
141
-		curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
141
+		curl_setopt($handle, CURLOPT_USERAGENT, $r['user-agent']);
142 142
 
143 143
 		/*
144 144
 		 * The option doesn't work with safe mode or when open_basedir is set, and there's
145 145
 		 * a bug #17490 with redirected POST requests, so handle redirections outside Curl.
146 146
 		 */
147
-		curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false );
148
-		if ( defined( 'CURLOPT_PROTOCOLS' ) ) // PHP 5.2.10 / cURL 7.19.4
149
-			curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
147
+		curl_setopt($handle, CURLOPT_FOLLOWLOCATION, false);
148
+		if (defined('CURLOPT_PROTOCOLS')) // PHP 5.2.10 / cURL 7.19.4
149
+			curl_setopt($handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
150 150
 
151
-		switch ( $r['method'] ) {
151
+		switch ($r['method']) {
152 152
 			case 'HEAD':
153
-				curl_setopt( $handle, CURLOPT_NOBODY, true );
153
+				curl_setopt($handle, CURLOPT_NOBODY, true);
154 154
 				break;
155 155
 			case 'POST':
156
-				curl_setopt( $handle, CURLOPT_POST, true );
157
-				curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
156
+				curl_setopt($handle, CURLOPT_POST, true);
157
+				curl_setopt($handle, CURLOPT_POSTFIELDS, $r['body']);
158 158
 				break;
159 159
 			case 'PUT':
160
-				curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' );
161
-				curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
160
+				curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'PUT');
161
+				curl_setopt($handle, CURLOPT_POSTFIELDS, $r['body']);
162 162
 				break;
163 163
 			default:
164
-				curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $r['method'] );
165
-				if ( ! is_null( $r['body'] ) )
166
-					curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
164
+				curl_setopt($handle, CURLOPT_CUSTOMREQUEST, $r['method']);
165
+				if ( ! is_null($r['body']))
166
+					curl_setopt($handle, CURLOPT_POSTFIELDS, $r['body']);
167 167
 				break;
168 168
 		}
169 169
 
170
-		if ( true === $r['blocking'] ) {
171
-			curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );
172
-			curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) );
170
+		if (true === $r['blocking']) {
171
+			curl_setopt($handle, CURLOPT_HEADERFUNCTION, array($this, 'stream_headers'));
172
+			curl_setopt($handle, CURLOPT_WRITEFUNCTION, array($this, 'stream_body'));
173 173
 		}
174 174
 
175
-		curl_setopt( $handle, CURLOPT_HEADER, false );
175
+		curl_setopt($handle, CURLOPT_HEADER, false);
176 176
 
177
-		if ( isset( $r['limit_response_size'] ) )
178
-			$this->max_body_length = intval( $r['limit_response_size'] );
177
+		if (isset($r['limit_response_size']))
178
+			$this->max_body_length = intval($r['limit_response_size']);
179 179
 		else
180 180
 			$this->max_body_length = false;
181 181
 
182 182
 		// If streaming to a file open a file handle, and setup our curl streaming handler.
183
-		if ( $r['stream'] ) {
184
-			if ( ! WP_DEBUG )
185
-				$this->stream_handle = @fopen( $r['filename'], 'w+' );
183
+		if ($r['stream']) {
184
+			if ( ! WP_DEBUG)
185
+				$this->stream_handle = @fopen($r['filename'], 'w+');
186 186
 			else
187
-				$this->stream_handle = fopen( $r['filename'], 'w+' );
188
-			if ( ! $this->stream_handle )
189
-				return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) );
187
+				$this->stream_handle = fopen($r['filename'], 'w+');
188
+			if ( ! $this->stream_handle)
189
+				return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $r['filename']));
190 190
 		} else {
191 191
 			$this->stream_handle = false;
192 192
 		}
193 193
 
194
-		if ( !empty( $r['headers'] ) ) {
194
+		if ( ! empty($r['headers'])) {
195 195
 			// cURL expects full header strings in each element.
196 196
 			$headers = array();
197
-			foreach ( $r['headers'] as $name => $value ) {
197
+			foreach ($r['headers'] as $name => $value) {
198 198
 				$headers[] = "{$name}: $value";
199 199
 			}
200
-			curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
200
+			curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
201 201
 		}
202 202
 
203
-		if ( $r['httpversion'] == '1.0' )
204
-			curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
203
+		if ($r['httpversion'] == '1.0')
204
+			curl_setopt($handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
205 205
 		else
206
-			curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
206
+			curl_setopt($handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
207 207
 
208 208
 		/**
209 209
 		 * Fires before the cURL request is executed.
@@ -217,27 +217,27 @@  discard block
 block discarded – undo
217 217
 		 * @param array    $r       The HTTP request arguments.
218 218
 		 * @param string   $url     The request URL.
219 219
 		 */
220
-		do_action_ref_array( 'http_api_curl', array( &$handle, $r, $url ) );
220
+		do_action_ref_array('http_api_curl', array(&$handle, $r, $url));
221 221
 
222 222
 		// We don't need to return the body, so don't. Just execute request and return.
223
-		if ( ! $r['blocking'] ) {
224
-			curl_exec( $handle );
223
+		if ( ! $r['blocking']) {
224
+			curl_exec($handle);
225 225
 
226
-			if ( $curl_error = curl_error( $handle ) ) {
227
-				curl_close( $handle );
228
-				return new WP_Error( 'http_request_failed', $curl_error );
226
+			if ($curl_error = curl_error($handle)) {
227
+				curl_close($handle);
228
+				return new WP_Error('http_request_failed', $curl_error);
229 229
 			}
230
-			if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ) ) ) {
231
-				curl_close( $handle );
232
-				return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
230
+			if (in_array(curl_getinfo($handle, CURLINFO_HTTP_CODE), array(301, 302))) {
231
+				curl_close($handle);
232
+				return new WP_Error('http_request_failed', __('Too many redirects.'));
233 233
 			}
234 234
 
235
-			curl_close( $handle );
236
-			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
235
+			curl_close($handle);
236
+			return array('headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array());
237 237
 		}
238 238
 
239
-		curl_exec( $handle );
240
-		$theHeaders = WP_Http::processHeaders( $this->headers, $url );
239
+		curl_exec($handle);
240
+		$theHeaders = WP_Http::processHeaders($this->headers, $url);
241 241
 		$theBody = $this->body;
242 242
 		$bytes_written_total = $this->bytes_written_total;
243 243
 
@@ -245,37 +245,37 @@  discard block
 block discarded – undo
245 245
 		$this->body = '';
246 246
 		$this->bytes_written_total = 0;
247 247
 
248
-		$curl_error = curl_errno( $handle );
248
+		$curl_error = curl_errno($handle);
249 249
 
250 250
 		// If an error occurred, or, no response.
251
-		if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) {
252
-			if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) {
253
-				if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) {
254
-					if ( $r['stream'] ) {
255
-						curl_close( $handle );
256
-						fclose( $this->stream_handle );
257
-						return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) );
251
+		if ($curl_error || (0 == strlen($theBody) && empty($theHeaders['headers']))) {
252
+			if (CURLE_WRITE_ERROR /* 23 */ == $curl_error) {
253
+				if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total) {
254
+					if ($r['stream']) {
255
+						curl_close($handle);
256
+						fclose($this->stream_handle);
257
+						return new WP_Error('http_request_failed', __('Failed to write request to temporary file.'));
258 258
 					} else {
259
-						curl_close( $handle );
260
-						return new WP_Error( 'http_request_failed', curl_error( $handle ) );
259
+						curl_close($handle);
260
+						return new WP_Error('http_request_failed', curl_error($handle));
261 261
 					}
262 262
 				}
263 263
 			} else {
264
-				if ( $curl_error = curl_error( $handle ) ) {
265
-					curl_close( $handle );
266
-					return new WP_Error( 'http_request_failed', $curl_error );
264
+				if ($curl_error = curl_error($handle)) {
265
+					curl_close($handle);
266
+					return new WP_Error('http_request_failed', $curl_error);
267 267
 				}
268 268
 			}
269
-			if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ) ) ) {
270
-				curl_close( $handle );
271
-				return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
269
+			if (in_array(curl_getinfo($handle, CURLINFO_HTTP_CODE), array(301, 302))) {
270
+				curl_close($handle);
271
+				return new WP_Error('http_request_failed', __('Too many redirects.'));
272 272
 			}
273 273
 		}
274 274
 
275
-		curl_close( $handle );
275
+		curl_close($handle);
276 276
 
277
-		if ( $r['stream'] )
278
-			fclose( $this->stream_handle );
277
+		if ($r['stream'])
278
+			fclose($this->stream_handle);
279 279
 
280 280
 		$response = array(
281 281
 			'headers' => $theHeaders['headers'],
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 		);
287 287
 
288 288
 		// Handle redirects.
289
-		if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) )
289
+		if (false !== ($redirect_response = WP_HTTP::handle_redirects($url, $r, $response)))
290 290
 			return $redirect_response;
291 291
 
292
-		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
293
-			$theBody = WP_Http_Encoding::decompress( $theBody );
292
+		if (true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']))
293
+			$theBody = WP_Http_Encoding::decompress($theBody);
294 294
 
295 295
 		$response['body'] = $theBody;
296 296
 
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 	 * @param string   $headers cURL request headers.
311 311
 	 * @return int Length of the request headers.
312 312
 	 */
313
-	private function stream_headers( $handle, $headers ) {
313
+	private function stream_headers($handle, $headers) {
314 314
 		$this->headers .= $headers;
315
-		return strlen( $headers );
315
+		return strlen($headers);
316 316
 	}
317 317
 
318 318
 	/**
@@ -329,16 +329,16 @@  discard block
 block discarded – undo
329 329
 	 * @param string   $data    cURL request body.
330 330
 	 * @return int Total bytes of data written.
331 331
 	 */
332
-	private function stream_body( $handle, $data ) {
333
-		$data_length = strlen( $data );
332
+	private function stream_body($handle, $data) {
333
+		$data_length = strlen($data);
334 334
 
335
-		if ( $this->max_body_length && ( $this->bytes_written_total + $data_length ) > $this->max_body_length ) {
336
-			$data_length = ( $this->max_body_length - $this->bytes_written_total );
337
-			$data = substr( $data, 0, $data_length );
335
+		if ($this->max_body_length && ($this->bytes_written_total + $data_length) > $this->max_body_length) {
336
+			$data_length = ($this->max_body_length - $this->bytes_written_total);
337
+			$data = substr($data, 0, $data_length);
338 338
 		}
339 339
 
340
-		if ( $this->stream_handle ) {
341
-			$bytes_written = fwrite( $this->stream_handle, $data );
340
+		if ($this->stream_handle) {
341
+			$bytes_written = fwrite($this->stream_handle, $data);
342 342
 		} else {
343 343
 			$this->body .= $data;
344 344
 			$bytes_written = $data_length;
@@ -359,16 +359,16 @@  discard block
 block discarded – undo
359 359
 	 * @param array $args Optional. Array of request arguments. Default empty array.
360 360
 	 * @return bool False means this class can not be used, true means it can.
361 361
 	 */
362
-	public static function test( $args = array() ) {
363
-		if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) )
362
+	public static function test($args = array()) {
363
+		if ( ! function_exists('curl_init') || ! function_exists('curl_exec'))
364 364
 			return false;
365 365
 
366
-		$is_ssl = isset( $args['ssl'] ) && $args['ssl'];
366
+		$is_ssl = isset($args['ssl']) && $args['ssl'];
367 367
 
368
-		if ( $is_ssl ) {
368
+		if ($is_ssl) {
369 369
 			$curl_version = curl_version();
370 370
 			// Check whether this cURL version support SSL requests.
371
-			if ( ! (CURL_VERSION_SSL & $curl_version['features']) )
371
+			if ( ! (CURL_VERSION_SSL & $curl_version['features']))
372 372
 				return false;
373 373
 		}
374 374
 
@@ -380,6 +380,6 @@  discard block
 block discarded – undo
380 380
 		 * @param bool  $use_class Whether the class can be used. Default true.
381 381
 		 * @param array $args      An array of request arguments.
382 382
 		 */
383
-		return apply_filters( 'use_curl_transport', true, $args );
383
+		return apply_filters('use_curl_transport', true, $args);
384 384
 	}
385 385
 }
Please login to merge, or discard this patch.
Braces   +39 added lines, -27 removed lines patch added patch discarded remove patch
@@ -145,8 +145,10 @@  discard block
 block discarded – undo
145 145
 		 * a bug #17490 with redirected POST requests, so handle redirections outside Curl.
146 146
 		 */
147 147
 		curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false );
148
-		if ( defined( 'CURLOPT_PROTOCOLS' ) ) // PHP 5.2.10 / cURL 7.19.4
148
+		if ( defined( 'CURLOPT_PROTOCOLS' ) ) {
149
+			// PHP 5.2.10 / cURL 7.19.4
149 150
 			curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
151
+		}
150 152
 
151 153
 		switch ( $r['method'] ) {
152 154
 			case 'HEAD':
@@ -162,8 +164,9 @@  discard block
 block discarded – undo
162 164
 				break;
163 165
 			default:
164 166
 				curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $r['method'] );
165
-				if ( ! is_null( $r['body'] ) )
166
-					curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
167
+				if ( ! is_null( $r['body'] ) ) {
168
+									curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
169
+				}
167 170
 				break;
168 171
 		}
169 172
 
@@ -174,19 +177,22 @@  discard block
 block discarded – undo
174 177
 
175 178
 		curl_setopt( $handle, CURLOPT_HEADER, false );
176 179
 
177
-		if ( isset( $r['limit_response_size'] ) )
178
-			$this->max_body_length = intval( $r['limit_response_size'] );
179
-		else
180
-			$this->max_body_length = false;
180
+		if ( isset( $r['limit_response_size'] ) ) {
181
+					$this->max_body_length = intval( $r['limit_response_size'] );
182
+		} else {
183
+					$this->max_body_length = false;
184
+		}
181 185
 
182 186
 		// If streaming to a file open a file handle, and setup our curl streaming handler.
183 187
 		if ( $r['stream'] ) {
184
-			if ( ! WP_DEBUG )
185
-				$this->stream_handle = @fopen( $r['filename'], 'w+' );
186
-			else
187
-				$this->stream_handle = fopen( $r['filename'], 'w+' );
188
-			if ( ! $this->stream_handle )
189
-				return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) );
188
+			if ( ! WP_DEBUG ) {
189
+							$this->stream_handle = @fopen( $r['filename'], 'w+' );
190
+			} else {
191
+							$this->stream_handle = fopen( $r['filename'], 'w+' );
192
+			}
193
+			if ( ! $this->stream_handle ) {
194
+							return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) );
195
+			}
190 196
 		} else {
191 197
 			$this->stream_handle = false;
192 198
 		}
@@ -200,10 +206,11 @@  discard block
 block discarded – undo
200 206
 			curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
201 207
 		}
202 208
 
203
-		if ( $r['httpversion'] == '1.0' )
204
-			curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
205
-		else
206
-			curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
209
+		if ( $r['httpversion'] == '1.0' ) {
210
+					curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
211
+		} else {
212
+					curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
213
+		}
207 214
 
208 215
 		/**
209 216
 		 * Fires before the cURL request is executed.
@@ -274,8 +281,9 @@  discard block
 block discarded – undo
274 281
 
275 282
 		curl_close( $handle );
276 283
 
277
-		if ( $r['stream'] )
278
-			fclose( $this->stream_handle );
284
+		if ( $r['stream'] ) {
285
+					fclose( $this->stream_handle );
286
+		}
279 287
 
280 288
 		$response = array(
281 289
 			'headers' => $theHeaders['headers'],
@@ -286,11 +294,13 @@  discard block
 block discarded – undo
286 294
 		);
287 295
 
288 296
 		// Handle redirects.
289
-		if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) )
290
-			return $redirect_response;
297
+		if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) ) {
298
+					return $redirect_response;
299
+		}
291 300
 
292
-		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
293
-			$theBody = WP_Http_Encoding::decompress( $theBody );
301
+		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) ) {
302
+					$theBody = WP_Http_Encoding::decompress( $theBody );
303
+		}
294 304
 
295 305
 		$response['body'] = $theBody;
296 306
 
@@ -360,16 +370,18 @@  discard block
 block discarded – undo
360 370
 	 * @return bool False means this class can not be used, true means it can.
361 371
 	 */
362 372
 	public static function test( $args = array() ) {
363
-		if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) )
364
-			return false;
373
+		if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) {
374
+					return false;
375
+		}
365 376
 
366 377
 		$is_ssl = isset( $args['ssl'] ) && $args['ssl'];
367 378
 
368 379
 		if ( $is_ssl ) {
369 380
 			$curl_version = curl_version();
370 381
 			// Check whether this cURL version support SSL requests.
371
-			if ( ! (CURL_VERSION_SSL & $curl_version['features']) )
372
-				return false;
382
+			if ( ! (CURL_VERSION_SSL & $curl_version['features']) ) {
383
+							return false;
384
+			}
373 385
 		}
374 386
 
375 387
 		/**
Please login to merge, or discard this patch.
src/wp-includes/class-wp-http-response.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @param int   $status  Optional. HTTP status code. Default 200.
52 52
 	 * @param array $headers Optional. HTTP header map. Default empty array.
53 53
 	 */
54
-	public function __construct( $data = null, $status = 200, $headers = array() ) {
54
+	public function __construct($data = null, $status = 200, $headers = array()) {
55 55
 		$this->data = $data;
56
-		$this->set_status( $status );
57
-		$this->set_headers( $headers );
56
+		$this->set_status($status);
57
+		$this->set_headers($headers);
58 58
 	}
59 59
 
60 60
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @param array $headers Map of header name to header value.
79 79
 	 */
80
-	public function set_headers( $headers ) {
80
+	public function set_headers($headers) {
81 81
 		$this->headers = $headers;
82 82
 	}
83 83
 
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 	 * @param bool   $replace Optional. Whether to replace an existing header of the same name.
93 93
 	 *                        Default true.
94 94
 	 */
95
-	public function header( $key, $value, $replace = true ) {
96
-		if ( $replace || ! isset( $this->headers[ $key ] ) ) {
97
-			$this->headers[ $key ] = $value;
95
+	public function header($key, $value, $replace = true) {
96
+		if ($replace || ! isset($this->headers[$key])) {
97
+			$this->headers[$key] = $value;
98 98
 		} else {
99
-			$this->headers[ $key ] .= ', ' . $value;
99
+			$this->headers[$key] .= ', '.$value;
100 100
 		}
101 101
 	}
102 102
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @param int $code HTTP status.
122 122
 	 */
123
-	public function set_status( $code ) {
124
-		$this->status = absint( $code );
123
+	public function set_status($code) {
124
+		$this->status = absint($code);
125 125
 	}
126 126
 
127 127
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param mixed $data Response data.
146 146
 	 */
147
-	public function set_data( $data ) {
147
+	public function set_data($data) {
148 148
 		$this->data = $data;
149 149
 	}
150 150
 
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Category.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -113,8 +113,7 @@  discard block
 block discarded – undo
113 113
 		if ($this->name !== null)
114 114
 		{
115 115
 			return $this->name;
116
-		}
117
-		else
116
+		} else
118 117
 		{
119 118
 			return null;
120 119
 		}
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
 		if ($this->link !== null)
131 130
 		{
132 131
 			return $this->link;
133
-		}
134
-		else
132
+		} else
135 133
 		{
136 134
 			return null;
137 135
 		}
@@ -147,8 +145,7 @@  discard block
 block discarded – undo
147 145
 		if ($this->email !== null)
148 146
 		{
149 147
 			return $this->email;
150
-		}
151
-		else
148
+		} else
152 149
 		{
153 150
 			return null;
154 151
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Credit.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -113,8 +113,7 @@  discard block
 block discarded – undo
113 113
 		if ($this->name !== null)
114 114
 		{
115 115
 			return $this->name;
116
-		}
117
-		else
116
+		} else
118 117
 		{
119 118
 			return null;
120 119
 		}
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
 		if ($this->link !== null)
131 130
 		{
132 131
 			return $this->link;
133
-		}
134
-		else
132
+		} else
135 133
 		{
136 134
 			return null;
137 135
 		}
@@ -147,8 +145,7 @@  discard block
 block discarded – undo
147 145
 		if ($this->email !== null)
148 146
 		{
149 147
 			return $this->email;
150
-		}
151
-		else
148
+		} else
152 149
 		{
153 150
 			return null;
154 151
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Restriction.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -113,8 +113,7 @@  discard block
 block discarded – undo
113 113
 		if ($this->name !== null)
114 114
 		{
115 115
 			return $this->name;
116
-		}
117
-		else
116
+		} else
118 117
 		{
119 118
 			return null;
120 119
 		}
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
 		if ($this->link !== null)
131 130
 		{
132 131
 			return $this->link;
133
-		}
134
-		else
132
+		} else
135 133
 		{
136 134
 			return null;
137 135
 		}
@@ -147,8 +145,7 @@  discard block
 block discarded – undo
147 145
 		if ($this->email !== null)
148 146
 		{
149 147
 			return $this->email;
150
-		}
151
-		else
148
+		} else
152 149
 		{
153 150
 			return null;
154 151
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Copyright.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,8 +103,7 @@  discard block
 block discarded – undo
103 103
 		if ($this->scheme !== null)
104 104
 		{
105 105
 			return $this->scheme;
106
-		}
107
-		else
106
+		} else
108 107
 		{
109 108
 			return null;
110 109
 		}
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
 		if ($this->value !== null)
121 120
 		{
122 121
 			return $this->value;
123
-		}
124
-		else
122
+		} else
125 123
 		{
126 124
 			return null;
127 125
 		}
Please login to merge, or discard this patch.
src/wp-includes/class-walker-page-dropdown.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@
 block discarded – undo
58 58
 		}
59 59
 
60 60
 		$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $page->{$args['value_field']} ) . "\"";
61
-		if ( $page->ID == $args['selected'] )
62
-			$output .= ' selected="selected"';
61
+		if ( $page->ID == $args['selected'] ) {
62
+					$output .= ' selected="selected"';
63
+		}
63 64
 		$output .= '>';
64 65
 
65 66
 		$title = $page->post_title;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @see Walker::$db_fields
38 38
 	 * @todo Decouple this
39 39
 	 */
40
-	public $db_fields = array( 'parent' => 'post_parent', 'id' => 'ID' );
40
+	public $db_fields = array('parent' => 'post_parent', 'id' => 'ID');
41 41
 
42 42
 	/**
43 43
 	 * Starts the element output.
@@ -56,22 +56,22 @@  discard block
 block discarded – undo
56 56
 	 *                        attribute. See wp_dropdown_pages(). Default empty array.
57 57
 	 * @param int     $id     Optional. ID of the current page. Default 0 (unused).
58 58
 	 */
59
-	public function start_el( &$output, $page, $depth = 0, $args = array(), $id = 0 ) {
59
+	public function start_el(&$output, $page, $depth = 0, $args = array(), $id = 0) {
60 60
 		$pad = str_repeat('&nbsp;', $depth * 3);
61 61
 
62
-		if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) {
62
+		if ( ! isset($args['value_field']) || ! isset($page->{$args['value_field']} )) {
63 63
 			$args['value_field'] = 'ID';
64 64
 		}
65 65
 
66
-		$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $page->{$args['value_field']} ) . "\"";
67
-		if ( $page->ID == $args['selected'] )
66
+		$output .= "\t<option class=\"level-$depth\" value=\"".esc_attr($page->{$args['value_field']} )."\"";
67
+		if ($page->ID == $args['selected'])
68 68
 			$output .= ' selected="selected"';
69 69
 		$output .= '>';
70 70
 
71 71
 		$title = $page->post_title;
72
-		if ( '' === $title ) {
72
+		if ('' === $title) {
73 73
 			/* translators: %d: ID of a post */
74
-			$title = sprintf( __( '#%d (no title)' ), $page->ID );
74
+			$title = sprintf(__('#%d (no title)'), $page->ID);
75 75
 		}
76 76
 
77 77
 		/**
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 		 * @param string $title Page title.
83 83
 		 * @param object $page  Page data object.
84 84
 		 */
85
-		$title = apply_filters( 'list_pages', $title, $page );
85
+		$title = apply_filters('list_pages', $title, $page);
86 86
 
87
-		$output .= $pad . esc_html( $title );
87
+		$output .= $pad.esc_html($title);
88 88
 		$output .= "</option>\n";
89 89
 	}
90 90
 }
Please login to merge, or discard this patch.
src/wp-includes/rest-api/class-wp-rest-response.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 	 * @param string $href       Target URI for the link.
60 60
 	 * @param array  $attributes Optional. Link parameters to send along with the URL. Default empty array.
61 61
 	 */
62
-	public function add_link( $rel, $href, $attributes = array() ) {
63
-		if ( empty( $this->links[ $rel ] ) ) {
64
-			$this->links[ $rel ] = array();
62
+	public function add_link($rel, $href, $attributes = array()) {
63
+		if (empty($this->links[$rel])) {
64
+			$this->links[$rel] = array();
65 65
 		}
66 66
 
67
-		if ( isset( $attributes['href'] ) ) {
67
+		if (isset($attributes['href'])) {
68 68
 			// Remove the href attribute, as it's used for the main URL.
69
-			unset( $attributes['href'] );
69
+			unset($attributes['href']);
70 70
 		}
71 71
 
72
-		$this->links[ $rel ][] = array(
72
+		$this->links[$rel][] = array(
73 73
 			'href'       => $href,
74 74
 			'attributes' => $attributes,
75 75
 		);
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	 * @param  string $href Optional. Only remove links for the relation matching the given href.
86 86
 	 *                      Default null.
87 87
 	 */
88
-	public function remove_link( $rel, $href = null ) {
89
-		if ( ! isset( $this->links[ $rel ] ) ) {
88
+	public function remove_link($rel, $href = null) {
89
+		if ( ! isset($this->links[$rel])) {
90 90
 			return;
91 91
 		}
92 92
 
93
-		if ( $href ) {
94
-			$this->links[ $rel ] = wp_list_filter( $this->links[ $rel ], array( 'href' => $href ), 'NOT' );
93
+		if ($href) {
94
+			$this->links[$rel] = wp_list_filter($this->links[$rel], array('href' => $href), 'NOT');
95 95
 		} else {
96
-			$this->links[ $rel ] = array();
96
+			$this->links[$rel] = array();
97 97
 		}
98 98
 
99
-		if ( ! $this->links[ $rel ] ) {
100
-			unset( $this->links[ $rel ] );
99
+		if ( ! $this->links[$rel]) {
100
+			unset($this->links[$rel]);
101 101
 		}
102 102
 	}
103 103
 
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param array $links Map of link relation to list of links.
116 116
 	 */
117
-	public function add_links( $links ) {
118
-		foreach ( $links as $rel => $set ) {
117
+	public function add_links($links) {
118
+		foreach ($links as $rel => $set) {
119 119
 			// If it's a single link, wrap with an array for consistent handling.
120
-			if ( isset( $set['href'] ) ) {
121
-				$set = array( $set );
120
+			if (isset($set['href'])) {
121
+				$set = array($set);
122 122
 			}
123 123
 
124
-			foreach ( $set as $attributes ) {
125
-				$this->add_link( $rel, $attributes['href'], $attributes );
124
+			foreach ($set as $attributes) {
125
+				$this->add_link($rel, $attributes['href'], $attributes);
126 126
 			}
127 127
 		}
128 128
 	}
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
 	 * @param array  $other Optional. Other parameters to send, as an assocative array.
156 156
 	 *                      Default empty array.
157 157
 	 */
158
-	public function link_header( $rel, $link, $other = array() ) {
159
-		$header = '<' . $link . '>; rel="' . $rel . '"';
158
+	public function link_header($rel, $link, $other = array()) {
159
+		$header = '<'.$link.'>; rel="'.$rel.'"';
160 160
 
161
-		foreach ( $other as $key => $value ) {
162
-			if ( 'title' === $key ) {
163
-				$value = '"' . $value . '"';
161
+		foreach ($other as $key => $value) {
162
+			if ('title' === $key) {
163
+				$value = '"'.$value.'"';
164 164
 			}
165
-			$header .= '; ' . $key . '=' . $value;
165
+			$header .= '; '.$key.'='.$value;
166 166
 		}
167
-		$this->header( 'Link', $header, false );
167
+		$this->header('Link', $header, false);
168 168
 	}
169 169
 
170 170
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @param string $route Route name.
189 189
 	 */
190
-	public function set_matched_route( $route ) {
190
+	public function set_matched_route($route) {
191 191
 		$this->matched_route = $route;
192 192
 	}
193 193
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @param array $handler The matched handler.
213 213
 	 */
214
-	public function set_matched_handler( $handler ) {
214
+	public function set_matched_handler($handler) {
215 215
 		$this->matched_handler = $handler;
216 216
 	}
217 217
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 	 * @return WP_Error|null WP_Error or null on not an errored response.
237 237
 	 */
238 238
 	public function as_error() {
239
-		if ( ! $this->is_error() ) {
239
+		if ( ! $this->is_error()) {
240 240
 			return null;
241 241
 		}
242 242
 
243 243
 		$error = new WP_Error;
244 244
 
245
-		if ( is_array( $this->get_data() ) ) {
245
+		if (is_array($this->get_data())) {
246 246
 			$data = $this->get_data();
247
-			$error->add( $data['code'], $data['message'], $data['data'] );
248
-			if ( ! empty( $data['additional_errors'] ) ) {
249
-				foreach( $data['additional_errors'] as $err ) {
250
-					$error->add( $err['code'], $err['message'], $err['data'] );
247
+			$error->add($data['code'], $data['message'], $data['data']);
248
+			if ( ! empty($data['additional_errors'])) {
249
+				foreach ($data['additional_errors'] as $err) {
250
+					$error->add($err['code'], $err['message'], $err['data']);
251 251
 				}
252 252
 			}
253 253
 		} else {
254
-			$error->add( $this->get_status(), '', array( 'status' => $this->get_status() ) );
254
+			$error->add($this->get_status(), '', array('status' => $this->get_status()));
255 255
 		}
256 256
 
257 257
 		return $error;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		 *
300 300
 		 * @param array $additional Additional CURIEs to register with the API.
301 301
 		 */
302
-		$additional = apply_filters( 'rest_response_link_curies', array() );
303
-		return array_merge( $curies, $additional );
302
+		$additional = apply_filters('rest_response_link_curies', array());
303
+		return array_merge($curies, $additional);
304 304
 	}
305 305
 }
Please login to merge, or discard this patch.