Completed
Push — master ( 985b38...1f2dd7 )
by Jared
03:31
created
lib/image/timber-image-operation-resize.php 1 patch
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,6 +75,9 @@  discard block
 block discarded – undo
75 75
 		return $image->writeImages($save_filename, true);
76 76
 	}
77 77
 
78
+	/**
79
+	 * @param string $load_filename
80
+	 */
78 81
 	protected function get_target_sizes( $load_filename ) {
79 82
 		$image = wp_get_image_editor( $load_filename );
80 83
 		$w = $this->w;
@@ -142,7 +145,7 @@  discard block
 block discarded – undo
142 145
 	 *                               (ex: /src/var/www/wp-content/uploads/my-pic.jpg)
143 146
 	 * @param  string $save_filename filepath (not URL) where result file should be saved
144 147
 	 *                               (ex: /src/var/www/wp-content/uploads/my-pic-300x200-c-default.jpg)
145
-	 * @return bool                  true if everything went fine, false otherwise
148
+	 * @return boolean|null                  true if everything went fine, false otherwise
146 149
 	 */
147 150
 	public function run($load_filename, $save_filename) {
148 151
 		//should be resized by gif resizer
Please login to merge, or discard this patch.
lib/timber-comment.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	function init($cid) {
56 56
 		$comment_data = $cid;
57
-		if (is_integer($cid)) {
57
+		if ( is_integer($cid) ) {
58 58
 			$comment_data = get_comment($cid);
59 59
 		}
60 60
 		$this->import($comment_data);
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	 * @return TimberUser
87 87
 	 */
88 88
 	public function author() {
89
-		if ($this->user_id) {
89
+		if ( $this->user_id ) {
90 90
 			return new TimberUser($this->user_id);
91 91
 		} else {
92 92
 			$author = new TimberUser(0);
93
-			if (isset($this->comment_author) && $this->comment_author) {
93
+			if ( isset($this->comment_author) && $this->comment_author ) {
94 94
 				$author->name = $this->comment_author;
95 95
 			} else {
96 96
 				$author->name = 'Anonymous';
@@ -114,21 +114,21 @@  discard block
 block discarded – undo
114 114
 	 * @return bool|mixed|string
115 115
 	 */
116 116
 	public function avatar($size = 92, $default = '') {
117
-		if (!get_option('show_avatars')) {
117
+		if ( !get_option('show_avatars') ) {
118 118
 			return false;
119 119
 		}
120
-		if (!is_numeric($size)) {
120
+		if ( !is_numeric($size) ) {
121 121
 			$size = '92';
122 122
 		}
123 123
 
124 124
 		$email = $this->avatar_email();
125 125
 		$email_hash = '';
126
-		if (!empty($email)) {
126
+		if ( !empty($email) ) {
127 127
 			$email_hash = md5(strtolower(trim($email)));
128 128
 		}
129 129
 		$host = $this->avatar_host($email_hash);
130 130
 		$default = $this->avatar_default($default, $email, $size, $host);
131
-		if (!empty($email)) {
131
+		if ( !empty($email) ) {
132 132
 			$avatar = $this->avatar_out($default, $host, $email_hash, $size);
133 133
 		} else {
134 134
 			$avatar = $default;
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 	 * ```
180 180
 	 * @return string
181 181
 	 */
182
-	public function date( $date_format = '' ) {
182
+	public function date($date_format = '') {
183 183
 		$df = $date_format ? $date_format : get_option('date_format');
184
-		$the_date = (string)mysql2date($df, $this->comment_date);
184
+		$the_date = (string) mysql2date($df, $this->comment_date);
185 185
 		return apply_filters('get_comment_date ', $the_date, $df);
186 186
 	}
187 187
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	 * ```
205 205
 	 * @return string
206 206
 	 */
207
-	public function time( $time_format = '' ) {
207
+	public function time($time_format = '') {
208 208
 		$tf = $time_format ? $time_format : get_option('time_format');
209
-		$the_time = (string)mysql2date($tf, $this->comment_date);
209
+		$the_time = (string) mysql2date($tf, $this->comment_date);
210 210
 		return apply_filters('get_comment_time', $the_time, $tf);
211 211
 	}
212 212
 
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
 	 * @return mixed
233 233
 	 */
234 234
 	protected function get_meta_fields($comment_id = null) {
235
-		if ($comment_id === null) {
235
+		if ( $comment_id === null ) {
236 236
 			$comment_id = $this->ID;
237 237
 		}
238 238
 		//Could not find a WP function to fetch all comment meta data, so I made one.
239 239
 		apply_filters('timber_comment_get_meta_pre', array(), $comment_id);
240 240
 		$comment_metas = get_comment_meta($comment_id);
241 241
 		foreach ($comment_metas as &$cm) {
242
-			if (is_array($cm) && count($cm) == 1) {
242
+			if ( is_array($cm) && count($cm) == 1 ) {
243 243
 				$cm = $cm[0];
244 244
 			}
245 245
 		}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	protected function get_meta_field($field_name) {
256 256
 		$value = apply_filters('timber_comment_get_meta_field_pre', null, $this->ID, $field_name, $this);
257
-		if ($value === null) {
257
+		if ( $value === null ) {
258 258
 			$value = get_comment_meta($this->ID, $field_name, true);
259 259
 		}
260 260
 		$value = apply_filters('timber_comment_get_meta_field', $value, $this->ID, $field_name, $this);
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 	 * @api
268 268
 	 * @return string
269 269
 	 */
270
-	public function reply_link( $reply_text = 'Reply' ) {
270
+	public function reply_link($reply_text = 'Reply') {
271 271
 		if ( is_singular() && comments_open() && get_option('thread_comments') ) {
272
-			wp_enqueue_script( 'comment-reply' );
272
+			wp_enqueue_script('comment-reply');
273 273
 		}
274 274
 
275 275
 		// Get the comments depth option from the admin panel
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			'max_depth' => $max_depth,
285 285
 		);
286 286
 
287
-		return get_comment_reply_link( $args, $this->ID, $this->post_id );
287
+		return get_comment_reply_link($args, $this->ID, $this->post_id);
288 288
 	}
289 289
 
290 290
 	/* AVATAR Stuff
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	 * @return string
296 296
 	 */
297 297
 	protected function avatar_email() {
298
-		$id = (int)$this->user_id;
298
+		$id = (int) $this->user_id;
299 299
 		$user = get_userdata($id);
300
-		if ($user) {
300
+		if ( $user ) {
301 301
 			$email = $user->user_email;
302 302
 		} else {
303 303
 			$email = $this->comment_author_email;
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 * @return string
312 312
 	 */
313 313
 	protected function avatar_host($email_hash) {
314
-		if (is_ssl()) {
314
+		if ( is_ssl() ) {
315 315
 			$host = 'https://secure.gravatar.com';
316 316
 		} else {
317
-			if (!empty($email_hash)) {
317
+			if ( !empty($email_hash) ) {
318 318
 				$host = sprintf("http://%d.gravatar.com", (hexdec($email_hash[0]) % 2));
319 319
 			} else {
320 320
 				$host = 'http://0.gravatar.com';
@@ -333,28 +333,28 @@  discard block
 block discarded – undo
333 333
 	 * @return string
334 334
 	 */
335 335
 	protected function avatar_default($default, $email, $size, $host) {
336
-		if (substr($default, 0, 1) == '/') {
336
+		if ( substr($default, 0, 1) == '/' ) {
337 337
 			$default = home_url() . $default;
338 338
 		}
339 339
 
340
-		if (empty($default)) {
340
+		if ( empty($default) ) {
341 341
 			$avatar_default = get_option('avatar_default');
342
-			if (empty($avatar_default)) {
342
+			if ( empty($avatar_default) ) {
343 343
 				$default = 'mystery';
344 344
 			} else {
345 345
 				$default = $avatar_default;
346 346
 			}
347 347
 		}
348
-		if ('mystery' == $default) {
348
+		if ( 'mystery' == $default ) {
349 349
 			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
350 350
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
351
-		} else if ('blank' == $default) {
351
+		} else if ( 'blank' == $default ) {
352 352
 			$default = $email ? 'blank' : includes_url('images/blank.gif');
353
-		} else if (!empty($email) && 'gravatar_default' == $default) {
353
+		} else if ( !empty($email) && 'gravatar_default' == $default ) {
354 354
 			$default = '';
355
-		} else if ('gravatar_default' == $default) {
355
+		} else if ( 'gravatar_default' == $default ) {
356 356
 			$default = $host . '/avatar/?s=' . $size;
357
-		} else if (empty($email) && !strstr($default, 'http://')) {
357
+		} else if ( empty($email) && !strstr($default, 'http://') ) {
358 358
 			$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
359 359
 		}
360 360
 		return $default;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	protected function avatar_out($default, $host, $email_hash, $size) {
372 372
 		$out = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode($default);
373 373
 		$rating = get_option('avatar_rating');
374
-		if (!empty($rating)) {
374
+		if ( !empty($rating) ) {
375 375
 			$out .= '&r=' . $rating;
376 376
 		}
377 377
 		return str_replace('&', '&', esc_url($out));
Please login to merge, or discard this patch.
lib/timber-image.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -141,27 +141,27 @@  discard block
 block discarded – undo
141 141
 	 * @internal
142 142
 	 * @param  int $iid the id number of the image in the WP database
143 143
 	 */
144
-	protected function get_image_info( $iid ) {
144
+	protected function get_image_info($iid) {
145 145
 		$image_info = $iid;
146
-		if (is_numeric($iid)) {
146
+		if ( is_numeric($iid) ) {
147 147
 			$image_info = wp_get_attachment_metadata($iid);
148
-			if (!is_array($image_info)) {
148
+			if ( !is_array($image_info) ) {
149 149
 				$image_info = array();
150 150
 			}
151 151
 			$image_custom = get_post_custom($iid);
152 152
 			$basic = get_post($iid);
153
-			if ($basic) {
154
-				if (isset($basic->post_excerpt)) {
153
+			if ( $basic ) {
154
+				if ( isset($basic->post_excerpt) ) {
155 155
 					$this->caption = $basic->post_excerpt;
156 156
 				}
157 157
 				$image_custom = array_merge($image_custom, get_object_vars($basic));
158 158
 			}
159 159
 			return array_merge($image_info, $image_custom);
160 160
 		}
161
-		if (is_array($image_info) && isset($image_info['image'])) {
161
+		if ( is_array($image_info) && isset($image_info['image']) ) {
162 162
 			return $image_info['image'];
163 163
 		}
164
-		if (is_object($image_info)) {
164
+		if ( is_object($image_info) ) {
165 165
 		   return get_object_vars($image_info);
166 166
 		}
167 167
 		return $iid;
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 	 * @internal
194 194
 	 * @param int $iid
195 195
 	 */
196
-	function init( $iid = false ) {
197
-		if ( !is_numeric( $iid ) && is_string( $iid ) ) {
198
-			if (strstr($iid, '://')) {
196
+	function init($iid = false) {
197
+		if ( !is_numeric($iid) && is_string($iid) ) {
198
+			if ( strstr($iid, '://') ) {
199 199
 				$this->init_with_url($iid);
200 200
 				return;
201 201
 			}
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 	 * @internal
245 245
 	 * @param string $relative_path
246 246
 	 */
247
-	protected function init_with_relative_path( $relative_path ) {
248
-		$this->abs_url = home_url( $relative_path );
249
-		$file_path = TimberURLHelper::get_full_path( $relative_path );
247
+	protected function init_with_relative_path($relative_path) {
248
+		$this->abs_url = home_url($relative_path);
249
+		$file_path = TimberURLHelper::get_full_path($relative_path);
250 250
 		$this->file_loc = $file_path;
251 251
 		$this->file = $file_path;
252 252
 	}
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 	 * @internal
256 256
 	 * @param string $file_path
257 257
 	 */
258
-	protected function init_with_file_path( $file_path ) {
259
-		$url = TimberURLHelper::file_system_to_url( $file_path );
258
+	protected function init_with_file_path($file_path) {
259
+		$url = TimberURLHelper::file_system_to_url($file_path);
260 260
 		$this->abs_url = $url;
261 261
 		$this->file_loc = $file_path;
262 262
 		$this->file = $file_path;
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param string $size
456 456
 	 * @return bool|string
457 457
 	 */
458
-	function get_src( $size = '' ) {
459
-		return $this->src( $size );
458
+	function get_src($size = '') {
459
+		return $this->src($size);
460 460
 	}
461 461
 
462 462
 	/**
Please login to merge, or discard this patch.
lib/timber-post.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param mixed $pid
169 169
 	 */
170 170
 	public function __construct($pid = null) {
171
-		$pid = $this->determine_id( $pid );
171
+		$pid = $this->determine_id($pid);
172 172
 		$this->init($pid);
173 173
 	}
174 174
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @param string $field
261 261
 	 * @param mixed $value
262 262
 	 */
263
-	public function update( $field, $value ) {
263
+	public function update($field, $value) {
264 264
 		if ( isset($this->ID) ) {
265 265
 			update_post_meta($this->ID, $field, $value);
266 266
 			$this->$field = $value;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 * @param mixed $pid
276 276
 	 * @return WP_Post on success
277 277
 	 */
278
-	protected function prepare_post_info( $pid = 0 ) {
278
+	protected function prepare_post_info($pid = 0) {
279 279
 		if ( is_string($pid) || is_numeric($pid) || (is_object($pid) && !isset($pid->post_title)) || $pid === 0 ) {
280 280
 			$pid = self::check_post_id($pid);
281 281
 			$post = get_post($pid);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * @internal
295 295
 	 * @return integer ID number of a post
296 296
 	 */
297
-	protected function check_post_id( $pid ) {
297
+	protected function check_post_id($pid) {
298 298
 		if ( is_numeric($pid) && $pid === 0 ) {
299 299
 			$pid = get_the_ID();
300 300
 			return $pid;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		global $wpdb;
321 321
 		$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s LIMIT 1", $post_name);
322 322
 		$result = $wpdb->get_row($query);
323
-		if (!$result) {
323
+		if ( !$result ) {
324 324
 			return null;
325 325
 		}
326 326
 		return $result->ID;
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 				$text = TimberHelper::trim_words($text, $len, false);
360 360
 				$trimmed = true;
361 361
 			}
362
-			$text = do_shortcode( $text );
362
+			$text = do_shortcode($text);
363 363
 		}
364 364
 		if ( !strlen($text) ) {
365 365
 			$text = TimberHelper::trim_words($this->get_content(), $len, false);
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 			}
389 389
 			$read_more_class = apply_filters('timber/post/get_preview/read_more_class', "read-more");
390 390
 			if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) {
391
-				$text .= ' <a href="' . $this->get_permalink() . '" class="'.$read_more_class .'">' . trim($readmore_matches[1]) . '</a>';
391
+				$text .= ' <a href="' . $this->get_permalink() . '" class="' . $read_more_class . '">' . trim($readmore_matches[1]) . '</a>';
392 392
 			} elseif ( $readmore ) {
393
-				$text .= ' <a href="' . $this->get_permalink() . '" class="'.$read_more_class .'">' . trim($readmore) . '</a>';
393
+				$text .= ' <a href="' . $this->get_permalink() . '" class="' . $read_more_class . '">' . trim($readmore) . '</a>';
394 394
 			}
395
-			if ( !$strip && $last_p_tag && ( strpos($text, '<p>') || strpos($text, '<p ') ) ) {
395
+			if ( !$strip && $last_p_tag && (strpos($text, '<p>') || strpos($text, '<p ')) ) {
396 396
 				$text .= '</p>';
397 397
 			}
398 398
 		}
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 * @internal
405 405
 	 * @param bool|int $pid a post ID number
406 406
 	 */
407
-	function import_custom( $pid = false ) {
407
+	function import_custom($pid = false) {
408 408
 		if ( !$pid ) {
409 409
 			$pid = $this->ID;
410 410
 		}
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
 	 * @param int $pid
420 420
 	 * @return array
421 421
 	 */
422
-	protected function get_post_custom( $pid ) {
422
+	protected function get_post_custom($pid) {
423 423
 		apply_filters('timber_post_get_meta_pre', array(), $pid, $this);
424 424
 		$customs = get_post_custom($pid);
425 425
 		if ( !is_array($customs) || empty($customs) ) {
426 426
 			return array();
427 427
 		}
428
-		foreach ( $customs as $key => $value ) {
428
+		foreach ($customs as $key => $value) {
429 429
 			if ( is_array($value) && count($value) == 1 && isset($value[0]) ) {
430 430
 				$value = $value[0];
431 431
 			}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 * @param bool $taxonomy
480 480
 	 * @return TimberPost|boolean
481 481
 	 */
482
-	function get_next( $taxonomy = false ) {
482
+	function get_next($taxonomy = false) {
483 483
 		if ( !isset($this->_next) || !isset($this->_next[$taxonomy]) ) {
484 484
 			global $post;
485 485
 			$this->_next = array();
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 		$post = $this;
511 511
 		$ret = array();
512 512
 		if ( $multipage ) {
513
-			for ( $i = 1; $i <= $numpages; $i++ ) {
513
+			for ($i = 1; $i <= $numpages; $i++) {
514 514
 				$link = self::get_wp_link_page($i);
515 515
 				$data = array('name' => $i, 'title' => $i, 'text' => $i, 'link' => $link);
516 516
 				if ( $i == $page ) {
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 * @param bool $taxonomy
563 563
 	 * @return TimberPost|boolean
564 564
 	 */
565
-	function get_prev( $taxonomy = false ) {
565
+	function get_prev($taxonomy = false) {
566 566
 		if ( isset($this->_prev) && isset($this->_prev[$taxonomy]) ) {
567 567
 			return $this->_prev[$taxonomy];
568 568
 		}
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 		$post->slug = $post->post_name;
630 630
 		$customs = $this->get_post_custom($post->ID);
631 631
 		$post->custom = $customs;
632
-		$post = (object) array_merge((array)$customs, (array)$post);
632
+		$post = (object) array_merge((array) $customs, (array) $post);
633 633
 		return $post;
634 634
 	}
635 635
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 * @param string $use
641 641
 	 * @return string
642 642
 	 */
643
-	function get_display_date( $use = 'post_date' ) {
643
+	function get_display_date($use = 'post_date') {
644 644
 		return date(get_option('date_format'), strtotime($this->$use));
645 645
 	}
646 646
 
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 	 * @param  string $date_format
651 651
 	 * @return string
652 652
 	 */
653
-	function get_date( $date_format = '' ) {
653
+	function get_date($date_format = '') {
654 654
 		$df = $date_format ? $date_format : get_option('date_format');
655
-		$the_date = (string)mysql2date($df, $this->post_date);
655
+		$the_date = (string) mysql2date($df, $this->post_date);
656 656
 		return apply_filters('get_the_date', $the_date, $df);
657 657
 	}
658 658
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	 * @param  string $date_format
662 662
 	 * @return string
663 663
 	 */
664
-	function get_modified_date( $date_format = '' ) {
664
+	function get_modified_date($date_format = '') {
665 665
 		$df = $date_format ? $date_format : get_option('date_format');
666 666
 		$the_time = $this->get_modified_time($df);
667 667
 		return apply_filters('get_the_modified_date', $the_time, $date_format);
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 	 * @param  string $time_format
673 673
 	 * @return string
674 674
 	 */
675
-	function get_modified_time( $time_format = '' ) {
675
+	function get_modified_time($time_format = '') {
676 676
 		$tf = $time_format ? $time_format : get_option('time_format');
677 677
 		$the_time = get_post_modified_time($tf, false, $this->ID, true);
678 678
 		return apply_filters('get_the_modified_time', $the_time, $time_format);
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	 * @param bool|string 	$childPostClass
686 686
 	 * @return array
687 687
 	 */
688
-	function get_children( $post_type = 'any', $childPostClass = false ) {
688
+	function get_children($post_type = 'any', $childPostClass = false) {
689 689
 		if ( $childPostClass === false ) {
690 690
 			$childPostClass = $this->PostClass;
691 691
 		}
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			$post_type = $this->post_type;
694 694
 		}
695 695
 		$children = get_children('post_parent=' . $this->ID . '&post_type=' . $post_type . '&numberposts=-1&orderby=menu_order title&order=ASC');
696
-		foreach ( $children as &$child ) {
696
+		foreach ($children as &$child) {
697 697
 			$child = new $childPostClass($child->ID);
698 698
 		}
699 699
 		$children = array_values($children);
@@ -729,20 +729,20 @@  discard block
 block discarded – undo
729 729
 		}
730 730
 
731 731
 		if ( $user_ID ) {
732
-			$args['include_unapproved'] = array( $user_ID );
733
-		} elseif ( ! empty( $comment_author_email ) ) {
734
-			$args['include_unapproved'] = array( $comment_author_email );
732
+			$args['include_unapproved'] = array($user_ID);
733
+		} elseif ( !empty($comment_author_email) ) {
734
+			$args['include_unapproved'] = array($comment_author_email);
735 735
 		}
736 736
 
737 737
 		$comments = get_comments($args);
738 738
 		$timber_comments = array();
739 739
 
740 740
 		if ( '' == get_query_var('cpage') && get_option('page_comments') ) {
741
-			set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 );
741
+			set_query_var('cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1);
742 742
 			$overridden_cpage = true;
743 743
 		}
744 744
 
745
-		foreach($comments as $key => &$comment) {
745
+		foreach ($comments as $key => &$comment) {
746 746
 			$timber_comment = new $CommentClass($comment);
747 747
 			$timber_comment->reply_link = $this->TimberComment_reply_link($comment->comment_ID, $this->ID);
748 748
 			$timber_comments[$timber_comment->id] = $timber_comment;
@@ -750,22 +750,22 @@  discard block
 block discarded – undo
750 750
 
751 751
 		// Build a flattened (depth=1) comment tree
752 752
 		$comments_tree = array();
753
-		foreach( $timber_comments as $key => $comment ) {
754
-			if ( ! $comment->is_child() ) {
753
+		foreach ($timber_comments as $key => $comment) {
754
+			if ( !$comment->is_child() ) {
755 755
 				continue;
756 756
 			}
757 757
 
758 758
 			$tree_element = $comment;
759 759
 			do {
760 760
 				$tree_element = $timber_comments[$tree_element->comment_parent];
761
-			} while( $tree_element->is_child() );
761
+			} while ($tree_element->is_child());
762 762
 
763 763
 			$comments_tree[$tree_element->id][] = $comment->id;
764 764
 		}
765 765
 
766 766
 		// Add child comments to the relative "super parents"
767
-		foreach($comments_tree as $comment_parent => $comment_children) {
768
-			foreach($comment_children as $comment_child) {
767
+		foreach ($comments_tree as $comment_parent => $comment_children) {
768
+			foreach ($comment_children as $comment_child) {
769 769
 				$timber_comments[$comment_parent]->children[] = $timber_comments[$comment_child];
770 770
 				unset($timber_comments[$comment_child]);
771 771
 			}
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	 * @param string $TermClass
806 806
 	 * @return array
807 807
 	 */
808
-	function get_terms( $tax = '', $merge = true, $TermClass = '' ) {
808
+	function get_terms($tax = '', $merge = true, $TermClass = '') {
809 809
 
810 810
 		$TermClass = $TermClass ?: $this->TermClass;
811 811
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 			$taxonomies = $tax;
817 817
 		}
818 818
 		if ( is_string($tax) ) {
819
-			if ( in_array($tax, array('all','any','')) ) {
819
+			if ( in_array($tax, array('all', 'any', '')) ) {
820 820
 				$taxonomies = get_object_taxonomies($this->post_type);
821 821
 			} else {
822 822
 				$taxonomies = array($tax);
@@ -825,8 +825,8 @@  discard block
 block discarded – undo
825 825
 
826 826
 		$term_class_objects = array();
827 827
 
828
-		foreach ( $taxonomies as $taxonomy ) {
829
-			if ( in_array($taxonomy, array('tag','tags')) ) {
828
+		foreach ($taxonomies as $taxonomy) {
829
+			if ( in_array($taxonomy, array('tag', 'tags')) ) {
830 830
 				$taxonomy = 'post_tag';
831 831
 			}
832 832
 			if ( $taxonomy == 'categories' ) {
@@ -863,11 +863,11 @@  discard block
 block discarded – undo
863 863
 	 * @param string $taxonomy
864 864
 	 * @return bool
865 865
 	 */
866
-	function has_term( $term_name_or_id, $taxonomy = 'all' ) {
866
+	function has_term($term_name_or_id, $taxonomy = 'all') {
867 867
 		if ( $taxonomy == 'all' || $taxonomy == 'any' ) {
868 868
 			$taxes = get_object_taxonomies($this->post_type, 'names');
869 869
 			$ret = false;
870
-			foreach ( $taxes as $tax ) {
870
+			foreach ($taxes as $tax) {
871 871
 				if ( has_term($term_name_or_id, $tax, $this->ID) ) {
872 872
 					$ret = true;
873 873
 					break;
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 	 * @param string $field
883 883
 	 * @return TimberImage
884 884
 	 */
885
-	function get_image( $field ) {
885
+	function get_image($field) {
886 886
 		return new $this->ImageClass($this->$field);
887 887
 	}
888 888
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 	 * @param int $page
933 933
 	 * @return string
934 934
 	 */
935
-	function get_content( $len = 0, $page = 0 ) {
935
+	function get_content($len = 0, $page = 0) {
936 936
 		if ( $len == 0 && $page == 0 && $this->_content ) {
937 937
 			return $this->_content;
938 938
 		}
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 	 * @param string $field_name
990 990
 	 * @return mixed
991 991
 	 */
992
-	public function get_field( $field_name ) {
992
+	public function get_field($field_name) {
993 993
 		$value = apply_filters('timber_post_get_meta_field_pre', null, $this->ID, $field_name, $this);
994 994
 		if ( $value === null ) {
995 995
 			$value = get_post_meta($this->ID, $field_name);
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 	/**
1008 1008
 	 * @param string $field_name
1009 1009
 	 */
1010
-	function import_field( $field_name ) {
1010
+	function import_field($field_name) {
1011 1011
 		$this->$field_name = $this->get_field($field_name);
1012 1012
 	}
1013 1013
 
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 	 * ```
1039 1039
 	 * @return string a space-seperated list of classes
1040 1040
 	 */
1041
-	public function post_class( $class='' ) {
1041
+	public function post_class($class = '') {
1042 1042
 		global $post;
1043 1043
 		$old_global_post = $post;
1044 1044
 		$post = $this;
@@ -1146,8 +1146,8 @@  discard block
 block discarded – undo
1146 1146
 	 * @param string|bool $childPostClass _optional_ a custom post class (ex: 'MyTimberPost') to return the objects as. By default (false) it will use TimberPost::$post_class value.
1147 1147
 	 * @return array
1148 1148
 	 */
1149
-	public function children( $post_type = 'any', $childPostClass = false ) {
1150
-		return $this->get_children( $post_type, $childPostClass );
1149
+	public function children($post_type = 'any', $childPostClass = false) {
1150
+		return $this->get_children($post_type, $childPostClass);
1151 1151
 	}
1152 1152
 
1153 1153
 	/**
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 	 * ```
1172 1172
 	 * @return bool|array
1173 1173
 	 */
1174
-	public function comments( $count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment' ) {
1174
+	public function comments($count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment') {
1175 1175
 		return $this->get_comments($count, $order, $type, $status, $CommentClass);
1176 1176
 	}
1177 1177
 
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 	 * @param int $page
1189 1189
 	 * @return string
1190 1190
 	 */
1191
-	public function content( $page = 0 ) {
1191
+	public function content($page = 0) {
1192 1192
 		return $this->get_content(0, $page);
1193 1193
 	}
1194 1194
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 	 * @param string $date_format
1218 1218
 	 * @return string
1219 1219
 	 */
1220
-	public function date( $date_format = '' ) {
1220
+	public function date($date_format = '') {
1221 1221
 		return $this->get_date($date_format);
1222 1222
 	}
1223 1223
 
@@ -1239,9 +1239,9 @@  discard block
 block discarded – undo
1239 1239
 	 * @param string $time_format
1240 1240
 	 * @return string
1241 1241
 	 */
1242
-	public function time( $time_format = '' ) {
1242
+	public function time($time_format = '') {
1243 1243
 		$tf = $time_format ? $time_format : get_option('time_format');
1244
-	 	$the_time = (string)mysql2date($tf, $this->post_date);
1244
+	 	$the_time = (string) mysql2date($tf, $this->post_date);
1245 1245
 	 	return apply_filters('get_the_time', $the_time, $tf);
1246 1246
 	}
1247 1247
 
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 	 * @param string $field_name
1278 1278
 	 * @return mixed
1279 1279
 	 */
1280
-	public function meta( $field_name = null ) {
1280
+	public function meta($field_name = null) {
1281 1281
 		if ( $field_name === null ) {
1282 1282
 			//on the off-chance the field is actually named meta
1283 1283
 			$field_name = 'meta';
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 	 * @param string $date_format
1297 1297
 	 * @return string
1298 1298
 	 */
1299
-	public function modified_date( $date_format = '' ) {
1299
+	public function modified_date($date_format = '') {
1300 1300
 		return $this->get_modified_date($date_format);
1301 1301
 	}
1302 1302
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 	 * @param string $time_format
1305 1305
 	 * @return string
1306 1306
 	 */
1307
-	public function modified_time( $time_format = '' ) {
1307
+	public function modified_time($time_format = '') {
1308 1308
 		return $this->get_modified_time($time_format);
1309 1309
 	}
1310 1310
 
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 	 * @param bool $in_same_cat
1314 1314
 	 * @return mixed
1315 1315
 	 */
1316
-	public function next( $in_same_cat = false ) {
1316
+	public function next($in_same_cat = false) {
1317 1317
 		return $this->get_next($in_same_cat);
1318 1318
 	}
1319 1319
 
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 	 * @param bool $in_same_cat
1372 1372
 	 * @return mixed
1373 1373
 	 */
1374
-	public function prev( $in_same_cat = false ) {
1374
+	public function prev($in_same_cat = false) {
1375 1375
 		return $this->get_prev($in_same_cat);
1376 1376
 	}
1377 1377
 
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 	 * @param bool $merge Should the resulting array be one big one (true)? Or should it be an array of sub-arrays for each taxonomy (false)?
1384 1384
 	 * @return array
1385 1385
 	 */
1386
-	public function terms( $tax = '', $merge = true ) {
1386
+	public function terms($tax = '', $merge = true) {
1387 1387
 		return $this->get_terms($tax, $merge);
1388 1388
 	}
1389 1389
 
Please login to merge, or discard this patch.
lib/image/timber-image-operation-tojpg.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 	 * @return bool                  true if everything went fine, false otherwise
37 37
 	 */
38 38
 	function run($load_filename, $save_filename) {
39
-		$input = self::image_create( $load_filename );
40
-		list( $width, $height ) = getimagesize( $load_filename );
41
-		$output = imagecreatetruecolor( $width, $height );
42
-		$c = self::hexrgb( $this->color );
43
-		$color = imagecolorallocate( $output, $c['red'], $c['green'], $c['blue'] );
44
-		imagefilledrectangle( $output, 0, 0, $width, $height, $color );
45
-		imagecopy( $output, $input, 0, 0, 0, 0, $width, $height );
46
-		imagejpeg( $output, $save_filename );
39
+		$input = self::image_create($load_filename);
40
+		list($width, $height) = getimagesize($load_filename);
41
+		$output = imagecreatetruecolor($width, $height);
42
+		$c = self::hexrgb($this->color);
43
+		$color = imagecolorallocate($output, $c['red'], $c['green'], $c['blue']);
44
+		imagefilledrectangle($output, 0, 0, $width, $height, $color);
45
+		imagecopy($output, $input, 0, 0, 0, 0, $width, $height);
46
+		imagejpeg($output, $save_filename);
47 47
 		return true;
48 48
 	}
49 49
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	 * @return resource an image identifier representing the image obtained from the given filename
53 53
 	 *                  will return the same data type regardless of whether the source is gif or png
54 54
 	 */
55
-	function image_create( $filename, $ext = 'auto' ) {
55
+	function image_create($filename, $ext = 'auto') {
56 56
 		if ( $ext == 'auto' ) {
57 57
 			$ext = wp_check_filetype($filename);
58
-			if (isset($ext['ext'])) {
58
+			if ( isset($ext['ext']) ) {
59 59
 				$ext = $ext['ext'];
60 60
 			}
61 61
 		}
@@ -69,6 +69,6 @@  discard block
 block discarded – undo
69 69
 		if ( $ext == 'jpg' || $ext == 'jpeg' ) {
70 70
 			return imagecreatefromjpeg($filename);
71 71
 		}
72
-		throw new InvalidArgumentException( 'image_create only accepts PNG, GIF and JPGs. File extension was: '.$ext );
72
+		throw new InvalidArgumentException('image_create only accepts PNG, GIF and JPGs. File extension was: ' . $ext);
73 73
 	}
74 74
 }
Please login to merge, or discard this patch.