| @@ -41,6 +41,10 @@ discard block | ||
| 41 | 41 | return $result; | 
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | + /** | |
| 45 | + * @param string $load_filename | |
| 46 | + * @param string $save_filename | |
| 47 | + */ | |
| 44 | 48 |  	protected function run_animated_gif( $load_filename, $save_filename ) { | 
| 45 | 49 | $image = wp_get_image_editor( $load_filename ); | 
| 46 | 50 | $current_size = $image->get_size(); | 
| @@ -130,7 +134,7 @@ discard block | ||
| 130 | 134 | * (ex: /src/var/www/wp-content/uploads/my-pic.jpg) | 
| 131 | 135 | * @param string $save_filename filepath (not URL) where result file should be saved | 
| 132 | 136 | * (ex: /src/var/www/wp-content/uploads/my-pic-300x200-c-default.jpg) | 
| 133 | - * @return bool true if everything went fine, false otherwise | |
| 137 | + * @return boolean|null true if everything went fine, false otherwise | |
| 134 | 138 | */ | 
| 135 | 139 |  	public function run($load_filename, $save_filename) { | 
| 136 | 140 | //should be resized by gif resizer | 
| @@ -48,6 +48,7 @@ | ||
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | /** | 
| 51 | + * @param string $filename | |
| 51 | 52 | * @return resource an image identifier representing the image obtained from the given filename | 
| 52 | 53 | * will return the same data type regardless of whether the source is gif or png | 
| 53 | 54 | */ | 
| @@ -240,8 +240,6 @@ | ||
| 240 | 240 | * Enqueue the WP threaded comments javascript, | 
| 241 | 241 | * and fetch the reply link for various comments. | 
| 242 | 242 | * @api | 
| 243 | - * @param int $comment_id | |
| 244 | - * @param int $post_id | |
| 245 | 243 | * @return string | 
| 246 | 244 | */ | 
| 247 | 245 |  	public function reply_link( $reply_text = 'Reply' ) { | 
| @@ -176,7 +176,7 @@ discard block | ||
| 176 | 176 | * | 
| 177 | 177 | * | 
| 178 | 178 | * @param mixed $arg that you want to error_log | 
| 179 | - * @return void | |
| 179 | + * @return null|boolean | |
| 180 | 180 | */ | 
| 181 | 181 |  	public static function error_log( $arg ) { | 
| 182 | 182 |  		if ( !WP_DEBUG ) { | 
| @@ -208,7 +208,7 @@ discard block | ||
| 208 | 208 | * | 
| 209 | 209 | * @param string $text | 
| 210 | 210 | * @param int $num_words | 
| 211 | - * @param string|null|false $more text to appear in "Read more...". Null to use default, false to hide | |
| 211 | + * @param boolean $more text to appear in "Read more...". Null to use default, false to hide | |
| 212 | 212 | * @param string $allowed_tags | 
| 213 | 213 | * @return string | 
| 214 | 214 | */ | 
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | * Generates a new image with increased size, for display on Retina screens. | 
| 86 | 86 | * | 
| 87 | 87 | * @param string $src | 
| 88 | - * @param float $multiplier | |
| 88 | + * @param integer $multiplier | |
| 89 | 89 | * @param boolean $force | 
| 90 | 90 | * | 
| 91 | 91 | * @return string url to the new image | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 | * @param int $h | 
| 137 | 137 | * @param string $color | 
| 138 | 138 | * @param bool $force | 
| 139 | - * @return mixed|null|string | |
| 139 | + * @return string | |
| 140 | 140 | */ | 
| 141 | 141 |  	public static function letterbox( $src, $w, $h, $color = '#000000', $force = false ) { | 
| 142 | 142 | $op = new TimberImageOperationLetterbox($w, $h, $color); | 
| @@ -108,23 +108,23 @@ | ||
| 108 | 108 | //its a gif so test | 
| 109 | 109 |  		if(!($fh = @fopen($file, 'rb'))) { | 
| 110 | 110 | return false; | 
| 111 | - } | |
| 112 | - $count = 0; | |
| 113 | - //an animated gif contains multiple "frames", with each frame having a | |
| 114 | - //header made up of: | |
| 115 | - // * a static 4-byte sequence (\x00\x21\xF9\x04) | |
| 116 | - // * 4 variable bytes | |
| 117 | - // * a static 2-byte sequence (\x00\x2C) | |
| 111 | + } | |
| 112 | + $count = 0; | |
| 113 | + //an animated gif contains multiple "frames", with each frame having a | |
| 114 | + //header made up of: | |
| 115 | + // * a static 4-byte sequence (\x00\x21\xF9\x04) | |
| 116 | + // * 4 variable bytes | |
| 117 | + // * a static 2-byte sequence (\x00\x2C) | |
| 118 | 118 | |
| 119 | - // We read through the file til we reach the end of the file, or we've found | |
| 120 | - // at least 2 frame headers | |
| 121 | -	    while(!feof($fh) && $count < 2) { | |
| 122 | - $chunk = fread($fh, 1024 * 100); //read 100kb at a time | |
| 123 | -	        $count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches); | |
| 124 | - } | |
| 119 | + // We read through the file til we reach the end of the file, or we've found | |
| 120 | + // at least 2 frame headers | |
| 121 | +		while(!feof($fh) && $count < 2) { | |
| 122 | + $chunk = fread($fh, 1024 * 100); //read 100kb at a time | |
| 123 | +			$count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches); | |
| 124 | + } | |
| 125 | 125 | |
| 126 | - fclose($fh); | |
| 127 | - return $count > 1; | |
| 126 | + fclose($fh); | |
| 127 | + return $count > 1; | |
| 128 | 128 | } | 
| 129 | 129 | |
| 130 | 130 | /** | 
| @@ -301,7 +301,7 @@ | ||
| 301 | 301 |  	 * 	   <img src="{{ post.thumbnail.src|resize(500) }}" alt="A sumo wrestler" /> | 
| 302 | 302 |  	 * {% endif %} | 
| 303 | 303 | * ``` | 
| 304 | - * @return float | |
| 304 | + * @return integer | |
| 305 | 305 | */ | 
| 306 | 306 |  	public function aspect() { | 
| 307 | 307 | $w = intval($this->width()); | 
| @@ -373,8 +373,8 @@ | ||
| 373 | 373 | * @api | 
| 374 | 374 | * @example | 
| 375 | 375 | * ```twig | 
| 376 | - 	 * <h1>{{post.title}}</h1> | |
| 377 | - 	 * <img src="{{post.thumbnail.src}}" /> | |
| 376 | +	 * <h1>{{post.title}}</h1> | |
| 377 | +	 * <img src="{{post.thumbnail.src}}" /> | |
| 378 | 378 | * ``` | 
| 379 | 379 | * ```html | 
| 380 | 380 | * <img src="http://example.org/wp-content/uploads/2015/08/pic.jpg" /> | 
| @@ -149,7 +149,7 @@ | ||
| 149 | 149 | /** | 
| 150 | 150 | * | 
| 151 | 151 | * @internal | 
| 152 | - * @return bool | |
| 152 | + * @return boolean|null | |
| 153 | 153 | */ | 
| 154 | 154 |  	function update_child_levels() { | 
| 155 | 155 |  		if (is_array($this->children)) { | 
| @@ -73,7 +73,7 @@ | ||
| 73 | 73 | public $title; | 
| 74 | 74 | |
| 75 | 75 | /** | 
| 76 | - * @param int|string $slug | |
| 76 | + * @param integer $slug | |
| 77 | 77 | */ | 
| 78 | 78 |  	function __construct($slug = 0) { | 
| 79 | 79 | $locations = get_nav_menu_locations(); | 
| @@ -225,7 +225,7 @@ discard block | ||
| 225 | 225 | /** | 
| 226 | 226 | * Initializes a TimberPost | 
| 227 | 227 | * @internal | 
| 228 | - * @param int|bool $pid | |
| 228 | + * @param integer $pid | |
| 229 | 229 | */ | 
| 230 | 230 |  	protected function init($pid = false) { | 
| 231 | 231 |  		if ( $pid === false ) { | 
| @@ -272,7 +272,7 @@ discard block | ||
| 272 | 272 | * takes a mix of integer (post ID), string (post slug), | 
| 273 | 273 | * or object to return a WordPress post object from WP's built-in get_post() function | 
| 274 | 274 | * @internal | 
| 275 | - * @param mixed $pid | |
| 275 | + * @param integer $pid | |
| 276 | 276 | * @return WP_Post on success | 
| 277 | 277 | */ | 
| 278 | 278 |  	protected function prepare_post_info( $pid = 0 ) { | 
| @@ -598,7 +598,7 @@ discard block | ||
| 598 | 598 | * Gets a User object from the author of the post | 
| 599 | 599 | * @internal | 
| 600 | 600 | * @see TimberPost::author | 
| 601 | - * @return bool|TimberUser | |
| 601 | + * @return TimberUser|null | |
| 602 | 602 | */ | 
| 603 | 603 |  	function get_author() { | 
| 604 | 604 |  		if ( isset($this->post_author) ) { | 
| @@ -608,7 +608,7 @@ discard block | ||
| 608 | 608 | |
| 609 | 609 | /** | 
| 610 | 610 | * @internal | 
| 611 | - * @return bool|TimberUser | |
| 611 | + * @return TimberUser|null | |
| 612 | 612 | */ | 
| 613 | 613 |  	function get_modified_author() { | 
| 614 | 614 | $user_id = get_post_meta($this->ID, '_edit_last', true); | 
| @@ -1073,7 +1073,7 @@ discard block | ||
| 1073 | 1073 |  	 *     <a href="{{post.author.link}}">{{post.author.name}}</a> | 
| 1074 | 1074 | * </p> | 
| 1075 | 1075 | * ``` | 
| 1076 | - * @return TimberUser|bool A TimberUser object if found, false if not | |
| 1076 | + * @return TimberUser|null A TimberUser object if found, false if not | |
| 1077 | 1077 | */ | 
| 1078 | 1078 |  	public function author() { | 
| 1079 | 1079 | return $this->get_author(); | 
| @@ -1088,7 +1088,7 @@ discard block | ||
| 1088 | 1088 | * ```html | 
| 1089 | 1089 | * Last updated by Harper Lee | 
| 1090 | 1090 | * ``` | 
| 1091 | - * @return TimberUser|bool A TimberUser object if found, false if not | |
| 1091 | + * @return TimberUser|null A TimberUser object if found, false if not | |
| 1092 | 1092 | */ | 
| 1093 | 1093 |  	public function modified_author() { | 
| 1094 | 1094 | return $this->get_modified_author(); | 
| @@ -736,33 +736,33 @@ | ||
| 736 | 736 | $overridden_cpage = true; | 
| 737 | 737 | } | 
| 738 | 738 | |
| 739 | -    foreach($comments as $key => &$comment) { | |
| 740 | - $timber_comment = new $CommentClass($comment); | |
| 741 | - $timber_comment->reply_link = $this->TimberComment_reply_link($comment->comment_ID, $this->ID); | |
| 742 | - $timber_comments[$timber_comment->id] = $timber_comment; | |
| 743 | - } | |
| 739 | +	foreach($comments as $key => &$comment) { | |
| 740 | + $timber_comment = new $CommentClass($comment); | |
| 741 | + $timber_comment->reply_link = $this->TimberComment_reply_link($comment->comment_ID, $this->ID); | |
| 742 | + $timber_comments[$timber_comment->id] = $timber_comment; | |
| 743 | + } | |
| 744 | 744 | |
| 745 | 745 | // Build a flattened (depth=1) comment tree | 
| 746 | 746 | $comments_tree = array(); | 
| 747 | -    foreach( $timber_comments as $key => $comment ) { | |
| 748 | -      if ( ! $comment->is_child() ) { | |
| 749 | - continue; | |
| 750 | - } | |
| 751 | - | |
| 752 | - $tree_element = $comment; | |
| 753 | -      do { | |
| 754 | - $tree_element = $timber_comments[$tree_element->comment_parent]; | |
| 755 | - } while($tree_element->is_child()); | |
| 756 | - $comments_tree[$tree_element->id][] = $comment->id; | |
| 757 | - } | |
| 758 | - | |
| 759 | - // Add child comments to the relative "super parents" | |
| 760 | -    foreach($comments_tree as $comment_parent => $comment_children) { | |
| 761 | -      foreach($comment_children as $comment_child) { | |
| 762 | - $timber_comments[$comment_parent]->children[] = $timber_comments[$comment_child]; | |
| 763 | - unset($timber_comments[$comment_child]); | |
| 764 | - } | |
| 765 | - } | |
| 747 | +	foreach( $timber_comments as $key => $comment ) { | |
| 748 | +	  if ( ! $comment->is_child() ) { | |
| 749 | + continue; | |
| 750 | + } | |
| 751 | + | |
| 752 | + $tree_element = $comment; | |
| 753 | +	  do { | |
| 754 | + $tree_element = $timber_comments[$tree_element->comment_parent]; | |
| 755 | + } while($tree_element->is_child()); | |
| 756 | + $comments_tree[$tree_element->id][] = $comment->id; | |
| 757 | + } | |
| 758 | + | |
| 759 | + // Add child comments to the relative "super parents" | |
| 760 | +	foreach($comments_tree as $comment_parent => $comment_children) { | |
| 761 | +	  foreach($comment_children as $comment_child) { | |
| 762 | + $timber_comments[$comment_parent]->children[] = $timber_comments[$comment_child]; | |
| 763 | + unset($timber_comments[$comment_child]); | |
| 764 | + } | |
| 765 | + } | |
| 766 | 766 | |
| 767 | 767 | $timber_comments = array_values($timber_comments); | 
| 768 | 768 | |