Completed
Push — master ( ed64c2...186a7a )
by
unknown
8s
created
app/classes/comment.php 2 patches
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @param \WP_Comment $item WP_Comment object.
103 103
 	 */
104
-	public function __construct( $item ) {
105
-		if ( is_a( $item, '\WP_Comment' ) ) {
106
-			$this->import( $item );
104
+	public function __construct($item) {
105
+		if (is_a($item, '\WP_Comment')) {
106
+			$this->import($item);
107 107
 		}
108 108
 	}
109 109
 
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 * @return \Classy\Models\User
114 114
 	 */
115 115
 	public function author() {
116
-		if ( ! $this->user_id ) {
116
+		if (!$this->user_id) {
117 117
 
118
-			$author = new Models\User( 0 );
118
+			$author = new Models\User(0);
119 119
 
120
-			if ( isset( $this->comment_author ) && $this->comment_author ) {
120
+			if (isset($this->comment_author) && $this->comment_author) {
121 121
 				$author->name = $this->comment_author;
122 122
 			}
123 123
 
124 124
 			return $author;
125 125
 		}
126 126
 
127
-		return new Models\User( $this->user_id );
127
+		return new Models\User($this->user_id);
128 128
 	}
129 129
 
130 130
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return string
134 134
 	 */
135 135
 	public function content() {
136
-		return apply_filters( 'get_comment_text ', $this->comment_content );
136
+		return apply_filters('get_comment_text ', $this->comment_content);
137 137
 	}
138 138
 
139 139
 	/**
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return string
154 154
 	 */
155
-	public function date( $date_format = '' ) {
156
-		$df = $date_format ? $date_format : get_option( 'date_format' );
157
-		$the_date = (string) mysql2date( $df, $this->comment_date );
155
+	public function date($date_format = '') {
156
+		$df = $date_format ? $date_format : get_option('date_format');
157
+		$the_date = (string) mysql2date($df, $this->comment_date);
158 158
 
159
-		return apply_filters( 'get_comment_date ', $the_date, $df );
159
+		return apply_filters('get_comment_date ', $the_date, $df);
160 160
 	}
161 161
 
162 162
 	/**
@@ -176,25 +176,25 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string
178 178
 	 */
179
-	public function avatar( $size = 92, $default = '' ) {
180
-		if ( ! get_option( 'show_avatars' ) ) {
179
+	public function avatar($size = 92, $default = '') {
180
+		if (!get_option('show_avatars')) {
181 181
 			return false;
182 182
 		}
183 183
 
184
-		if ( ! is_numeric( $size ) ) { $size = '92'; }
184
+		if (!is_numeric($size)) { $size = '92'; }
185 185
 
186 186
 		$email = $this->get_avatar_email();
187 187
 		$email_hash = '';
188 188
 
189
-		if ( ! empty( $email ) ) {
190
-			$email_hash = md5( strtolower( trim( $email ) ) );
189
+		if (!empty($email)) {
190
+			$email_hash = md5(strtolower(trim($email)));
191 191
 		}
192 192
 
193
-		$host = $this->get_avatar_host( $email_hash );
194
-		$default = $this->get_default_avatar( $default, $email, $size, $host );
193
+		$host = $this->get_avatar_host($email_hash);
194
+		$default = $this->get_default_avatar($default, $email, $size, $host);
195 195
 
196
-		if ( ! empty( $email ) ) {
197
-			$avatar = $this->get_avatar_url( $default, $host, $email_hash, $size );
196
+		if (!empty($email)) {
197
+			$avatar = $this->get_avatar_url($default, $host, $email_hash, $size);
198 198
 		} else {
199 199
 			$avatar = $default;
200 200
 		}
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function get_avatar_email() {
211 211
 		$id = (int) $this->user_id;
212
-		$user = get_userdata( $id );
212
+		$user = get_userdata($id);
213 213
 
214
-		if ( $user ) {
214
+		if ($user) {
215 215
 			$email = $user->user_email;
216 216
 		} else {
217 217
 			$email = $this->comment_author_email;
@@ -229,31 +229,31 @@  discard block
 block discarded – undo
229 229
 	 * @param  string $host
230 230
 	 * @return string
231 231
 	 */
232
-	protected function get_default_avatar( $default, $email, $size, $host ) {
233
-		if ( '/' === substr( $default, 0, 1 ) ) {
234
-			$default = home_url() . $default;
232
+	protected function get_default_avatar($default, $email, $size, $host) {
233
+		if ('/' === substr($default, 0, 1)) {
234
+			$default = home_url().$default;
235 235
 		}
236 236
 
237
-		if ( empty( $default ) ) {
238
-			$avatar_default = get_option( 'avatar_default' );
239
-			if ( empty( $avatar_default ) ) {
237
+		if (empty($default)) {
238
+			$avatar_default = get_option('avatar_default');
239
+			if (empty($avatar_default)) {
240 240
 				$default = 'mystery';
241 241
 			} else {
242 242
 				$default = $avatar_default;
243 243
 			}
244 244
 		}
245 245
 
246
-		if ( 'mystery' === $default ) {
247
-			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
246
+		if ('mystery' === $default) {
247
+			$default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size;
248 248
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
249
-		} else if ( 'blank' === $default ) {
250
-			$default = $email ? 'blank' : includes_url( 'images/blank.gif' );
251
-		} else if ( ! empty( $email ) && 'gravatar_default' === $default ) {
249
+		} else if ('blank' === $default) {
250
+			$default = $email ? 'blank' : includes_url('images/blank.gif');
251
+		} else if (!empty($email) && 'gravatar_default' === $default) {
252 252
 			$default = '';
253
-		} else if ( 'gravatar_default' === $default ) {
254
-			$default = $host . '/avatar/?s=' . $size;
255
-		} else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) {
256
-			$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
253
+		} else if ('gravatar_default' === $default) {
254
+			$default = $host.'/avatar/?s='.$size;
255
+		} else if (empty($email) && !strstr($default, 'http://')) {
256
+			$default = $host.'/avatar/?d='.$default.'&s='.$size;
257 257
 		}
258 258
 
259 259
 		return $default;
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 	 * @param  string $email_hash
266 266
 	 * @return string
267 267
 	 */
268
-	protected function get_avatar_host( $email_hash ) {
268
+	protected function get_avatar_host($email_hash) {
269 269
 
270
-		if ( is_ssl() ) {
270
+		if (is_ssl()) {
271 271
 			$host = 'https://secure.gravatar.com';
272 272
 		} else {
273
-			if ( ! empty( $email_hash ) ) {
274
-				$host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) );
273
+			if (!empty($email_hash)) {
274
+				$host = sprintf('http://%d.gravatar.com', (hexdec($email_hash[0]) % 2));
275 275
 			} else {
276 276
 				$host = 'http://0.gravatar.com';
277 277
 			}
@@ -289,15 +289,15 @@  discard block
 block discarded – undo
289 289
 	 * @param  int $size
290 290
 	 * @return string
291 291
 	 */
292
-	protected function get_avatar_url( $default, $host, $email_hash, $size ) {
293
-		$_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode( $default );
294
-		$rating = get_option( 'avatar_rating' );
292
+	protected function get_avatar_url($default, $host, $email_hash, $size) {
293
+		$_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&d='.urlencode($default);
294
+		$rating = get_option('avatar_rating');
295 295
 
296
-		if ( ! empty( $rating ) ) {
297
-			$_return .= '&r=' . $rating;
296
+		if (!empty($rating)) {
297
+			$_return .= '&r='.$rating;
298 298
 		}
299 299
 
300
-		return str_replace( '&', '&', esc_url( $_return ) );
300
+		return str_replace('&', '&', esc_url($_return));
301 301
 	}
302 302
 
303 303
 	/**
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * @param Comment $comment
307 307
 	 */
308
-	public function add_child( $comment ) {
308
+	public function add_child($comment) {
309 309
 		$this->children[] = $comment;
310 310
 		$item->level = $this->level + 1;
311 311
 
312
-		if ( $item->children ) {
312
+		if ($item->children) {
313 313
 			$this->update_child_levels();
314 314
 		}
315 315
 	}
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * @return boolean
321 321
 	 */
322 322
 	protected function update_child_levels() {
323
-		if ( is_array( $this->children ) ) {
324
-			foreach ( $this->children as $child ) {
323
+		if (is_array($this->children)) {
324
+			foreach ($this->children as $child) {
325 325
 				$child->level = $this->level + 1;
326 326
 				$child->update_child_levels();
327 327
 			}
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -195,7 +195,8 @@  discard block
 block discarded – undo
195 195
 
196 196
 		if ( ! empty( $email ) ) {
197 197
 			$avatar = $this->get_avatar_url( $default, $host, $email_hash, $size );
198
-		} else {
198
+		}
199
+		else {
199 200
 			$avatar = $default;
200 201
 		}
201 202
 
@@ -213,7 +214,8 @@  discard block
 block discarded – undo
213 214
 
214 215
 		if ( $user ) {
215 216
 			$email = $user->user_email;
216
-		} else {
217
+		}
218
+		else {
217 219
 			$email = $this->comment_author_email;
218 220
 		}
219 221
 
@@ -238,7 +240,8 @@  discard block
 block discarded – undo
238 240
 			$avatar_default = get_option( 'avatar_default' );
239 241
 			if ( empty( $avatar_default ) ) {
240 242
 				$default = 'mystery';
241
-			} else {
243
+			}
244
+			else {
242 245
 				$default = $avatar_default;
243 246
 			}
244 247
 		}
@@ -246,13 +249,17 @@  discard block
 block discarded – undo
246 249
 		if ( 'mystery' === $default ) {
247 250
 			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
248 251
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
249
-		} else if ( 'blank' === $default ) {
252
+		}
253
+		else if ( 'blank' === $default ) {
250 254
 			$default = $email ? 'blank' : includes_url( 'images/blank.gif' );
251
-		} else if ( ! empty( $email ) && 'gravatar_default' === $default ) {
255
+		}
256
+		else if ( ! empty( $email ) && 'gravatar_default' === $default ) {
252 257
 			$default = '';
253
-		} else if ( 'gravatar_default' === $default ) {
258
+		}
259
+		else if ( 'gravatar_default' === $default ) {
254 260
 			$default = $host . '/avatar/?s=' . $size;
255
-		} else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) {
261
+		}
262
+		else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) {
256 263
 			$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
257 264
 		}
258 265
 
@@ -269,10 +276,12 @@  discard block
 block discarded – undo
269 276
 
270 277
 		if ( is_ssl() ) {
271 278
 			$host = 'https://secure.gravatar.com';
272
-		} else {
279
+		}
280
+		else {
273 281
 			if ( ! empty( $email_hash ) ) {
274 282
 				$host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) );
275
-			} else {
283
+			}
284
+			else {
276 285
 				$host = 'http://0.gravatar.com';
277 286
 			}
278 287
 		}
Please login to merge, or discard this patch.