@@ -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  | 
                                                        
@@ -21,8 +21,8 @@ discard block  | 
                                                    ||
| 21 | 21 | $this->w = $w;  | 
                                                        
| 22 | 22 | $this->h = $h;  | 
                                                        
| 23 | 23 | // Sanitize crop position  | 
                                                        
| 24 | - $allowed_crop_positions = array( 'default', 'center', 'top', 'bottom', 'left', 'right' );  | 
                                                        |
| 25 | -		if ( $crop !== false && !in_array( $crop, $allowed_crop_positions ) ) { | 
                                                        |
| 24 | +		$allowed_crop_positions = array('default', 'center', 'top', 'bottom', 'left', 'right'); | 
                                                        |
| 25 | +		if ( $crop !== false && !in_array($crop, $allowed_crop_positions) ) { | 
                                                        |
| 26 | 26 | $crop = $allowed_crop_positions[0];  | 
                                                        
| 27 | 27 | }  | 
                                                        
| 28 | 28 | $this->crop = $crop;  | 
                                                        
@@ -34,15 +34,15 @@ discard block  | 
                                                    ||
| 34 | 34 | * @return string the final filename to be used (ex: my-awesome-pic-300x200-c-default.jpg)  | 
                                                        
| 35 | 35 | */  | 
                                                        
| 36 | 36 |  	public function filename($src_filename, $src_extension) { | 
                                                        
| 37 | - $result = $src_filename . '-' . $this->w . 'x' . $this->h . '-c-' . ( $this->crop ? $this->crop : 'f' ); // Crop will be either user named or f (false)  | 
                                                        |
| 38 | -		if($src_extension) { | 
                                                        |
| 39 | - $result .= '.'.$src_extension;  | 
                                                        |
| 37 | + $result = $src_filename . '-' . $this->w . 'x' . $this->h . '-c-' . ($this->crop ? $this->crop : 'f'); // Crop will be either user named or f (false)  | 
                                                        |
| 38 | +		if ( $src_extension ) { | 
                                                        |
| 39 | + $result .= '.' . $src_extension;  | 
                                                        |
| 40 | 40 | }  | 
                                                        
| 41 | 41 | return $result;  | 
                                                        
| 42 | 42 | }  | 
                                                        
| 43 | 43 | |
| 44 | -	protected function run_animated_gif( $load_filename, $save_filename ) { | 
                                                        |
| 45 | - $image = wp_get_image_editor( $load_filename );  | 
                                                        |
| 44 | +	protected function run_animated_gif($load_filename, $save_filename) { | 
                                                        |
| 45 | + $image = wp_get_image_editor($load_filename);  | 
                                                        |
| 46 | 46 | $current_size = $image->get_size();  | 
                                                        
| 47 | 47 | $src_w = $current_size['width'];  | 
                                                        
| 48 | 48 | $src_h = $current_size['height'];  | 
                                                        
@@ -53,7 +53,7 @@ discard block  | 
                                                    ||
| 53 | 53 | }  | 
                                                        
| 54 | 54 | $image = new Imagick($load_filename);  | 
                                                        
| 55 | 55 | $image = $image->coalesceImages();  | 
                                                        
| 56 | - $crop = self::get_target_sizes( $load_filename );  | 
                                                        |
| 56 | + $crop = self::get_target_sizes($load_filename);  | 
                                                        |
| 57 | 57 |  		foreach ($image as $frame) { | 
                                                        
| 58 | 58 | $frame->cropImage($crop['src_w'], $crop['src_h'], $crop['x'], $crop['y']);  | 
                                                        
| 59 | 59 | $frame->thumbnailImage($w, $h);  | 
                                                        
@@ -63,8 +63,8 @@ discard block  | 
                                                    ||
| 63 | 63 | return $image->writeImages($save_filename, true);  | 
                                                        
| 64 | 64 | }  | 
                                                        
| 65 | 65 | |
| 66 | -	protected function get_target_sizes( $load_filename ) { | 
                                                        |
| 67 | - $image = wp_get_image_editor( $load_filename );  | 
                                                        |
| 66 | +	protected function get_target_sizes($load_filename) { | 
                                                        |
| 67 | + $image = wp_get_image_editor($load_filename);  | 
                                                        |
| 68 | 68 | $w = $this->w;  | 
                                                        
| 69 | 69 | $h = $this->h;  | 
                                                        
| 70 | 70 | $crop = $this->crop;  | 
                                                        
@@ -74,11 +74,11 @@ discard block  | 
                                                    ||
| 74 | 74 | $src_h = $current_size['height'];  | 
                                                        
| 75 | 75 | $src_ratio = $src_w / $src_h;  | 
                                                        
| 76 | 76 |  		if ( !$h ) { | 
                                                        
| 77 | - $h = round( $w / $src_ratio );  | 
                                                        |
| 77 | + $h = round($w / $src_ratio);  | 
                                                        |
| 78 | 78 | }  | 
                                                        
| 79 | 79 |  		if ( !$w ) { | 
                                                        
| 80 | 80 | //the user wants to resize based on constant height  | 
                                                        
| 81 | - $w = round( $h * $src_ratio );  | 
                                                        |
| 81 | + $w = round($h * $src_ratio);  | 
                                                        |
| 82 | 82 | }  | 
                                                        
| 83 | 83 |  		if ( !$crop ) { | 
                                                        
| 84 | 84 | return array(  | 
                                                        
@@ -92,12 +92,12 @@ discard block  | 
                                                    ||
| 92 | 92 | $src_wt = $src_h * $dest_ratio;  | 
                                                        
| 93 | 93 | $src_ht = $src_w / $dest_ratio;  | 
                                                        
| 94 | 94 | $src_x = $src_w / 2 - $src_wt / 2;  | 
                                                        
| 95 | - $src_y = ( $src_h - $src_ht ) / 6;  | 
                                                        |
| 95 | + $src_y = ($src_h - $src_ht) / 6;  | 
                                                        |
| 96 | 96 | //now specific overrides based on options:  | 
                                                        
| 97 | 97 |  		if ( $crop == 'center' ) { | 
                                                        
| 98 | 98 | // Get source x and y  | 
                                                        
| 99 | - $src_x = round( ( $src_w - $src_wt ) / 2 );  | 
                                                        |
| 100 | - $src_y = round( ( $src_h - $src_ht ) / 2 );  | 
                                                        |
| 99 | + $src_x = round(($src_w - $src_wt) / 2);  | 
                                                        |
| 100 | + $src_y = round(($src_h - $src_ht) / 2);  | 
                                                        |
| 101 | 101 |  		} else if ( $crop == 'top' ) { | 
                                                        
| 102 | 102 | $src_y = 0;  | 
                                                        
| 103 | 103 |  		} else if ( $crop == 'bottom' ) { | 
                                                        
@@ -139,32 +139,32 @@ discard block  | 
                                                    ||
| 139 | 139 | //return if successful  | 
                                                        
| 140 | 140 | //proceed if not  | 
                                                        
| 141 | 141 | $gif = self::run_animated_gif($load_filename, $save_filename);  | 
                                                        
| 142 | -			if ($gif) { | 
                                                        |
| 142 | +			if ( $gif ) { | 
                                                        |
| 143 | 143 | return true;  | 
                                                        
| 144 | 144 | }  | 
                                                        
| 145 | 145 | }  | 
                                                        
| 146 | - $image = wp_get_image_editor( $load_filename );  | 
                                                        |
| 147 | -		if ( !is_wp_error( $image ) ) { | 
                                                        |
| 148 | - $crop = self::get_target_sizes( $load_filename );  | 
                                                        |
| 149 | - $image->crop( $crop['x'],  | 
                                                        |
| 146 | + $image = wp_get_image_editor($load_filename);  | 
                                                        |
| 147 | +		if ( !is_wp_error($image) ) { | 
                                                        |
| 148 | + $crop = self::get_target_sizes($load_filename);  | 
                                                        |
| 149 | + $image->crop($crop['x'],  | 
                                                        |
| 150 | 150 | $crop['y'],  | 
                                                        
| 151 | 151 | $crop['src_w'],  | 
                                                        
| 152 | 152 | $crop['src_h'],  | 
                                                        
| 153 | 153 | $crop['target_w'],  | 
                                                        
| 154 | 154 | $crop['target_h']  | 
                                                        
| 155 | 155 | );  | 
                                                        
| 156 | - $result = $image->save( $save_filename );  | 
                                                        |
| 157 | -			if ( is_wp_error( $result ) ) { | 
                                                        |
| 158 | - error_log( 'Error resizing image' );  | 
                                                        |
| 159 | - error_log( print_r( $result, true ) );  | 
                                                        |
| 156 | + $result = $image->save($save_filename);  | 
                                                        |
| 157 | +			if ( is_wp_error($result) ) { | 
                                                        |
| 158 | +				error_log('Error resizing image'); | 
                                                        |
| 159 | + error_log(print_r($result, true));  | 
                                                        |
| 160 | 160 | return false;  | 
                                                        
| 161 | 161 |  			} else { | 
                                                        
| 162 | 162 | return true;  | 
                                                        
| 163 | 163 | }  | 
                                                        
| 164 | -		} else if ( isset( $image->error_data['error_loading_image'] ) ) { | 
                                                        |
| 165 | - TimberHelper::error_log( 'Error loading ' . $image->error_data['error_loading_image'] );  | 
                                                        |
| 164 | +		} else if ( isset($image->error_data['error_loading_image']) ) { | 
                                                        |
| 165 | +			TimberHelper::error_log('Error loading ' . $image->error_data['error_loading_image']); | 
                                                        |
| 166 | 166 |  		} else { | 
                                                        
| 167 | - TimberHelper::error_log( $image );  | 
                                                        |
| 167 | + TimberHelper::error_log($image);  | 
                                                        |
| 168 | 168 | }  | 
                                                        
| 169 | 169 | }  | 
                                                        
| 170 | 170 | }  | 
                                                        
@@ -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 | */  | 
                                                        
@@ -35,15 +35,15 @@ discard block  | 
                                                    ||
| 35 | 35 | * (ex: /src/var/www/wp-content/uploads/my-pic.png)  | 
                                                        
| 36 | 36 | * @return bool true if everything went fine, false otherwise  | 
                                                        
| 37 | 37 | */  | 
                                                        
| 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 );  | 
                                                        |
| 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);  | 
                                                        |
| 47 | 47 | return true;  | 
                                                        
| 48 | 48 | }  | 
                                                        
| 49 | 49 | |
@@ -51,10 +51,10 @@ discard block  | 
                                                    ||
| 51 | 51 | * @return resource an image identifier representing the image obtained from the given filename  | 
                                                        
| 52 | 52 | * will return the same data type regardless of whether the source is gif or png  | 
                                                        
| 53 | 53 | */  | 
                                                        
| 54 | -	function image_create( $filename, $ext = 'auto' ) { | 
                                                        |
| 54 | +	function image_create($filename, $ext = 'auto') { | 
                                                        |
| 55 | 55 |  		if ( $ext == 'auto' ) { | 
                                                        
| 56 | 56 | $ext = wp_check_filetype($filename);  | 
                                                        
| 57 | -			if (isset($ext['ext'])) { | 
                                                        |
| 57 | +			if ( isset($ext['ext']) ) { | 
                                                        |
| 58 | 58 | $ext = $ext['ext'];  | 
                                                        
| 59 | 59 | }  | 
                                                        
| 60 | 60 | }  | 
                                                        
@@ -65,7 +65,7 @@ discard block  | 
                                                    ||
| 65 | 65 |  		if ( $ext == 'png' ) { | 
                                                        
| 66 | 66 | return imagecreatefrompng($filename);  | 
                                                        
| 67 | 67 | }  | 
                                                        
| 68 | -		if ( $ext == 'jpg' || $ext == 'jpeg') { | 
                                                        |
| 68 | +		if ( $ext == 'jpg' || $ext == 'jpeg' ) { | 
                                                        |
| 69 | 69 | return imagecreatefromjpeg($filename);  | 
                                                        
| 70 | 70 | }  | 
                                                        
| 71 | 71 | }  | 
                                                        
@@ -35,7 +35,7 @@  | 
                                                    ||
| 35 | 35 | * (ex: /src/var/www/wp-content/uploads/my-pic.png)  | 
                                                        
| 36 | 36 | * @return bool true if everything went fine, false otherwise  | 
                                                        
| 37 | 37 | */  | 
                                                        
| 38 | -	function run($load_filename, $save_filename){ | 
                                                        |
| 38 | +	function run($load_filename, $save_filename) { | 
                                                        |
| 39 | 39 | $input = self::image_create( $load_filename );  | 
                                                        
| 40 | 40 | list( $width, $height ) = getimagesize( $load_filename );  | 
                                                        
| 41 | 41 | $output = imagecreatetruecolor( $width, $height );  | 
                                                        
@@ -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' ) { | 
                                                        
@@ -44,7 +44,7 @@  | 
                                                    ||
| 44 | 44 | $this->init($cid);  | 
                                                        
| 45 | 45 | }  | 
                                                        
| 46 | 46 | |
| 47 | -	function __toString(){ | 
                                                        |
| 47 | +	function __toString() { | 
                                                        |
| 48 | 48 | return $this->content();  | 
                                                        
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
@@ -44,7 +44,7 @@ discard block  | 
                                                    ||
| 44 | 44 | $this->init($cid);  | 
                                                        
| 45 | 45 | }  | 
                                                        
| 46 | 46 | |
| 47 | -	function __toString(){ | 
                                                        |
| 47 | +	function __toString() { | 
                                                        |
| 48 | 48 | return $this->content();  | 
                                                        
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
@@ -54,7 +54,7 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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); | 
                                                        
@@ -269,9 +269,9 @@ discard block  | 
                                                    ||
| 269 | 269 | * @param int $post_id  | 
                                                        
| 270 | 270 | * @return string  | 
                                                        
| 271 | 271 | */  | 
                                                        
| 272 | -	public function reply_link( $reply_text = 'Reply' ) { | 
                                                        |
| 272 | +	public function reply_link($reply_text = 'Reply') { | 
                                                        |
| 273 | 273 |  		if ( is_singular() && comments_open() && get_option('thread_comments') ) { | 
                                                        
| 274 | - wp_enqueue_script( 'comment-reply' );  | 
                                                        |
| 274 | +			wp_enqueue_script('comment-reply'); | 
                                                        |
| 275 | 275 | }  | 
                                                        
| 276 | 276 | |
| 277 | 277 | // Get the comments depth option from the admin panel  | 
                                                        
@@ -286,7 +286,7 @@ discard block  | 
                                                    ||
| 286 | 286 | 'max_depth' => $max_depth,  | 
                                                        
| 287 | 287 | );  | 
                                                        
| 288 | 288 | |
| 289 | - return get_comment_reply_link( $args, $this->ID, $this->post_id );  | 
                                                        |
| 289 | + return get_comment_reply_link($args, $this->ID, $this->post_id);  | 
                                                        |
| 290 | 290 | }  | 
                                                        
| 291 | 291 | |
| 292 | 292 | /* AVATAR Stuff  | 
                                                        
@@ -297,9 +297,9 @@ discard block  | 
                                                    ||
| 297 | 297 | * @return string  | 
                                                        
| 298 | 298 | */  | 
                                                        
| 299 | 299 |  	protected function avatar_email() { | 
                                                        
| 300 | - $id = (int)$this->user_id;  | 
                                                        |
| 300 | + $id = (int) $this->user_id;  | 
                                                        |
| 301 | 301 | $user = get_userdata($id);  | 
                                                        
| 302 | -		if ($user) { | 
                                                        |
| 302 | +		if ( $user ) { | 
                                                        |
| 303 | 303 | $email = $user->user_email;  | 
                                                        
| 304 | 304 |  		} else { | 
                                                        
| 305 | 305 | $email = $this->comment_author_email;  | 
                                                        
@@ -313,10 +313,10 @@ discard block  | 
                                                    ||
| 313 | 313 | * @return string  | 
                                                        
| 314 | 314 | */  | 
                                                        
| 315 | 315 |  	protected function avatar_host($email_hash) { | 
                                                        
| 316 | -		if (is_ssl()) { | 
                                                        |
| 316 | +		if ( is_ssl() ) { | 
                                                        |
| 317 | 317 | $host = 'https://secure.gravatar.com';  | 
                                                        
| 318 | 318 |  		} else { | 
                                                        
| 319 | -			if (!empty($email_hash)) { | 
                                                        |
| 319 | +			if ( !empty($email_hash) ) { | 
                                                        |
| 320 | 320 |  				$host = sprintf("http://%d.gravatar.com", (hexdec($email_hash[0]) % 2)); | 
                                                        
| 321 | 321 |  			} else { | 
                                                        
| 322 | 322 | $host = 'http://0.gravatar.com';  | 
                                                        
@@ -335,28 +335,28 @@ discard block  | 
                                                    ||
| 335 | 335 | * @return string  | 
                                                        
| 336 | 336 | */  | 
                                                        
| 337 | 337 |  	protected function avatar_default($default, $email, $size, $host) { | 
                                                        
| 338 | -		if (substr($default, 0, 1) == '/') { | 
                                                        |
| 338 | +		if ( substr($default, 0, 1) == '/' ) { | 
                                                        |
| 339 | 339 | $default = home_url() . $default;  | 
                                                        
| 340 | 340 | }  | 
                                                        
| 341 | 341 | |
| 342 | -		if (empty($default)) { | 
                                                        |
| 342 | +		if ( empty($default) ) { | 
                                                        |
| 343 | 343 |  			$avatar_default = get_option('avatar_default'); | 
                                                        
| 344 | -			if (empty($avatar_default)) { | 
                                                        |
| 344 | +			if ( empty($avatar_default) ) { | 
                                                        |
| 345 | 345 | $default = 'mystery';  | 
                                                        
| 346 | 346 |  			} else { | 
                                                        
| 347 | 347 | $default = $avatar_default;  | 
                                                        
| 348 | 348 | }  | 
                                                        
| 349 | 349 | }  | 
                                                        
| 350 | -		if ('mystery' == $default) { | 
                                                        |
| 350 | +		if ( 'mystery' == $default ) { | 
                                                        |
| 351 | 351 | $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;  | 
                                                        
| 352 | 352 |  			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') | 
                                                        
| 353 | -		} else if ('blank' == $default) { | 
                                                        |
| 353 | +		} else if ( 'blank' == $default ) { | 
                                                        |
| 354 | 354 |  			$default = $email ? 'blank' : includes_url('images/blank.gif'); | 
                                                        
| 355 | -		} else if (!empty($email) && 'gravatar_default' == $default) { | 
                                                        |
| 355 | +		} else if ( !empty($email) && 'gravatar_default' == $default ) { | 
                                                        |
| 356 | 356 | $default = '';  | 
                                                        
| 357 | -		} else if ('gravatar_default' == $default) { | 
                                                        |
| 357 | +		} else if ( 'gravatar_default' == $default ) { | 
                                                        |
| 358 | 358 | $default = $host . '/avatar/?s=' . $size;  | 
                                                        
| 359 | -		} else if (empty($email) && !strstr($default, 'http://')) { | 
                                                        |
| 359 | +		} else if ( empty($email) && !strstr($default, 'http://') ) { | 
                                                        |
| 360 | 360 | $default = $host . '/avatar/?d=' . $default . '&s=' . $size;  | 
                                                        
| 361 | 361 | }  | 
                                                        
| 362 | 362 | return $default;  | 
                                                        
@@ -373,7 +373,7 @@ discard block  | 
                                                    ||
| 373 | 373 |  	protected function avatar_out($default, $host, $email_hash, $size) { | 
                                                        
| 374 | 374 | $out = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode($default);  | 
                                                        
| 375 | 375 |  		$rating = get_option('avatar_rating'); | 
                                                        
| 376 | -		if (!empty($rating)) { | 
                                                        |
| 376 | +		if ( !empty($rating) ) { | 
                                                        |
| 377 | 377 | $out .= '&r=' . $rating;  | 
                                                        
| 378 | 378 | }  | 
                                                        
| 379 | 379 |  		return str_replace('&', '&', esc_url($out)); | 
                                                        
@@ -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 | */  | 
                                                        
@@ -25,17 +25,17 @@ discard block  | 
                                                    ||
| 25 | 25 | * @param bool $force (optional) Force callback to be executed when transient is locked  | 
                                                        
| 26 | 26 | * @return mixed  | 
                                                        
| 27 | 27 | */  | 
                                                        
| 28 | -	public static function transient( $slug, $callback, $transient_time = 0, $lock_timeout = 5, $force = false ) { | 
                                                        |
| 28 | +	public static function transient($slug, $callback, $transient_time = 0, $lock_timeout = 5, $force = false) { | 
                                                        |
| 29 | 29 | |
| 30 | - $enable_transients = ( $transient_time === false || ( defined( 'WP_DISABLE_TRANSIENTS' ) && WP_DISABLE_TRANSIENTS ) ) ? false : true;  | 
                                                        |
| 31 | - $data = $enable_transients ? get_transient( $slug ) : false;  | 
                                                        |
| 30 | +		$enable_transients = ($transient_time === false || (defined('WP_DISABLE_TRANSIENTS') && WP_DISABLE_TRANSIENTS)) ? false : true; | 
                                                        |
| 31 | + $data = $enable_transients ? get_transient($slug) : false;  | 
                                                        |
| 32 | 32 | |
| 33 | 33 |  		if ( false === $data ) { | 
                                                        
| 34 | 34 | |
| 35 | -			if ( $enable_transients && self::_is_transient_locked( $slug ) ) { | 
                                                        |
| 35 | +			if ( $enable_transients && self::_is_transient_locked($slug) ) { | 
                                                        |
| 36 | 36 | |
| 37 | - $force = apply_filters( 'timber_force_transients', $force );  | 
                                                        |
| 38 | - $force = apply_filters( 'timber_force_transient_' . $slug, $force );  | 
                                                        |
| 37 | +				$force = apply_filters('timber_force_transients', $force); | 
                                                        |
| 38 | +				$force = apply_filters('timber_force_transient_' . $slug, $force); | 
                                                        |
| 39 | 39 | |
| 40 | 40 |  				if ( !$force ) { | 
                                                        
| 41 | 41 | //the server is currently executing the process.  | 
                                                        
@@ -49,13 +49,13 @@ discard block  | 
                                                    ||
| 49 | 49 | // lock timeout shouldn't be higher than 5 seconds, unless  | 
                                                        
| 50 | 50 | // remote calls with high timeouts are made here  | 
                                                        
| 51 | 51 | if ( $enable_transients )  | 
                                                        
| 52 | - self::_lock_transient( $slug, $lock_timeout );  | 
                                                        |
| 52 | + self::_lock_transient($slug, $lock_timeout);  | 
                                                        |
| 53 | 53 | |
| 54 | 54 | $data = $callback();  | 
                                                        
| 55 | 55 | |
| 56 | 56 |  			if ( $enable_transients ) { | 
                                                        
| 57 | - set_transient( $slug, $data, $transient_time );  | 
                                                        |
| 58 | - self::_unlock_transient( $slug );  | 
                                                        |
| 57 | + set_transient($slug, $data, $transient_time);  | 
                                                        |
| 58 | + self::_unlock_transient($slug);  | 
                                                        |
| 59 | 59 | }  | 
                                                        
| 60 | 60 | |
| 61 | 61 | }  | 
                                                        
@@ -69,24 +69,24 @@ discard block  | 
                                                    ||
| 69 | 69 | * @param string $slug  | 
                                                        
| 70 | 70 | * @param integer $lock_timeout  | 
                                                        
| 71 | 71 | */  | 
                                                        
| 72 | -	static function _lock_transient( $slug, $lock_timeout ) { | 
                                                        |
| 73 | - set_transient( $slug . '_lock', true, $lock_timeout );  | 
                                                        |
| 72 | +	static function _lock_transient($slug, $lock_timeout) { | 
                                                        |
| 73 | + set_transient($slug . '_lock', true, $lock_timeout);  | 
                                                        |
| 74 | 74 | }  | 
                                                        
| 75 | 75 | |
| 76 | 76 | /**  | 
                                                        
| 77 | 77 | * @internal  | 
                                                        
| 78 | 78 | * @param string $slug  | 
                                                        
| 79 | 79 | */  | 
                                                        
| 80 | -	static function _unlock_transient( $slug ) { | 
                                                        |
| 81 | - delete_transient( $slug . '_lock', true );  | 
                                                        |
| 80 | +	static function _unlock_transient($slug) { | 
                                                        |
| 81 | + delete_transient($slug . '_lock', true);  | 
                                                        |
| 82 | 82 | }  | 
                                                        
| 83 | 83 | |
| 84 | 84 | /**  | 
                                                        
| 85 | 85 | * @internal  | 
                                                        
| 86 | 86 | * @param string $slug  | 
                                                        
| 87 | 87 | */  | 
                                                        
| 88 | -	static function _is_transient_locked( $slug ) { | 
                                                        |
| 89 | - return (bool)get_transient( $slug . '_lock' );  | 
                                                        |
| 88 | +	static function _is_transient_locked($slug) { | 
                                                        |
| 89 | + return (bool) get_transient($slug . '_lock');  | 
                                                        |
| 90 | 90 | }  | 
                                                        
| 91 | 91 | |
| 92 | 92 | /* These are for measuring page render time */  | 
                                                        
@@ -98,7 +98,7 @@ discard block  | 
                                                    ||
| 98 | 98 | */  | 
                                                        
| 99 | 99 |  	public static function start_timer() { | 
                                                        
| 100 | 100 | $time = microtime();  | 
                                                        
| 101 | - $time = explode( ' ', $time );  | 
                                                        |
| 101 | +		$time = explode(' ', $time); | 
                                                        |
| 102 | 102 | $time = $time[1] + $time[0];  | 
                                                        
| 103 | 103 | return $time;  | 
                                                        
| 104 | 104 | }  | 
                                                        
@@ -114,12 +114,12 @@ discard block  | 
                                                    ||
| 114 | 114 | * @param int $start  | 
                                                        
| 115 | 115 | * @return string  | 
                                                        
| 116 | 116 | */  | 
                                                        
| 117 | -	public static function stop_timer( $start ) { | 
                                                        |
| 117 | +	public static function stop_timer($start) { | 
                                                        |
| 118 | 118 | $time = microtime();  | 
                                                        
| 119 | - $time = explode( ' ', $time );  | 
                                                        |
| 119 | +		$time = explode(' ', $time); | 
                                                        |
| 120 | 120 | $time = $time[1] + $time[0];  | 
                                                        
| 121 | 121 | $finish = $time;  | 
                                                        
| 122 | - $total_time = round( ( $finish - $start ), 4 );  | 
                                                        |
| 122 | + $total_time = round(($finish - $start), 4);  | 
                                                        |
| 123 | 123 | return $total_time . ' seconds.';  | 
                                                        
| 124 | 124 | }  | 
                                                        
| 125 | 125 | |
@@ -152,9 +152,9 @@ discard block  | 
                                                    ||
| 152 | 152 | * @param array $args  | 
                                                        
| 153 | 153 | * @return string  | 
                                                        
| 154 | 154 | */  | 
                                                        
| 155 | -	public static function ob_function( $function, $args = array( null ) ) { | 
                                                        |
| 155 | +	public static function ob_function($function, $args = array(null)) { | 
                                                        |
| 156 | 156 | ob_start();  | 
                                                        
| 157 | - call_user_func_array( $function, $args );  | 
                                                        |
| 157 | + call_user_func_array($function, $args);  | 
                                                        |
| 158 | 158 | $data = ob_get_contents();  | 
                                                        
| 159 | 159 | ob_end_clean();  | 
                                                        
| 160 | 160 | return $data;  | 
                                                        
@@ -168,8 +168,8 @@ discard block  | 
                                                    ||
| 168 | 168 | * @param bool $return_output_buffer  | 
                                                        
| 169 | 169 | * @return TimberFunctionWrapper  | 
                                                        
| 170 | 170 | */  | 
                                                        
| 171 | -	public static function function_wrapper( $function_name, $defaults = array(), $return_output_buffer = false ) { | 
                                                        |
| 172 | - return new TimberFunctionWrapper( $function_name, $defaults, $return_output_buffer );  | 
                                                        |
| 171 | +	public static function function_wrapper($function_name, $defaults = array(), $return_output_buffer = false) { | 
                                                        |
| 172 | + return new TimberFunctionWrapper($function_name, $defaults, $return_output_buffer);  | 
                                                        |
| 173 | 173 | }  | 
                                                        
| 174 | 174 | |
| 175 | 175 | /**  | 
                                                        
@@ -178,14 +178,14 @@ discard block  | 
                                                    ||
| 178 | 178 | * @param mixed $arg that you want to error_log  | 
                                                        
| 179 | 179 | * @return void  | 
                                                        
| 180 | 180 | */  | 
                                                        
| 181 | -	public static function error_log( $arg ) { | 
                                                        |
| 181 | +	public static function error_log($arg) { | 
                                                        |
| 182 | 182 |  		if ( !WP_DEBUG ) { | 
                                                        
| 183 | 183 | return;  | 
                                                        
| 184 | 184 | }  | 
                                                        
| 185 | -		if ( is_object( $arg ) || is_array( $arg ) ) { | 
                                                        |
| 186 | - $arg = print_r( $arg, true );  | 
                                                        |
| 185 | +		if ( is_object($arg) || is_array($arg) ) { | 
                                                        |
| 186 | + $arg = print_r($arg, true);  | 
                                                        |
| 187 | 187 | }  | 
                                                        
| 188 | - return error_log( $arg );  | 
                                                        |
| 188 | + return error_log($arg);  | 
                                                        |
| 189 | 189 | }  | 
                                                        
| 190 | 190 | |
| 191 | 191 | /**  | 
                                                        
@@ -195,9 +195,9 @@ discard block  | 
                                                    ||
| 195 | 195 | * @param string $seplocation  | 
                                                        
| 196 | 196 | * @return string  | 
                                                        
| 197 | 197 | */  | 
                                                        
| 198 | -	public static function get_wp_title( $separator = ' ', $seplocation = 'left' ) { | 
                                                        |
| 199 | - $separator = apply_filters( 'timber_wp_title_seperator', $separator );  | 
                                                        |
| 200 | - return trim( wp_title( $separator, false, $seplocation ) );  | 
                                                        |
| 198 | +	public static function get_wp_title($separator = ' ', $seplocation = 'left') { | 
                                                        |
| 199 | +		$separator = apply_filters('timber_wp_title_seperator', $separator); | 
                                                        |
| 200 | + return trim(wp_title($separator, false, $seplocation));  | 
                                                        |
| 201 | 201 | }  | 
                                                        
| 202 | 202 | |
| 203 | 203 | /* Text Utilities  | 
                                                        
@@ -212,36 +212,36 @@ discard block  | 
                                                    ||
| 212 | 212 | * @param string $allowed_tags  | 
                                                        
| 213 | 213 | * @return string  | 
                                                        
| 214 | 214 | */  | 
                                                        
| 215 | -	public static function trim_words( $text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote' ) { | 
                                                        |
| 215 | +	public static function trim_words($text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote') { | 
                                                        |
| 216 | 216 |  		if ( null === $more ) { | 
                                                        
| 217 | - $more = __( '…' );  | 
                                                        |
| 217 | +			$more = __('…'); | 
                                                        |
| 218 | 218 | }  | 
                                                        
| 219 | 219 | $original_text = $text;  | 
                                                        
| 220 | 220 | $allowed_tag_string = '';  | 
                                                        
| 221 | -		foreach ( explode( ' ', apply_filters( 'timber/trim_words/allowed_tags', $allowed_tags ) ) as $tag ) { | 
                                                        |
| 221 | +		foreach (explode(' ', apply_filters('timber/trim_words/allowed_tags', $allowed_tags)) as $tag) { | 
                                                        |
| 222 | 222 | $allowed_tag_string .= '<' . $tag . '>';  | 
                                                        
| 223 | 223 | }  | 
                                                        
| 224 | - $text = strip_tags( $text, $allowed_tag_string );  | 
                                                        |
| 224 | + $text = strip_tags($text, $allowed_tag_string);  | 
                                                        |
| 225 | 225 | /* translators: If your word count is based on single characters (East Asian characters),  | 
                                                        
| 226 | 226 | enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */  | 
                                                        
| 227 | -		if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { | 
                                                        |
| 228 | - $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );  | 
                                                        |
| 229 | - preg_match_all( '/./u', $text, $words_array );  | 
                                                        |
| 230 | - $words_array = array_slice( $words_array[0], 0, $num_words + 1 );  | 
                                                        |
| 227 | +		if ( 'characters' == _x('words', 'word count: words or characters?') && preg_match('/^utf\-?8$/i', get_option('blog_charset')) ) { | 
                                                        |
| 228 | +			$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' '); | 
                                                        |
| 229 | +			preg_match_all('/./u', $text, $words_array); | 
                                                        |
| 230 | + $words_array = array_slice($words_array[0], 0, $num_words + 1);  | 
                                                        |
| 231 | 231 | $sep = '';  | 
                                                        
| 232 | 232 |  		} else { | 
                                                        
| 233 | - $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );  | 
                                                        |
| 233 | +			$words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY); | 
                                                        |
| 234 | 234 | $sep = ' ';  | 
                                                        
| 235 | 235 | }  | 
                                                        
| 236 | -		if ( count( $words_array ) > $num_words ) { | 
                                                        |
| 237 | - array_pop( $words_array );  | 
                                                        |
| 238 | - $text = implode( $sep, $words_array );  | 
                                                        |
| 236 | +		if ( count($words_array) > $num_words ) { | 
                                                        |
| 237 | + array_pop($words_array);  | 
                                                        |
| 238 | + $text = implode($sep, $words_array);  | 
                                                        |
| 239 | 239 | $text = $text . $more;  | 
                                                        
| 240 | 240 |  		} else { | 
                                                        
| 241 | - $text = implode( $sep, $words_array );  | 
                                                        |
| 241 | + $text = implode($sep, $words_array);  | 
                                                        |
| 242 | 242 | }  | 
                                                        
| 243 | - $text = self::close_tags( $text );  | 
                                                        |
| 244 | - return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );  | 
                                                        |
| 243 | + $text = self::close_tags($text);  | 
                                                        |
| 244 | +		return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text); | 
                                                        |
| 245 | 245 | }  | 
                                                        
| 246 | 246 | |
| 247 | 247 | /**  | 
                                                        
@@ -250,29 +250,29 @@ discard block  | 
                                                    ||
| 250 | 250 | * @param string $html  | 
                                                        
| 251 | 251 | * @return string  | 
                                                        
| 252 | 252 | */  | 
                                                        
| 253 | -	public static function close_tags( $html ) { | 
                                                        |
| 253 | +	public static function close_tags($html) { | 
                                                        |
| 254 | 254 | //put all opened tags into an array  | 
                                                        
| 255 | - preg_match_all( '#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result );  | 
                                                        |
| 255 | +		preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result); | 
                                                        |
| 256 | 256 | $openedtags = $result[1];  | 
                                                        
| 257 | 257 | //put all closed tags into an array  | 
                                                        
| 258 | - preg_match_all( '#</([a-z]+)>#iU', $html, $result );  | 
                                                        |
| 258 | +		preg_match_all('#</([a-z]+)>#iU', $html, $result); | 
                                                        |
| 259 | 259 | $closedtags = $result[1];  | 
                                                        
| 260 | - $len_opened = count( $openedtags );  | 
                                                        |
| 260 | + $len_opened = count($openedtags);  | 
                                                        |
| 261 | 261 | // all tags are closed  | 
                                                        
| 262 | -		if ( count( $closedtags ) == $len_opened ) { | 
                                                        |
| 262 | +		if ( count($closedtags) == $len_opened ) { | 
                                                        |
| 263 | 263 | return $html;  | 
                                                        
| 264 | 264 | }  | 
                                                        
| 265 | - $openedtags = array_reverse( $openedtags );  | 
                                                        |
| 265 | + $openedtags = array_reverse($openedtags);  | 
                                                        |
| 266 | 266 | // close tags  | 
                                                        
| 267 | -		for ( $i = 0; $i < $len_opened; $i++ ) { | 
                                                        |
| 268 | -			if ( !in_array( $openedtags[$i], $closedtags ) ) { | 
                                                        |
| 267 | +		for ($i = 0; $i < $len_opened; $i++) { | 
                                                        |
| 268 | +			if ( !in_array($openedtags[$i], $closedtags) ) { | 
                                                        |
| 269 | 269 | $html .= '</' . $openedtags[$i] . '>';  | 
                                                        
| 270 | 270 |  			} else { | 
                                                        
| 271 | - unset( $closedtags[array_search( $openedtags[$i], $closedtags )] );  | 
                                                        |
| 271 | + unset($closedtags[array_search($openedtags[$i], $closedtags)]);  | 
                                                        |
| 272 | 272 | }  | 
                                                        
| 273 | 273 | }  | 
                                                        
| 274 | -		$html = str_replace(array('</br>','</hr>','</wbr>'), '', $html); | 
                                                        |
| 275 | -		$html = str_replace(array('<br>','<hr>','<wbr>'), array('<br />','<hr />','<wbr />'), $html); | 
                                                        |
| 274 | +		$html = str_replace(array('</br>', '</hr>', '</wbr>'), '', $html); | 
                                                        |
| 275 | +		$html = str_replace(array('<br>', '<hr>', '<wbr>'), array('<br />', '<hr />', '<wbr />'), $html); | 
                                                        |
| 276 | 276 | return $html;  | 
                                                        
| 277 | 277 | }  | 
                                                        
| 278 | 278 | |
@@ -285,17 +285,17 @@ discard block  | 
                                                    ||
| 285 | 285 | * @return array|int  | 
                                                        
| 286 | 286 | * @deprecated 0.20.0  | 
                                                        
| 287 | 287 | */  | 
                                                        
| 288 | -	public static function get_posts_by_meta( $key, $value ) { | 
                                                        |
| 288 | +	public static function get_posts_by_meta($key, $value) { | 
                                                        |
| 289 | 289 | global $wpdb;  | 
                                                        
| 290 | - $query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %s", $key, $value );  | 
                                                        |
| 291 | - $results = $wpdb->get_col( $query );  | 
                                                        |
| 290 | +		$query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %s", $key, $value); | 
                                                        |
| 291 | + $results = $wpdb->get_col($query);  | 
                                                        |
| 292 | 292 | $pids = array();  | 
                                                        
| 293 | -		foreach ( $results as $result ) { | 
                                                        |
| 294 | -			if ( get_post( $result ) ) { | 
                                                        |
| 293 | +		foreach ($results as $result) { | 
                                                        |
| 294 | +			if ( get_post($result) ) { | 
                                                        |
| 295 | 295 | $pids[] = $result;  | 
                                                        
| 296 | 296 | }  | 
                                                        
| 297 | 297 | }  | 
                                                        
| 298 | -		if ( count( $pids ) ) { | 
                                                        |
| 298 | +		if ( count($pids) ) { | 
                                                        |
| 299 | 299 | return $pids;  | 
                                                        
| 300 | 300 | }  | 
                                                        
| 301 | 301 | return 0;  | 
                                                        
@@ -309,12 +309,12 @@ discard block  | 
                                                    ||
| 309 | 309 | * @return int  | 
                                                        
| 310 | 310 | * @deprecated 0.20.0  | 
                                                        
| 311 | 311 | */  | 
                                                        
| 312 | -	public static function get_post_by_meta( $key, $value ) { | 
                                                        |
| 312 | +	public static function get_post_by_meta($key, $value) { | 
                                                        |
| 313 | 313 | global $wpdb;  | 
                                                        
| 314 | - $query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %s ORDER BY post_id", $key, $value );  | 
                                                        |
| 315 | - $results = $wpdb->get_col( $query );  | 
                                                        |
| 316 | -		foreach ( $results as $result ) { | 
                                                        |
| 317 | -			if ( $result && get_post( $result ) ) { | 
                                                        |
| 314 | +		$query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %s ORDER BY post_id", $key, $value); | 
                                                        |
| 315 | + $results = $wpdb->get_col($query);  | 
                                                        |
| 316 | +		foreach ($results as $result) { | 
                                                        |
| 317 | +			if ( $result && get_post($result) ) { | 
                                                        |
| 318 | 318 | return $result;  | 
                                                        
| 319 | 319 | }  | 
                                                        
| 320 | 320 | }  | 
                                                        
@@ -327,10 +327,10 @@ discard block  | 
                                                    ||
| 327 | 327 | * @param int $ttid  | 
                                                        
| 328 | 328 | * @return mixed  | 
                                                        
| 329 | 329 | */  | 
                                                        
| 330 | -	public static function get_term_id_by_term_taxonomy_id( $ttid ) { | 
                                                        |
| 330 | +	public static function get_term_id_by_term_taxonomy_id($ttid) { | 
                                                        |
| 331 | 331 | global $wpdb;  | 
                                                        
| 332 | - $query = $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %s", $ttid );  | 
                                                        |
| 333 | - return $wpdb->get_var( $query );  | 
                                                        |
| 332 | +		$query = $wpdb->prepare("SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %s", $ttid); | 
                                                        |
| 333 | + return $wpdb->get_var($query);  | 
                                                        |
| 334 | 334 | }  | 
                                                        
| 335 | 335 | |
| 336 | 336 | /* Object Utilities  | 
                                                        
@@ -343,8 +343,8 @@ discard block  | 
                                                    ||
| 343 | 343 | * @param string $prop  | 
                                                        
| 344 | 344 | * @return void  | 
                                                        
| 345 | 345 | */  | 
                                                        
| 346 | -	public static function osort( &$array, $prop ) { | 
                                                        |
| 347 | -		usort( $array, function ( $a, $b ) use ( $prop ) { | 
                                                        |
| 346 | +	public static function osort(&$array, $prop) { | 
                                                        |
| 347 | +		usort($array, function($a, $b) use ($prop) { | 
                                                        |
| 348 | 348 | return $a->$prop > $b->$prop ? 1 : -1;  | 
                                                        
| 349 | 349 | } );  | 
                                                        
| 350 | 350 | }  | 
                                                        
@@ -355,11 +355,11 @@ discard block  | 
                                                    ||
| 355 | 355 | * @param array $arr  | 
                                                        
| 356 | 356 | * @return bool  | 
                                                        
| 357 | 357 | */  | 
                                                        
| 358 | -	public static function is_array_assoc( $arr ) { | 
                                                        |
| 359 | -		if ( !is_array( $arr ) ) { | 
                                                        |
| 358 | +	public static function is_array_assoc($arr) { | 
                                                        |
| 359 | +		if ( !is_array($arr) ) { | 
                                                        |
| 360 | 360 | return false;  | 
                                                        
| 361 | 361 | }  | 
                                                        
| 362 | - return (bool)count( array_filter( array_keys( $arr ), 'is_string' ) );  | 
                                                        |
| 362 | + return (bool) count(array_filter(array_keys($arr), 'is_string'));  | 
                                                        |
| 363 | 363 | }  | 
                                                        
| 364 | 364 | |
| 365 | 365 | /**  | 
                                                        
@@ -368,11 +368,11 @@ discard block  | 
                                                    ||
| 368 | 368 | * @param array $array  | 
                                                        
| 369 | 369 | * @return stdClass  | 
                                                        
| 370 | 370 | */  | 
                                                        
| 371 | -	public static function array_to_object( $array ) { | 
                                                        |
| 371 | +	public static function array_to_object($array) { | 
                                                        |
| 372 | 372 | $obj = new stdClass;  | 
                                                        
| 373 | -		foreach ( $array as $k => $v ) { | 
                                                        |
| 374 | -			if ( is_array( $v ) ) { | 
                                                        |
| 375 | -				$obj->{$k} = self::array_to_object( $v ); //RECURSION | 
                                                        |
| 373 | +		foreach ($array as $k => $v) { | 
                                                        |
| 374 | +			if ( is_array($v) ) { | 
                                                        |
| 375 | +				$obj->{$k} = self::array_to_object($v); //RECURSION | 
                                                        |
| 376 | 376 |  			} else { | 
                                                        
| 377 | 377 |  				$obj->{$k} = $v; | 
                                                        
| 378 | 378 | }  | 
                                                        
@@ -388,11 +388,11 @@ discard block  | 
                                                    ||
| 388 | 388 | * @param mixed $value  | 
                                                        
| 389 | 389 | * @return bool|int  | 
                                                        
| 390 | 390 | */  | 
                                                        
| 391 | -	public static function get_object_index_by_property( $array, $key, $value ) { | 
                                                        |
| 392 | -		if ( is_array( $array ) ) { | 
                                                        |
| 391 | +	public static function get_object_index_by_property($array, $key, $value) { | 
                                                        |
| 392 | +		if ( is_array($array) ) { | 
                                                        |
| 393 | 393 | $i = 0;  | 
                                                        
| 394 | -			foreach ( $array as $arr ) { | 
                                                        |
| 395 | -				if ( is_array( $arr ) ) { | 
                                                        |
| 394 | +			foreach ($array as $arr) { | 
                                                        |
| 395 | +				if ( is_array($arr) ) { | 
                                                        |
| 396 | 396 |  					if ( $arr[$key] == $value ) { | 
                                                        
| 397 | 397 | return $i;  | 
                                                        
| 398 | 398 | }  | 
                                                        
@@ -416,15 +416,15 @@ discard block  | 
                                                    ||
| 416 | 416 | * @return array|null  | 
                                                        
| 417 | 417 | * @throws Exception  | 
                                                        
| 418 | 418 | */  | 
                                                        
| 419 | -	public static function get_object_by_property( $array, $key, $value ) { | 
                                                        |
| 420 | -		if ( is_array( $array ) ) { | 
                                                        |
| 421 | -			foreach ( $array as $arr ) { | 
                                                        |
| 419 | +	public static function get_object_by_property($array, $key, $value) { | 
                                                        |
| 420 | +		if ( is_array($array) ) { | 
                                                        |
| 421 | +			foreach ($array as $arr) { | 
                                                        |
| 422 | 422 |  				if ( $arr->$key == $value ) { | 
                                                        
| 423 | 423 | return $arr;  | 
                                                        
| 424 | 424 | }  | 
                                                        
| 425 | 425 | }  | 
                                                        
| 426 | 426 |  		} else { | 
                                                        
| 427 | - throw new Exception( '$array is not an array, given value: ' . $array );  | 
                                                        |
| 427 | +			throw new Exception('$array is not an array, given value: ' . $array); | 
                                                        |
| 428 | 428 | }  | 
                                                        
| 429 | 429 | }  | 
                                                        
| 430 | 430 | |
@@ -435,9 +435,9 @@ discard block  | 
                                                    ||
| 435 | 435 | * @param int $len  | 
                                                        
| 436 | 436 | * @return array  | 
                                                        
| 437 | 437 | */  | 
                                                        
| 438 | -	public static function array_truncate( $array, $len ) { | 
                                                        |
| 439 | -		if ( sizeof( $array ) > $len ) { | 
                                                        |
| 440 | - $array = array_splice( $array, 0, $len );  | 
                                                        |
| 438 | +	public static function array_truncate($array, $len) { | 
                                                        |
| 439 | +		if ( sizeof($array) > $len ) { | 
                                                        |
| 440 | + $array = array_splice($array, 0, $len);  | 
                                                        |
| 441 | 441 | }  | 
                                                        
| 442 | 442 | return $array;  | 
                                                        
| 443 | 443 | }  | 
                                                        
@@ -451,12 +451,12 @@ discard block  | 
                                                    ||
| 451 | 451 | * @param mixed $value  | 
                                                        
| 452 | 452 | * @return bool  | 
                                                        
| 453 | 453 | */  | 
                                                        
| 454 | -	public static function is_true( $value ) { | 
                                                        |
| 455 | -		if ( isset( $value ) ) { | 
                                                        |
| 456 | -			if (is_string($value)) { | 
                                                        |
| 454 | +	public static function is_true($value) { | 
                                                        |
| 455 | +		if ( isset($value) ) { | 
                                                        |
| 456 | +			if ( is_string($value) ) { | 
                                                        |
| 457 | 457 | $value = strtolower($value);  | 
                                                        
| 458 | 458 | }  | 
                                                        
| 459 | -			if ( ($value == 'true' || $value === 1 || $value === '1' || $value == true) && $value !== false && $value !== 'false') { | 
                                                        |
| 459 | +			if ( ($value == 'true' || $value === 1 || $value === '1' || $value == true) && $value !== false && $value !== 'false' ) { | 
                                                        |
| 460 | 460 | return true;  | 
                                                        
| 461 | 461 | }  | 
                                                        
| 462 | 462 | }  | 
                                                        
@@ -469,8 +469,8 @@ discard block  | 
                                                    ||
| 469 | 469 | * @param int $i  | 
                                                        
| 470 | 470 | * @return bool  | 
                                                        
| 471 | 471 | */  | 
                                                        
| 472 | -	public static function iseven( $i ) { | 
                                                        |
| 473 | - return ( $i % 2 ) == 0;  | 
                                                        |
| 472 | +	public static function iseven($i) { | 
                                                        |
| 473 | + return ($i % 2) == 0;  | 
                                                        |
| 474 | 474 | }  | 
                                                        
| 475 | 475 | |
| 476 | 476 | /**  | 
                                                        
@@ -479,8 +479,8 @@ discard block  | 
                                                    ||
| 479 | 479 | * @param int $i  | 
                                                        
| 480 | 480 | * @return bool  | 
                                                        
| 481 | 481 | */  | 
                                                        
| 482 | -	public static function isodd( $i ) { | 
                                                        |
| 483 | - return ( $i % 2 ) != 0;  | 
                                                        |
| 482 | +	public static function isodd($i) { | 
                                                        |
| 483 | + return ($i % 2) != 0;  | 
                                                        |
| 484 | 484 | }  | 
                                                        
| 485 | 485 | |
| 486 | 486 | /* Links, Forms, Etc. Utilities  | 
                                                        
@@ -494,8 +494,8 @@ discard block  | 
                                                    ||
| 494 | 494 | * @param array $args this $args thing is a fucking mess, [fix at some point](http://codex.wordpress.org/Function_Reference/comment_form)  | 
                                                        
| 495 | 495 | * @return string  | 
                                                        
| 496 | 496 | */  | 
                                                        
| 497 | -	public static function get_comment_form( $post_id = null, $args = array() ) { | 
                                                        |
| 498 | - return self::ob_function( 'comment_form', array( $args, $post_id ) );  | 
                                                        |
| 497 | +	public static function get_comment_form($post_id = null, $args = array()) { | 
                                                        |
| 498 | +		return self::ob_function('comment_form', array($args, $post_id)); | 
                                                        |
| 499 | 499 | }  | 
                                                        
| 500 | 500 | |
| 501 | 501 | /**  | 
                                                        
@@ -504,7 +504,7 @@ discard block  | 
                                                    ||
| 504 | 504 | * @param string $args  | 
                                                        
| 505 | 505 | * @return array  | 
                                                        
| 506 | 506 | */  | 
                                                        
| 507 | -	public static function paginate_links( $args = '' ) { | 
                                                        |
| 507 | +	public static function paginate_links($args = '') { | 
                                                        |
| 508 | 508 | $defaults = array(  | 
                                                        
| 509 | 509 | 'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)  | 
                                                        
| 510 | 510 | 'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number  | 
                                                        
@@ -512,42 +512,42 @@ discard block  | 
                                                    ||
| 512 | 512 | 'current' => 0,  | 
                                                        
| 513 | 513 | 'show_all' => false,  | 
                                                        
| 514 | 514 | 'prev_next' => true,  | 
                                                        
| 515 | - 'prev_text' => __( '« Previous' ),  | 
                                                        |
| 516 | - 'next_text' => __( 'Next »' ),  | 
                                                        |
| 515 | +			'prev_text' => __('« Previous'), | 
                                                        |
| 516 | +			'next_text' => __('Next »'), | 
                                                        |
| 517 | 517 | 'end_size' => 1,  | 
                                                        
| 518 | 518 | 'mid_size' => 2,  | 
                                                        
| 519 | 519 | 'type' => 'array',  | 
                                                        
| 520 | 520 | 'add_args' => false, // array of query args to add  | 
                                                        
| 521 | 521 | 'add_fragment' => ''  | 
                                                        
| 522 | 522 | );  | 
                                                        
| 523 | - $args = wp_parse_args( $args, $defaults );  | 
                                                        |
| 523 | + $args = wp_parse_args($args, $defaults);  | 
                                                        |
| 524 | 524 | // Who knows what else people pass in $args  | 
                                                        
| 525 | - $args['total'] = intval( (int)$args['total'] );  | 
                                                        |
| 525 | + $args['total'] = intval((int) $args['total']);  | 
                                                        |
| 526 | 526 |  		if ( $args['total'] < 2 ) { | 
                                                        
| 527 | 527 | return array();  | 
                                                        
| 528 | 528 | }  | 
                                                        
| 529 | - $args['current'] = (int)$args['current'];  | 
                                                        |
| 530 | - $args['end_size'] = 0 < (int)$args['end_size'] ? (int)$args['end_size'] : 1; // Out of bounds? Make it the default.  | 
                                                        |
| 531 | - $args['mid_size'] = 0 <= (int)$args['mid_size'] ? (int)$args['mid_size'] : 2;  | 
                                                        |
| 532 | - $args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false;  | 
                                                        |
| 529 | + $args['current'] = (int) $args['current'];  | 
                                                        |
| 530 | + $args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds? Make it the default.  | 
                                                        |
| 531 | + $args['mid_size'] = 0 <= (int) $args['mid_size'] ? (int) $args['mid_size'] : 2;  | 
                                                        |
| 532 | + $args['add_args'] = is_array($args['add_args']) ? $args['add_args'] : false;  | 
                                                        |
| 533 | 533 | $page_links = array();  | 
                                                        
| 534 | 534 | $dots = false;  | 
                                                        
| 535 | 535 |  		if ( $args['prev_next'] && $args['current'] && 1 < $args['current'] ) { | 
                                                        
| 536 | - $link = str_replace( '%_%', 2 == $args['current'] ? '' : $args['format'], $args['base'] );  | 
                                                        |
| 537 | - $link = str_replace( '%#%', $args['current'] - 1, $link );  | 
                                                        |
| 536 | +			$link = str_replace('%_%', 2 == $args['current'] ? '' : $args['format'], $args['base']); | 
                                                        |
| 537 | +			$link = str_replace('%#%', $args['current'] - 1, $link); | 
                                                        |
| 538 | 538 |  			if ( $args['add_args'] ) { | 
                                                        
| 539 | - $link = add_query_arg( $args['add_args'], $link );  | 
                                                        |
| 539 | + $link = add_query_arg($args['add_args'], $link);  | 
                                                        |
| 540 | 540 | }  | 
                                                        
| 541 | 541 | $link .= $args['add_fragment'];  | 
                                                        
| 542 | - $link = untrailingslashit( $link );  | 
                                                        |
| 542 | + $link = untrailingslashit($link);  | 
                                                        |
| 543 | 543 | $page_links[] = array(  | 
                                                        
| 544 | 544 | 'class' => 'prev page-numbers',  | 
                                                        
| 545 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ),  | 
                                                        |
| 545 | +				'link' => esc_url(apply_filters('paginate_links', $link)), | 
                                                        |
| 546 | 546 | 'title' => $args['prev_text']  | 
                                                        
| 547 | 547 | );  | 
                                                        
| 548 | 548 | }  | 
                                                        
| 549 | -		for ( $n = 1; $n <= $args['total']; $n++ ) { | 
                                                        |
| 550 | - $n_display = number_format_i18n( $n );  | 
                                                        |
| 549 | +		for ($n = 1; $n <= $args['total']; $n++) { | 
                                                        |
| 550 | + $n_display = number_format_i18n($n);  | 
                                                        |
| 551 | 551 |  			if ( $n == $args['current'] ) { | 
                                                        
| 552 | 552 | $page_links[] = array(  | 
                                                        
| 553 | 553 | 'class' => 'page-number page-numbers current',  | 
                                                        
@@ -558,18 +558,18 @@ discard block  | 
                                                    ||
| 558 | 558 | );  | 
                                                        
| 559 | 559 | $dots = true;  | 
                                                        
| 560 | 560 |  			} else { | 
                                                        
| 561 | -				if ( $args['show_all'] || ( $n <= $args['end_size'] || ( $args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size'] ) || $n > $args['total'] - $args['end_size'] ) ) { | 
                                                        |
| 562 | - $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );  | 
                                                        |
| 563 | - $link = str_replace( '%#%', $n, $link );  | 
                                                        |
| 564 | - $link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' );  | 
                                                        |
| 561 | +				if ( $args['show_all'] || ($n <= $args['end_size'] || ($args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size']) || $n > $args['total'] - $args['end_size']) ) { | 
                                                        |
| 562 | +					$link = str_replace('%_%', 1 == $n ? '' : $args['format'], $args['base']); | 
                                                        |
| 563 | +					$link = str_replace('%#%', $n, $link); | 
                                                        |
| 564 | + $link = trailingslashit($link) . ltrim($args['add_fragment'], '/');  | 
                                                        |
| 565 | 565 |  					if ( $args['add_args'] ) { | 
                                                        
| 566 | - $link = rtrim( add_query_arg( $args['add_args'], $link ), '/' );  | 
                                                        |
| 566 | + $link = rtrim(add_query_arg($args['add_args'], $link), '/');  | 
                                                        |
| 567 | 567 | }  | 
                                                        
| 568 | 568 |  					$link = str_replace(' ', '+', $link); | 
                                                        
| 569 | - $link = untrailingslashit( $link );  | 
                                                        |
| 569 | + $link = untrailingslashit($link);  | 
                                                        |
| 570 | 570 | $page_links[] = array(  | 
                                                        
| 571 | 571 | 'class' => 'page-number page-numbers',  | 
                                                        
| 572 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ),  | 
                                                        |
| 572 | +						'link' => esc_url(apply_filters('paginate_links', $link)), | 
                                                        |
| 573 | 573 | 'title' => $n_display,  | 
                                                        
| 574 | 574 | 'name' => $n_display,  | 
                                                        
| 575 | 575 | 'current' => $args['current'] == $n  | 
                                                        
@@ -578,22 +578,22 @@ discard block  | 
                                                    ||
| 578 | 578 |  				} elseif ( $dots && !$args['show_all'] ) { | 
                                                        
| 579 | 579 | $page_links[] = array(  | 
                                                        
| 580 | 580 | 'class' => 'dots',  | 
                                                        
| 581 | - 'title' => __( '…' )  | 
                                                        |
| 581 | +						'title' => __('…') | 
                                                        |
| 582 | 582 | );  | 
                                                        
| 583 | 583 | $dots = false;  | 
                                                        
| 584 | 584 | }  | 
                                                        
| 585 | 585 | }  | 
                                                        
| 586 | 586 | }  | 
                                                        
| 587 | -		if ( $args['prev_next'] && $args['current'] && ( $args['current'] < $args['total'] || -1 == $args['total'] ) ) { | 
                                                        |
| 588 | - $link = str_replace( '%_%', $args['format'], $args['base'] );  | 
                                                        |
| 589 | - $link = str_replace( '%#%', $args['current'] + 1, $link );  | 
                                                        |
| 587 | +		if ( $args['prev_next'] && $args['current'] && ($args['current'] < $args['total'] || -1 == $args['total']) ) { | 
                                                        |
| 588 | +			$link = str_replace('%_%', $args['format'], $args['base']); | 
                                                        |
| 589 | +			$link = str_replace('%#%', $args['current'] + 1, $link); | 
                                                        |
| 590 | 590 |  			if ( $args['add_args'] ) { | 
                                                        
| 591 | - $link = add_query_arg( $args['add_args'], $link );  | 
                                                        |
| 591 | + $link = add_query_arg($args['add_args'], $link);  | 
                                                        |
| 592 | 592 | }  | 
                                                        
| 593 | - $link = untrailingslashit( trailingslashit( $link ) . $args['add_fragment'] );  | 
                                                        |
| 593 | + $link = untrailingslashit(trailingslashit($link) . $args['add_fragment']);  | 
                                                        |
| 594 | 594 | $page_links[] = array(  | 
                                                        
| 595 | 595 | 'class' => 'next page-numbers',  | 
                                                        
| 596 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ),  | 
                                                        |
| 596 | +				'link' => esc_url(apply_filters('paginate_links', $link)), | 
                                                        |
| 597 | 597 | 'title' => $args['next_text']  | 
                                                        
| 598 | 598 | );  | 
                                                        
| 599 | 599 | }  | 
                                                        
@@ -610,8 +610,8 @@ discard block  | 
                                                    ||
| 610 | 610 | /**  | 
                                                        
| 611 | 611 | * @deprecated 0.18.0  | 
                                                        
| 612 | 612 | */  | 
                                                        
| 613 | -	static function is_url( $url ) { | 
                                                        |
| 614 | - return TimberURLHelper::is_url( $url );  | 
                                                        |
| 613 | +	static function is_url($url) { | 
                                                        |
| 614 | + return TimberURLHelper::is_url($url);  | 
                                                        |
| 615 | 615 | }  | 
                                                        
| 616 | 616 | |
| 617 | 617 | /**  | 
                                                        
@@ -624,71 +624,71 @@ discard block  | 
                                                    ||
| 624 | 624 | /**  | 
                                                        
| 625 | 625 | * @deprecated 0.18.0  | 
                                                        
| 626 | 626 | */  | 
                                                        
| 627 | -	static function get_rel_url( $url, $force = false ) { | 
                                                        |
| 628 | - return TimberURLHelper::get_rel_url( $url, $force );  | 
                                                        |
| 627 | +	static function get_rel_url($url, $force = false) { | 
                                                        |
| 628 | + return TimberURLHelper::get_rel_url($url, $force);  | 
                                                        |
| 629 | 629 | }  | 
                                                        
| 630 | 630 | |
| 631 | 631 | /**  | 
                                                        
| 632 | 632 | * @deprecated 0.18.0  | 
                                                        
| 633 | 633 | */  | 
                                                        
| 634 | -	static function is_local( $url ) { | 
                                                        |
| 635 | - return TimberURLHelper::is_local( $url );  | 
                                                        |
| 634 | +	static function is_local($url) { | 
                                                        |
| 635 | + return TimberURLHelper::is_local($url);  | 
                                                        |
| 636 | 636 | }  | 
                                                        
| 637 | 637 | |
| 638 | 638 | /**  | 
                                                        
| 639 | 639 | * @deprecated 0.18.0  | 
                                                        
| 640 | 640 | */  | 
                                                        
| 641 | -	static function get_full_path( $src ) { | 
                                                        |
| 642 | - return TimberURLHelper::get_full_path( $src );  | 
                                                        |
| 641 | +	static function get_full_path($src) { | 
                                                        |
| 642 | + return TimberURLHelper::get_full_path($src);  | 
                                                        |
| 643 | 643 | }  | 
                                                        
| 644 | 644 | |
| 645 | 645 | /**  | 
                                                        
| 646 | 646 | * @deprecated 0.18.0  | 
                                                        
| 647 | 647 | */  | 
                                                        
| 648 | -	static function get_rel_path( $src ) { | 
                                                        |
| 649 | - return TimberURLHelper::get_rel_path( $src );  | 
                                                        |
| 648 | +	static function get_rel_path($src) { | 
                                                        |
| 649 | + return TimberURLHelper::get_rel_path($src);  | 
                                                        |
| 650 | 650 | }  | 
                                                        
| 651 | 651 | |
| 652 | 652 | /**  | 
                                                        
| 653 | 653 | * @deprecated 0.18.0  | 
                                                        
| 654 | 654 | */  | 
                                                        
| 655 | -	static function remove_double_slashes( $url ) { | 
                                                        |
| 656 | - return TimberURLHelper::remove_double_slashes( $url );  | 
                                                        |
| 655 | +	static function remove_double_slashes($url) { | 
                                                        |
| 656 | + return TimberURLHelper::remove_double_slashes($url);  | 
                                                        |
| 657 | 657 | }  | 
                                                        
| 658 | 658 | |
| 659 | 659 | /**  | 
                                                        
| 660 | 660 | * @deprecated 0.18.0  | 
                                                        
| 661 | 661 | */  | 
                                                        
| 662 | -	static function prepend_to_url( $url, $path ) { | 
                                                        |
| 663 | - return TimberURLHelper::prepend_to_url( $url, $path );  | 
                                                        |
| 662 | +	static function prepend_to_url($url, $path) { | 
                                                        |
| 663 | + return TimberURLHelper::prepend_to_url($url, $path);  | 
                                                        |
| 664 | 664 | }  | 
                                                        
| 665 | 665 | |
| 666 | 666 | /**  | 
                                                        
| 667 | 667 | * @deprecated 0.18.0  | 
                                                        
| 668 | 668 | */  | 
                                                        
| 669 | -	static function preslashit( $path ) { | 
                                                        |
| 670 | - return TimberURLHelper::preslashit( $path );  | 
                                                        |
| 669 | +	static function preslashit($path) { | 
                                                        |
| 670 | + return TimberURLHelper::preslashit($path);  | 
                                                        |
| 671 | 671 | }  | 
                                                        
| 672 | 672 | |
| 673 | 673 | /**  | 
                                                        
| 674 | 674 | * @deprecated 0.18.0  | 
                                                        
| 675 | 675 | */  | 
                                                        
| 676 | -	static function is_external( $url ) { | 
                                                        |
| 677 | - return TimberURLHelper::is_external( $url );  | 
                                                        |
| 676 | +	static function is_external($url) { | 
                                                        |
| 677 | + return TimberURLHelper::is_external($url);  | 
                                                        |
| 678 | 678 | }  | 
                                                        
| 679 | 679 | |
| 680 | 680 | /**  | 
                                                        
| 681 | 681 | * @deprecated 0.18.0  | 
                                                        
| 682 | 682 | */  | 
                                                        
| 683 | -	static function download_url( $url, $timeout = 300 ) { | 
                                                        |
| 684 | - return TimberURLHelper::download_url( $url, $timeout );  | 
                                                        |
| 683 | +	static function download_url($url, $timeout = 300) { | 
                                                        |
| 684 | + return TimberURLHelper::download_url($url, $timeout);  | 
                                                        |
| 685 | 685 | }  | 
                                                        
| 686 | 686 | |
| 687 | 687 | /**  | 
                                                        
| 688 | 688 | * @deprecated 0.18.0  | 
                                                        
| 689 | 689 | */  | 
                                                        
| 690 | -	static function get_params( $i = -1 ) { | 
                                                        |
| 691 | - return TimberURLHelper::get_params( $i );  | 
                                                        |
| 690 | +	static function get_params($i = -1) { | 
                                                        |
| 691 | + return TimberURLHelper::get_params($i);  | 
                                                        |
| 692 | 692 | }  | 
                                                        
| 693 | 693 | |
| 694 | 694 | }  | 
                                                        
@@ -48,8 +48,9 @@  | 
                                                    ||
| 48 | 48 | |
| 49 | 49 | // lock timeout shouldn't be higher than 5 seconds, unless  | 
                                                        
| 50 | 50 | // remote calls with high timeouts are made here  | 
                                                        
| 51 | - if ( $enable_transients )  | 
                                                        |
| 52 | - self::_lock_transient( $slug, $lock_timeout );  | 
                                                        |
| 51 | +			if ( $enable_transients ) { | 
                                                        |
| 52 | + self::_lock_transient( $slug, $lock_timeout );  | 
                                                        |
| 53 | + }  | 
                                                        |
| 53 | 54 | |
| 54 | 55 | $data = $callback();  | 
                                                        
| 55 | 56 | |
@@ -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 | /**  | 
                                                        
@@ -325,7 +325,8 @@  | 
                                                    ||
| 325 | 325 | );  | 
                                                        
| 326 | 326 | $upload_dir = wp_upload_dir();  | 
                                                        
| 327 | 327 | $tmp = $url;  | 
                                                        
| 328 | -		if ( 0 === strpos($tmp, ABSPATH) ) { // we've been given a dir, not an url | 
                                                        |
| 328 | +		if ( 0 === strpos($tmp, ABSPATH) ) { | 
                                                        |
| 329 | +// we've been given a dir, not an url  | 
                                                        |
| 329 | 330 | $result['absolute'] = true;  | 
                                                        
| 330 | 331 |  			if ( 0 === strpos($tmp, $upload_dir['basedir']) ) { | 
                                                        
| 331 | 332 | $result['base']= self::BASE_UPLOADS; // upload based  | 
                                                        
@@ -43,9 +43,9 @@ discard block  | 
                                                    ||
| 43 | 43 | * ```  | 
                                                        
| 44 | 44 | * @return string (ex: )  | 
                                                        
| 45 | 45 | */  | 
                                                        
| 46 | -	public static function resize( $src, $w, $h = 0, $crop = 'default', $force = false ) { | 
                                                        |
| 47 | -		if (!is_numeric($w) && is_string($w)) { | 
                                                        |
| 48 | -			if ($sizes = self::find_wp_dimensions($w)) { | 
                                                        |
| 46 | +	public static function resize($src, $w, $h = 0, $crop = 'default', $force = false) { | 
                                                        |
| 47 | +		if ( !is_numeric($w) && is_string($w) ) { | 
                                                        |
| 48 | +			if ( $sizes = self::find_wp_dimensions($w) ) { | 
                                                        |
| 49 | 49 | $w = $sizes['w'];  | 
                                                        
| 50 | 50 | $h = $sizes['h'];  | 
                                                        
| 51 | 51 |  			} else { | 
                                                        
@@ -66,16 +66,16 @@ discard block  | 
                                                    ||
| 66 | 66 | * @type int h  | 
                                                        
| 67 | 67 | * }  | 
                                                        
| 68 | 68 | */  | 
                                                        
| 69 | -	private static function find_wp_dimensions( $size ) { | 
                                                        |
| 69 | +	private static function find_wp_dimensions($size) { | 
                                                        |
| 70 | 70 | global $_wp_additional_image_sizes;  | 
                                                        
| 71 | -		if (isset($_wp_additional_image_sizes[$size])) { | 
                                                        |
| 71 | +		if ( isset($_wp_additional_image_sizes[$size]) ) { | 
                                                        |
| 72 | 72 | $w = $_wp_additional_image_sizes[$size]['width'];  | 
                                                        
| 73 | 73 | $h = $_wp_additional_image_sizes[$size]['height'];  | 
                                                        
| 74 | -		} else if (in_array($size, array('thumbnail', 'medium', 'large'))) { | 
                                                        |
| 75 | - $w = get_option($size.'_size_w');  | 
                                                        |
| 76 | - $h = get_option($size.'_size_h');  | 
                                                        |
| 74 | +		} else if ( in_array($size, array('thumbnail', 'medium', 'large')) ) { | 
                                                        |
| 75 | + $w = get_option($size . '_size_w');  | 
                                                        |
| 76 | + $h = get_option($size . '_size_h');  | 
                                                        |
| 77 | 77 | }  | 
                                                        
| 78 | -		if (isset($w) && isset($h) && ($w || $h)) { | 
                                                        |
| 78 | +		if ( isset($w) && isset($h) && ($w || $h) ) { | 
                                                        |
| 79 | 79 |  			return array('w' => $w, 'h' => $h); | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | return false;  | 
                                                        
@@ -90,7 +90,7 @@ discard block  | 
                                                    ||
| 90 | 90 | *  | 
                                                        
| 91 | 91 | * @return string url to the new image  | 
                                                        
| 92 | 92 | */  | 
                                                        
| 93 | -	public static function retina_resize( $src, $multiplier = 2, $force = false ) { | 
                                                        |
| 93 | +	public static function retina_resize($src, $multiplier = 2, $force = false) { | 
                                                        |
| 94 | 94 | $op = new TimberImageOperationRetina($multiplier);  | 
                                                        
| 95 | 95 | return self::_operate($src, $op, $force);  | 
                                                        
| 96 | 96 | }  | 
                                                        
@@ -100,13 +100,13 @@ discard block  | 
                                                    ||
| 100 | 100 | * @param string $file local filepath to a file, not a URL  | 
                                                        
| 101 | 101 | * @return boolean true if it's an animated gif, false if not  | 
                                                        
| 102 | 102 | */  | 
                                                        
| 103 | -	public static function is_animated_gif( $file ) { | 
                                                        |
| 103 | +	public static function is_animated_gif($file) { | 
                                                        |
| 104 | 104 |  		if ( strpos(strtolower($file), '.gif') == -1 ) { | 
                                                        
| 105 | 105 | //doesn't have .gif, bail  | 
                                                        
| 106 | 106 | return false;  | 
                                                        
| 107 | 107 | }  | 
                                                        
| 108 | 108 | //its a gif so test  | 
                                                        
| 109 | -		if(!($fh = @fopen($file, 'rb'))) { | 
                                                        |
| 109 | +		if ( !($fh = @fopen($file, 'rb')) ) { | 
                                                        |
| 110 | 110 | return false;  | 
                                                        
| 111 | 111 | }  | 
                                                        
| 112 | 112 | $count = 0;  | 
                                                        
@@ -118,7 +118,7 @@ discard block  | 
                                                    ||
| 118 | 118 | |
| 119 | 119 | // We read through the file til we reach the end of the file, or we've found  | 
                                                        
| 120 | 120 | // at least 2 frame headers  | 
                                                        
| 121 | -	    while(!feof($fh) && $count < 2) { | 
                                                        |
| 121 | +	    while (!feof($fh) && $count < 2) { | 
                                                        |
| 122 | 122 | $chunk = fread($fh, 1024 * 100); //read 100kb at a time  | 
                                                        
| 123 | 123 |  	        $count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches); | 
                                                        
| 124 | 124 | }  | 
                                                        
@@ -138,7 +138,7 @@ discard block  | 
                                                    ||
| 138 | 138 | * @param bool $force  | 
                                                        
| 139 | 139 | * @return mixed|null|string  | 
                                                        
| 140 | 140 | */  | 
                                                        
| 141 | -	public static function letterbox( $src, $w, $h, $color = '#000000', $force = false ) { | 
                                                        |
| 141 | +	public static function letterbox($src, $w, $h, $color = '#000000', $force = false) { | 
                                                        |
| 142 | 142 | $op = new TimberImageOperationLetterbox($w, $h, $color);  | 
                                                        
| 143 | 143 | return self::_operate($src, $op, $force);  | 
                                                        
| 144 | 144 | }  | 
                                                        
@@ -150,7 +150,7 @@ discard block  | 
                                                    ||
| 150 | 150 | * @param string $bghex  | 
                                                        
| 151 | 151 | * @return string  | 
                                                        
| 152 | 152 | */  | 
                                                        
| 153 | -	public static function img_to_jpg( $src, $bghex = '#FFFFFF', $force = false ) { | 
                                                        |
| 153 | +	public static function img_to_jpg($src, $bghex = '#FFFFFF', $force = false) { | 
                                                        |
| 154 | 154 | $op = new TimberImageOperationToJpg($bghex);  | 
                                                        
| 155 | 155 | return self::_operate($src, $op, $force);  | 
                                                        
| 156 | 156 | }  | 
                                                        
@@ -159,13 +159,13 @@ discard block  | 
                                                    ||
| 159 | 159 | * Deletes all resized versions of an image when the source is deleted  | 
                                                        
| 160 | 160 | */  | 
                                                        
| 161 | 161 |  	protected static function add_actions() { | 
                                                        
| 162 | -		add_action( 'delete_attachment', function ( $post_id ) { | 
                                                        |
| 163 | - $post = get_post( $post_id );  | 
                                                        |
| 164 | - $image_types = array( 'image/jpeg', 'image/png', 'image/gif', 'image/jpg' );  | 
                                                        |
| 165 | -			if ( in_array( $post->post_mime_type, $image_types ) ) { | 
                                                        |
| 166 | - $attachment = new TimberImage( $post_id );  | 
                                                        |
| 162 | +		add_action('delete_attachment', function($post_id) { | 
                                                        |
| 163 | + $post = get_post($post_id);  | 
                                                        |
| 164 | +			$image_types = array('image/jpeg', 'image/png', 'image/gif', 'image/jpg'); | 
                                                        |
| 165 | +			if ( in_array($post->post_mime_type, $image_types) ) { | 
                                                        |
| 166 | + $attachment = new TimberImage($post_id);  | 
                                                        |
| 167 | 167 |  				if ( $attachment->file_loc ) { | 
                                                        
| 168 | - TimberImageHelper::delete_generated_files( $attachment->file_loc );  | 
                                                        |
| 168 | + TimberImageHelper::delete_generated_files($attachment->file_loc);  | 
                                                        |
| 169 | 169 | }  | 
                                                        
| 170 | 170 | }  | 
                                                        
| 171 | 171 | } );  | 
                                                        
@@ -176,9 +176,9 @@ discard block  | 
                                                    ||
| 176 | 176 | * for example /wp-content or /content  | 
                                                        
| 177 | 177 | */  | 
                                                        
| 178 | 178 |  	protected static function add_constants() { | 
                                                        
| 179 | -		if ( !defined( 'WP_CONTENT_SUBDIR' ) ) { | 
                                                        |
| 180 | - $wp_content_path = str_replace( home_url(), '', WP_CONTENT_URL );  | 
                                                        |
| 181 | - define( 'WP_CONTENT_SUBDIR', $wp_content_path );  | 
                                                        |
| 179 | +		if ( !defined('WP_CONTENT_SUBDIR') ) { | 
                                                        |
| 180 | + $wp_content_path = str_replace(home_url(), '', WP_CONTENT_URL);  | 
                                                        |
| 181 | +			define('WP_CONTENT_SUBDIR', $wp_content_path); | 
                                                        |
| 182 | 182 | }  | 
                                                        
| 183 | 183 | }  | 
                                                        
| 184 | 184 | |
@@ -188,8 +188,8 @@ discard block  | 
                                                    ||
| 188 | 188 | * @return void  | 
                                                        
| 189 | 189 | */  | 
                                                        
| 190 | 190 |  	static function add_filters() { | 
                                                        
| 191 | -		add_filter( 'upload_dir', function ( $arr ) { | 
                                                        |
| 192 | - $arr['relative'] = str_replace( home_url(), '', $arr['baseurl'] );  | 
                                                        |
| 191 | +		add_filter('upload_dir', function($arr) { | 
                                                        |
| 192 | + $arr['relative'] = str_replace(home_url(), '', $arr['baseurl']);  | 
                                                        |
| 193 | 193 | return $arr;  | 
                                                        
| 194 | 194 | } );  | 
                                                        
| 195 | 195 | }  | 
                                                        
@@ -200,16 +200,16 @@ discard block  | 
                                                    ||
| 200 | 200 | * @param string $local_file ex: /var/www/wp-content/uploads/2015/my-pic.jpg  | 
                                                        
| 201 | 201 | * or: http://example.org/wp-content/uploads/2015/my-pic.jpg  | 
                                                        
| 202 | 202 | */  | 
                                                        
| 203 | -	static function delete_generated_files( $local_file ) { | 
                                                        |
| 204 | -		if (TimberURLHelper::is_absolute( $local_file ) ) { | 
                                                        |
| 205 | - $local_file = TimberURLHelper::url_to_file_system( $local_file );  | 
                                                        |
| 203 | +	static function delete_generated_files($local_file) { | 
                                                        |
| 204 | +		if ( TimberURLHelper::is_absolute($local_file) ) { | 
                                                        |
| 205 | + $local_file = TimberURLHelper::url_to_file_system($local_file);  | 
                                                        |
| 206 | 206 | }  | 
                                                        
| 207 | - $info = pathinfo( $local_file );  | 
                                                        |
| 207 | + $info = pathinfo($local_file);  | 
                                                        |
| 208 | 208 | $dir = $info['dirname'];  | 
                                                        
| 209 | 209 | $ext = $info['extension'];  | 
                                                        
| 210 | 210 | $filename = $info['filename'];  | 
                                                        
| 211 | - self::process_delete_generated_files( $filename, $ext, $dir, '-[0-9999999]*', '-[0-9]*x[0-9]*-c-[a-z]*.' );  | 
                                                        |
| 212 | - self::process_delete_generated_files( $filename, $ext, $dir, '-lbox-[0-9999999]*', '-lbox-[0-9]*x[0-9]*-[a-zA-Z0-9]*.' );  | 
                                                        |
| 211 | + self::process_delete_generated_files($filename, $ext, $dir, '-[0-9999999]*', '-[0-9]*x[0-9]*-c-[a-z]*.');  | 
                                                        |
| 212 | + self::process_delete_generated_files($filename, $ext, $dir, '-lbox-[0-9999999]*', '-lbox-[0-9]*x[0-9]*-[a-zA-Z0-9]*.');  | 
                                                        |
| 213 | 213 | }  | 
                                                        
| 214 | 214 | |
| 215 | 215 | /**  | 
                                                        
@@ -226,14 +226,14 @@ discard block  | 
                                                    ||
| 226 | 226 | * @param string $search_pattern pattern of files to pluck from  | 
                                                        
| 227 | 227 | * @param string $match_pattern pattern of files to go forth and delete  | 
                                                        
| 228 | 228 | */  | 
                                                        
| 229 | -	protected static function process_delete_generated_files( $filename, $ext, $dir, $search_pattern, $match_pattern ) { | 
                                                        |
| 229 | +	protected static function process_delete_generated_files($filename, $ext, $dir, $search_pattern, $match_pattern) { | 
                                                        |
| 230 | 230 | $searcher = '/' . $filename . $search_pattern;  | 
                                                        
| 231 | -		foreach ( glob( $dir . $searcher ) as $found_file ) { | 
                                                        |
| 232 | - $regexdir = str_replace( '/', '\/', $dir );  | 
                                                        |
| 233 | - $pattern = '/' . ( $regexdir ) . '\/' . $filename . $match_pattern . $ext . '/';  | 
                                                        |
| 234 | - $match = preg_match( $pattern, $found_file );  | 
                                                        |
| 231 | +		foreach (glob($dir . $searcher) as $found_file) { | 
                                                        |
| 232 | +			$regexdir = str_replace('/', '\/', $dir); | 
                                                        |
| 233 | + $pattern = '/' . ($regexdir) . '\/' . $filename . $match_pattern . $ext . '/';  | 
                                                        |
| 234 | + $match = preg_match($pattern, $found_file);  | 
                                                        |
| 235 | 235 |  			if ( $match ) { | 
                                                        
| 236 | - unlink( $found_file );  | 
                                                        |
| 236 | + unlink($found_file);  | 
                                                        |
| 237 | 237 | }  | 
                                                        
| 238 | 238 | }  | 
                                                        
| 239 | 239 | }  | 
                                                        
@@ -245,9 +245,9 @@ discard block  | 
                                                    ||
| 245 | 245 | * @param string $url  | 
                                                        
| 246 | 246 | * @return string  | 
                                                        
| 247 | 247 | */  | 
                                                        
| 248 | -	public static function get_server_location( $url ) { | 
                                                        |
| 248 | +	public static function get_server_location($url) { | 
                                                        |
| 249 | 249 | // if we're already an absolute dir, just return  | 
                                                        
| 250 | -		if ( 0 === strpos( $url, ABSPATH ) ) { | 
                                                        |
| 250 | +		if ( 0 === strpos($url, ABSPATH) ) { | 
                                                        |
| 251 | 251 | return $url;  | 
                                                        
| 252 | 252 | }  | 
                                                        
| 253 | 253 | // otherwise, analyze URL then build mapping path  | 
                                                        
@@ -262,15 +262,15 @@ discard block  | 
                                                    ||
| 262 | 262 | * @param string $file  | 
                                                        
| 263 | 263 | * @return string  | 
                                                        
| 264 | 264 | */  | 
                                                        
| 265 | -	public static function get_sideloaded_file_loc( $file ) { | 
                                                        |
| 265 | +	public static function get_sideloaded_file_loc($file) { | 
                                                        |
| 266 | 266 | $upload = wp_upload_dir();  | 
                                                        
| 267 | 267 | $dir = $upload['path'];  | 
                                                        
| 268 | 268 | $filename = $file;  | 
                                                        
| 269 | - $file = parse_url( $file );  | 
                                                        |
| 270 | - $path_parts = pathinfo( $file['path'] );  | 
                                                        |
| 271 | - $basename = md5( $filename );  | 
                                                        |
| 269 | + $file = parse_url($file);  | 
                                                        |
| 270 | + $path_parts = pathinfo($file['path']);  | 
                                                        |
| 271 | + $basename = md5($filename);  | 
                                                        |
| 272 | 272 | $ext = 'jpg';  | 
                                                        
| 273 | -		if ( isset( $path_parts['extension'] ) ) { | 
                                                        |
| 273 | +		if ( isset($path_parts['extension']) ) { | 
                                                        |
| 274 | 274 | $ext = $path_parts['extension'];  | 
                                                        
| 275 | 275 | }  | 
                                                        
| 276 | 276 | return $dir . '/' . $basename . '.' . $ext;  | 
                                                        
@@ -282,28 +282,28 @@ discard block  | 
                                                    ||
| 282 | 282 | * @param string $file the URL to the original file  | 
                                                        
| 283 | 283 | * @return string the URL to the downloaded file  | 
                                                        
| 284 | 284 | */  | 
                                                        
| 285 | -	public static function sideload_image( $file ) { | 
                                                        |
| 286 | - $loc = self::get_sideloaded_file_loc( $file );  | 
                                                        |
| 287 | -		if ( file_exists( $loc ) ) { | 
                                                        |
| 288 | - return TimberURLHelper::preslashit( TimberURLHelper::get_rel_path( $loc ) );  | 
                                                        |
| 285 | +	public static function sideload_image($file) { | 
                                                        |
| 286 | + $loc = self::get_sideloaded_file_loc($file);  | 
                                                        |
| 287 | +		if ( file_exists($loc) ) { | 
                                                        |
| 288 | + return TimberURLHelper::preslashit(TimberURLHelper::get_rel_path($loc));  | 
                                                        |
| 289 | 289 | }  | 
                                                        
| 290 | 290 | // Download file to temp location  | 
                                                        
| 291 | -		if ( !function_exists( 'download_url' ) ) { | 
                                                        |
| 291 | +		if ( !function_exists('download_url') ) { | 
                                                        |
| 292 | 292 | require_once ABSPATH . '/wp-admin/includes/file.php';  | 
                                                        
| 293 | 293 | }  | 
                                                        
| 294 | - $tmp = download_url( $file );  | 
                                                        |
| 295 | - preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );  | 
                                                        |
| 294 | + $tmp = download_url($file);  | 
                                                        |
| 295 | +		preg_match('/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches); | 
                                                        |
| 296 | 296 | $file_array = array();  | 
                                                        
| 297 | - $file_array['name'] = basename( $matches[0] );  | 
                                                        |
| 297 | + $file_array['name'] = basename($matches[0]);  | 
                                                        |
| 298 | 298 | $file_array['tmp_name'] = $tmp;  | 
                                                        
| 299 | 299 | // If error storing temporarily, unlink  | 
                                                        
| 300 | -		if ( is_wp_error( $tmp ) ) { | 
                                                        |
| 301 | - @unlink( $file_array['tmp_name'] );  | 
                                                        |
| 300 | +		if ( is_wp_error($tmp) ) { | 
                                                        |
| 301 | + @unlink($file_array['tmp_name']);  | 
                                                        |
| 302 | 302 | $file_array['tmp_name'] = '';  | 
                                                        
| 303 | 303 | }  | 
                                                        
| 304 | 304 | // do the validation and storage stuff  | 
                                                        
| 305 | - $locinfo = pathinfo( $loc );  | 
                                                        |
| 306 | - $file = wp_upload_bits( $locinfo['basename'], null, file_get_contents( $file_array['tmp_name'] ) );  | 
                                                        |
| 305 | + $locinfo = pathinfo($loc);  | 
                                                        |
| 306 | + $file = wp_upload_bits($locinfo['basename'], null, file_get_contents($file_array['tmp_name']));  | 
                                                        |
| 307 | 307 | return $file['url'];  | 
                                                        
| 308 | 308 | }  | 
                                                        
| 309 | 309 | |
@@ -330,23 +330,23 @@ discard block  | 
                                                    ||
| 330 | 330 |  		if ( 0 === strpos($tmp, ABSPATH) ) { // we've been given a dir, not an url | 
                                                        
| 331 | 331 | $result['absolute'] = true;  | 
                                                        
| 332 | 332 |  			if ( 0 === strpos($tmp, $upload_dir['basedir']) ) { | 
                                                        
| 333 | - $result['base']= self::BASE_UPLOADS; // upload based  | 
                                                        |
| 333 | + $result['base'] = self::BASE_UPLOADS; // upload based  | 
                                                        |
| 334 | 334 | $tmp = str_replace($upload_dir['basedir'], '', $tmp);  | 
                                                        
| 335 | 335 | }  | 
                                                        
| 336 | 336 |  			if ( 0 === strpos($tmp, WP_CONTENT_DIR) ) { | 
                                                        
| 337 | - $result['base']= self::BASE_CONTENT; // content based  | 
                                                        |
| 337 | + $result['base'] = self::BASE_CONTENT; // content based  | 
                                                        |
| 338 | 338 | $tmp = str_replace(WP_CONTENT_DIR, '', $tmp);  | 
                                                        
| 339 | 339 | }  | 
                                                        
| 340 | 340 |  		} else { | 
                                                        
| 341 | -			if (!$result['absolute']) { | 
                                                        |
| 342 | - $tmp = home_url().$tmp;  | 
                                                        |
| 341 | +			if ( !$result['absolute'] ) { | 
                                                        |
| 342 | + $tmp = home_url() . $tmp;  | 
                                                        |
| 343 | 343 | }  | 
                                                        
| 344 | -			if (0 === strpos($tmp, $upload_dir['baseurl'])) { | 
                                                        |
| 345 | - $result['base']= self::BASE_UPLOADS; // upload based  | 
                                                        |
| 344 | +			if ( 0 === strpos($tmp, $upload_dir['baseurl']) ) { | 
                                                        |
| 345 | + $result['base'] = self::BASE_UPLOADS; // upload based  | 
                                                        |
| 346 | 346 | $tmp = str_replace($upload_dir['baseurl'], '', $tmp);  | 
                                                        
| 347 | 347 | }  | 
                                                        
| 348 | -			if (0 === strpos($tmp, content_url())) { | 
                                                        |
| 349 | - $result['base']= self::BASE_CONTENT; // content-based  | 
                                                        |
| 348 | +			if ( 0 === strpos($tmp, content_url()) ) { | 
                                                        |
| 349 | + $result['base'] = self::BASE_CONTENT; // content-based  | 
                                                        |
| 350 | 350 | $tmp = str_replace(content_url(), '', $tmp);  | 
                                                        
| 351 | 351 | }  | 
                                                        
| 352 | 352 | }  | 
                                                        
@@ -370,18 +370,18 @@ discard block  | 
                                                    ||
| 370 | 370 | */  | 
                                                        
| 371 | 371 |  	private static function _get_file_url($base, $subdir, $filename, $absolute) { | 
                                                        
| 372 | 372 | $url = '';  | 
                                                        
| 373 | -		if( self::BASE_UPLOADS == $base ) { | 
                                                        |
| 373 | +		if ( self::BASE_UPLOADS == $base ) { | 
                                                        |
| 374 | 374 | $upload_dir = wp_upload_dir();  | 
                                                        
| 375 | 375 | $url = $upload_dir['baseurl'];  | 
                                                        
| 376 | 376 | }  | 
                                                        
| 377 | -		if( self::BASE_CONTENT == $base ) { | 
                                                        |
| 377 | +		if ( self::BASE_CONTENT == $base ) { | 
                                                        |
| 378 | 378 | $url = content_url();  | 
                                                        
| 379 | 379 | }  | 
                                                        
| 380 | -		if(!empty($subdir)) { | 
                                                        |
| 380 | +		if ( !empty($subdir) ) { | 
                                                        |
| 381 | 381 | $url .= $subdir;  | 
                                                        
| 382 | 382 | }  | 
                                                        
| 383 | - $url .= '/'.$filename;  | 
                                                        |
| 384 | -		if(!$absolute) { | 
                                                        |
| 383 | + $url .= '/' . $filename;  | 
                                                        |
| 384 | +		if ( !$absolute ) { | 
                                                        |
| 385 | 385 | $url = str_replace(home_url(), '', $url);  | 
                                                        
| 386 | 386 | }  | 
                                                        
| 387 | 387 | // $url = TimberURLHelper::remove_double_slashes( $url);  | 
                                                        
@@ -398,17 +398,17 @@ discard block  | 
                                                    ||
| 398 | 398 | */  | 
                                                        
| 399 | 399 |  	private static function _get_file_path($base, $subdir, $filename) { | 
                                                        
| 400 | 400 | $path = '';  | 
                                                        
| 401 | -		if(self::BASE_UPLOADS == $base) { | 
                                                        |
| 401 | +		if ( self::BASE_UPLOADS == $base ) { | 
                                                        |
| 402 | 402 | $upload_dir = wp_upload_dir();  | 
                                                        
| 403 | 403 | $path = $upload_dir['basedir'];  | 
                                                        
| 404 | 404 | }  | 
                                                        
| 405 | -		if(self::BASE_CONTENT == $base) { | 
                                                        |
| 405 | +		if ( self::BASE_CONTENT == $base ) { | 
                                                        |
| 406 | 406 | $path = WP_CONTENT_DIR;  | 
                                                        
| 407 | 407 | }  | 
                                                        
| 408 | -		if(!empty($subdir)) { | 
                                                        |
| 408 | +		if ( !empty($subdir) ) { | 
                                                        |
| 409 | 409 | $path .= $subdir;  | 
                                                        
| 410 | 410 | }  | 
                                                        
| 411 | - $path .= '/'.$filename;  | 
                                                        |
| 411 | + $path .= '/' . $filename;  | 
                                                        |
| 412 | 412 | return $path;  | 
                                                        
| 413 | 413 | }  | 
                                                        
| 414 | 414 | |
@@ -426,13 +426,13 @@ discard block  | 
                                                    ||
| 426 | 426 | * @return string URL to the new image - or the source one if error  | 
                                                        
| 427 | 427 | *  | 
                                                        
| 428 | 428 | */  | 
                                                        
| 429 | -	private static function _operate( $src, $op, $force = false ) { | 
                                                        |
| 430 | -		if ( empty( $src ) ) { | 
                                                        |
| 429 | +	private static function _operate($src, $op, $force = false) { | 
                                                        |
| 430 | +		if ( empty($src) ) { | 
                                                        |
| 431 | 431 | return '';  | 
                                                        
| 432 | 432 | }  | 
                                                        
| 433 | 433 | // if external image, load it first  | 
                                                        
| 434 | -		if ( TimberURLHelper::is_external_content( $src ) ) { | 
                                                        |
| 435 | - $src = self::sideload_image( $src );  | 
                                                        |
| 434 | +		if ( TimberURLHelper::is_external_content($src) ) { | 
                                                        |
| 435 | + $src = self::sideload_image($src);  | 
                                                        |
| 436 | 436 | }  | 
                                                        
| 437 | 437 | // break down URL into components  | 
                                                        
| 438 | 438 | $au = self::analyze_url($src);  | 
                                                        
@@ -454,17 +454,17 @@ discard block  | 
                                                    ||
| 454 | 454 | $au['basename']  | 
                                                        
| 455 | 455 | );  | 
                                                        
| 456 | 456 | // if already exists...  | 
                                                        
| 457 | -		if ( file_exists( $new_server_path ) ) { | 
                                                        |
| 457 | +		if ( file_exists($new_server_path) ) { | 
                                                        |
| 458 | 458 |  			if ( $force ) { | 
                                                        
| 459 | 459 | // Force operation - warning: will regenerate the image on every pageload, use for testing purposes only!  | 
                                                        
| 460 | - unlink( $new_server_path );  | 
                                                        |
| 460 | + unlink($new_server_path);  | 
                                                        |
| 461 | 461 |  			} else { | 
                                                        
| 462 | 462 | // return existing file (caching)  | 
                                                        
| 463 | 463 | return $new_url;  | 
                                                        
| 464 | 464 | }  | 
                                                        
| 465 | 465 | }  | 
                                                        
| 466 | 466 | // otherwise generate result file  | 
                                                        
| 467 | -		if($op->run($old_server_path, $new_server_path)) { | 
                                                        |
| 467 | +		if ( $op->run($old_server_path, $new_server_path) ) { | 
                                                        |
| 468 | 468 | return $new_url;  | 
                                                        
| 469 | 469 |  		} else { | 
                                                        
| 470 | 470 | // in case of error, we return source file itself  | 
                                                        
@@ -486,7 +486,7 @@ discard block  | 
                                                    ||
| 486 | 486 | );  | 
                                                        
| 487 | 487 | return $new_url;  | 
                                                        
| 488 | 488 | }  | 
                                                        
| 489 | -	public static function get_letterbox_file_path($url, $w, $h, $color ) { | 
                                                        |
| 489 | +	public static function get_letterbox_file_path($url, $w, $h, $color) { | 
                                                        |
| 490 | 490 | $au = self::analyze_url($url);  | 
                                                        
| 491 | 491 | $op = new TimberImageOperationLetterbox($w, $h, $color);  | 
                                                        
| 492 | 492 | $new_path = self::_get_file_path(  | 
                                                        
@@ -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" />  | 
                                                        
@@ -87,7 +87,7 @@ discard block  | 
                                                    ||
| 87 | 87 | * @return string the src of the file  | 
                                                        
| 88 | 88 | */  | 
                                                        
| 89 | 89 |  	public function __toString() { | 
                                                        
| 90 | -		if ($this->get_src()) { | 
                                                        |
| 90 | +		if ( $this->get_src() ) { | 
                                                        |
| 91 | 91 | return $this->get_src();  | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | return '';  | 
                                                        
@@ -107,7 +107,7 @@ discard block  | 
                                                    ||
| 107 | 107 | * @return array|int  | 
                                                        
| 108 | 108 | */  | 
                                                        
| 109 | 109 |  	protected function get_dimensions($dim = null) { | 
                                                        
| 110 | -		if (isset($this->_dimensions)) { | 
                                                        |
| 110 | +		if ( isset($this->_dimensions) ) { | 
                                                        |
| 111 | 111 | return $this->get_dimensions_loaded($dim);  | 
                                                        
| 112 | 112 | }  | 
                                                        
| 113 | 113 |  		if ( file_exists($this->file_loc) && filesize($this->file_loc) ) { | 
                                                        
@@ -125,13 +125,13 @@ discard block  | 
                                                    ||
| 125 | 125 | * @return array|int  | 
                                                        
| 126 | 126 | */  | 
                                                        
| 127 | 127 |  	protected function get_dimensions_loaded($dim) { | 
                                                        
| 128 | -		if ($dim === null) { | 
                                                        |
| 128 | +		if ( $dim === null ) { | 
                                                        |
| 129 | 129 | return $this->_dimensions;  | 
                                                        
| 130 | 130 | }  | 
                                                        
| 131 | -		if ($dim == 'w' || $dim == 'width') { | 
                                                        |
| 131 | +		if ( $dim == 'w' || $dim == 'width' ) { | 
                                                        |
| 132 | 132 | return $this->_dimensions[0];  | 
                                                        
| 133 | 133 | }  | 
                                                        
| 134 | -		if ($dim == 'h' || $dim == 'height') { | 
                                                        |
| 134 | +		if ( $dim == 'h' || $dim == 'height' ) { | 
                                                        |
| 135 | 135 | return $this->_dimensions[1];  | 
                                                        
| 136 | 136 | }  | 
                                                        
| 137 | 137 | return null;  | 
                                                        
@@ -141,27 +141,27 @@ discard block  | 
                                                    ||
| 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;  | 
                                                        
@@ -173,7 +173,7 @@ discard block  | 
                                                    ||
| 173 | 173 | * @return string with http/https corrected depending on what's appropriate for server  | 
                                                        
| 174 | 174 | */  | 
                                                        
| 175 | 175 |  	protected static function _maybe_secure_url($url) { | 
                                                        
| 176 | -		if (is_ssl() && strpos($url, 'https') !== 0 && strpos($url, 'http') === 0) { | 
                                                        |
| 176 | +		if ( is_ssl() && strpos($url, 'https') !== 0 && strpos($url, 'http') === 0 ) { | 
                                                        |
| 177 | 177 |  			$url = 'https' . substr($url, strlen('http')); | 
                                                        
| 178 | 178 | }  | 
                                                        
| 179 | 179 | return $url;  | 
                                                        
@@ -182,7 +182,7 @@ discard block  | 
                                                    ||
| 182 | 182 |  	public static function wp_upload_dir() { | 
                                                        
| 183 | 183 | static $wp_upload_dir = false;  | 
                                                        
| 184 | 184 | |
| 185 | -		if (!$wp_upload_dir) { | 
                                                        |
| 185 | +		if ( !$wp_upload_dir ) { | 
                                                        |
| 186 | 186 | $wp_upload_dir = wp_upload_dir();  | 
                                                        
| 187 | 187 | }  | 
                                                        
| 188 | 188 | |
@@ -193,9 +193,9 @@ discard block  | 
                                                    ||
| 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 | }  | 
                                                        
@@ -203,7 +203,7 @@ discard block  | 
                                                    ||
| 203 | 203 | $this->init_with_file_path($iid);  | 
                                                        
| 204 | 204 | return;  | 
                                                        
| 205 | 205 | }  | 
                                                        
| 206 | -			if (strstr(strtolower($iid), '.jpg')) { | 
                                                        |
| 206 | +			if ( strstr(strtolower($iid), '.jpg') ) { | 
                                                        |
| 207 | 207 | $this->init_with_relative_path($iid);  | 
                                                        
| 208 | 208 | return;  | 
                                                        
| 209 | 209 | }  | 
                                                        
@@ -214,24 +214,24 @@ discard block  | 
                                                    ||
| 214 | 214 | $this->import($image_info);  | 
                                                        
| 215 | 215 | $basedir = self::wp_upload_dir();  | 
                                                        
| 216 | 216 | $basedir = $basedir['basedir'];  | 
                                                        
| 217 | -		if (isset($this->file)) { | 
                                                        |
| 217 | +		if ( isset($this->file) ) { | 
                                                        |
| 218 | 218 | $this->file_loc = $basedir . DIRECTORY_SEPARATOR . $this->file;  | 
                                                        
| 219 | -		} else if (isset($this->_wp_attached_file)) { | 
                                                        |
| 219 | +		} else if ( isset($this->_wp_attached_file) ) { | 
                                                        |
| 220 | 220 | $this->file = reset($this->_wp_attached_file);  | 
                                                        
| 221 | 221 | $this->file_loc = $basedir . DIRECTORY_SEPARATOR . $this->file;  | 
                                                        
| 222 | 222 | }  | 
                                                        
| 223 | -		if (isset($image_info['id'])) { | 
                                                        |
| 223 | +		if ( isset($image_info['id']) ) { | 
                                                        |
| 224 | 224 | $this->ID = $image_info['id'];  | 
                                                        
| 225 | -		} else if (is_numeric($iid)) { | 
                                                        |
| 225 | +		} else if ( is_numeric($iid) ) { | 
                                                        |
| 226 | 226 | $this->ID = $iid;  | 
                                                        
| 227 | 227 | }  | 
                                                        
| 228 | -		if (isset($this->ID)) { | 
                                                        |
| 228 | +		if ( isset($this->ID) ) { | 
                                                        |
| 229 | 229 | $custom = get_post_custom($this->ID);  | 
                                                        
| 230 | 230 |  			foreach ($custom as $key => $value) { | 
                                                        
| 231 | 231 | $this->$key = $value[0];  | 
                                                        
| 232 | 232 | }  | 
                                                        
| 233 | 233 |  		} else { | 
                                                        
| 234 | -			if (is_array($iid) || is_object($iid)) { | 
                                                        |
| 234 | +			if ( is_array($iid) || is_object($iid) ) { | 
                                                        |
| 235 | 235 |  				TimberHelper::error_log('Not able to init in TimberImage with iid='); | 
                                                        
| 236 | 236 | TimberHelper::error_log($iid);  | 
                                                        
| 237 | 237 |  			} else { | 
                                                        
@@ -244,9 +244,9 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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;  | 
                                                        
@@ -268,7 +268,7 @@ discard block  | 
                                                    ||
| 268 | 268 | */  | 
                                                        
| 269 | 269 |  	protected function init_with_url($url) { | 
                                                        
| 270 | 270 | $this->abs_url = $url;  | 
                                                        
| 271 | -		if (TimberURLHelper::is_local($url)) { | 
                                                        |
| 271 | +		if ( TimberURLHelper::is_local($url) ) { | 
                                                        |
| 272 | 272 | $this->file = ABSPATH . TimberURLHelper::get_rel_url($url);  | 
                                                        
| 273 | 273 | $this->file_loc = ABSPATH . TimberURLHelper::get_rel_url($url);  | 
                                                        
| 274 | 274 | }  | 
                                                        
@@ -336,7 +336,7 @@ discard block  | 
                                                    ||
| 336 | 336 | * ```  | 
                                                        
| 337 | 337 | */  | 
                                                        
| 338 | 338 |  	public function link() { | 
                                                        
| 339 | -		if (strlen($this->abs_url)) { | 
                                                        |
| 339 | +		if ( strlen($this->abs_url) ) { | 
                                                        |
| 340 | 340 | return $this->abs_url;  | 
                                                        
| 341 | 341 | }  | 
                                                        
| 342 | 342 | return get_permalink($this->ID);  | 
                                                        
@@ -347,7 +347,7 @@ discard block  | 
                                                    ||
| 347 | 347 | * @return bool|TimberPost  | 
                                                        
| 348 | 348 | */  | 
                                                        
| 349 | 349 |  	public function parent() { | 
                                                        
| 350 | -		if (!$this->post_parent) { | 
                                                        |
| 350 | +		if ( !$this->post_parent ) { | 
                                                        |
| 351 | 351 | return false;  | 
                                                        
| 352 | 352 | }  | 
                                                        
| 353 | 353 | return new $this->PostClass($this->post_parent);  | 
                                                        
@@ -455,8 +455,8 @@ discard block  | 
                                                    ||
| 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 | /**  | 
                                                        
@@ -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)) { | 
                                                        
@@ -24,15 +24,15 @@ discard block  | 
                                                    ||
| 24 | 24 | *  | 
                                                        
| 25 | 25 | * @param array|object $data  | 
                                                        
| 26 | 26 | */  | 
                                                        
| 27 | -	public function __construct( $data ) { | 
                                                        |
| 27 | +	public function __construct($data) { | 
                                                        |
| 28 | 28 | $data = (object) $data;  | 
                                                        
| 29 | - $this->import( $data );  | 
                                                        |
| 30 | - $this->import_classes( $data );  | 
                                                        |
| 31 | -		if ( isset( $this->name ) ) { | 
                                                        |
| 29 | + $this->import($data);  | 
                                                        |
| 30 | + $this->import_classes($data);  | 
                                                        |
| 31 | +		if ( isset($this->name) ) { | 
                                                        |
| 32 | 32 | $this->_name = $this->name;  | 
                                                        
| 33 | 33 | }  | 
                                                        
| 34 | 34 | $this->name = $this->name();  | 
                                                        
| 35 | - $this->add_class( 'menu-item-' . $this->ID );  | 
                                                        |
| 35 | +		$this->add_class('menu-item-' . $this->ID); | 
                                                        |
| 36 | 36 | $this->menu_object = $data;  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | |
@@ -47,7 +47,7 @@ discard block  | 
                                                    ||
| 47 | 47 | * add a class the menu item should have  | 
                                                        
| 48 | 48 | * @param string $class_name to be added  | 
                                                        
| 49 | 49 | */  | 
                                                        
| 50 | -	public function add_class( $class_name ) { | 
                                                        |
| 50 | +	public function add_class($class_name) { | 
                                                        |
| 51 | 51 | $this->classes[] = $class_name;  | 
                                                        
| 52 | 52 | $this->class .= ' ' . $class_name;  | 
                                                        
| 53 | 53 | }  | 
                                                        
@@ -61,7 +61,7 @@ discard block  | 
                                                    ||
| 61 | 61 |  		if ( $title = $this->title() ) { | 
                                                        
| 62 | 62 | return $title;  | 
                                                        
| 63 | 63 | }  | 
                                                        
| 64 | -		if ( isset( $this->_name ) ) { | 
                                                        |
| 64 | +		if ( isset($this->_name) ) { | 
                                                        |
| 65 | 65 | return $this->_name;  | 
                                                        
| 66 | 66 | }  | 
                                                        
| 67 | 67 | return '';  | 
                                                        
@@ -82,10 +82,10 @@ discard block  | 
                                                    ||
| 82 | 82 | * @return string the slug of the menu item kinda-like-this  | 
                                                        
| 83 | 83 | */  | 
                                                        
| 84 | 84 |  	public function slug() { | 
                                                        
| 85 | -		if ( !isset( $this->master_object ) ) { | 
                                                        |
| 85 | +		if ( !isset($this->master_object) ) { | 
                                                        |
| 86 | 86 | $this->master_object = $this->get_master_object();  | 
                                                        
| 87 | 87 | }  | 
                                                        
| 88 | -		if ( isset( $this->master_object->post_name ) && $this->master_object->post_name ) { | 
                                                        |
| 88 | +		if ( isset($this->master_object->post_name) && $this->master_object->post_name ) { | 
                                                        |
| 89 | 89 | return $this->master_object->post_name;  | 
                                                        
| 90 | 90 | }  | 
                                                        
| 91 | 91 | return $this->post_name;  | 
                                                        
@@ -96,8 +96,8 @@ discard block  | 
                                                    ||
| 96 | 96 | * @return mixed whatever object (Post, Term, etc.) the menu item represents  | 
                                                        
| 97 | 97 | */  | 
                                                        
| 98 | 98 |  	protected function get_master_object() { | 
                                                        
| 99 | -		if ( isset( $this->_menu_item_object_id ) ) { | 
                                                        |
| 100 | - return new $this->PostClass( $this->_menu_item_object_id );  | 
                                                        |
| 99 | +		if ( isset($this->_menu_item_object_id) ) { | 
                                                        |
| 100 | + return new $this->PostClass($this->_menu_item_object_id);  | 
                                                        |
| 101 | 101 | }  | 
                                                        
| 102 | 102 | }  | 
                                                        
| 103 | 103 | |
@@ -107,10 +107,10 @@ discard block  | 
                                                    ||
| 107 | 107 | * @return string an absolute URL http://example.org/my-page  | 
                                                        
| 108 | 108 | */  | 
                                                        
| 109 | 109 |  	function get_link() { | 
                                                        
| 110 | -		if ( !isset( $this->url ) || !$this->url ) { | 
                                                        |
| 111 | -			if ( isset( $this->_menu_item_type ) && $this->_menu_item_type == 'custom' ) { | 
                                                        |
| 110 | +		if ( !isset($this->url) || !$this->url ) { | 
                                                        |
| 111 | +			if ( isset($this->_menu_item_type) && $this->_menu_item_type == 'custom' ) { | 
                                                        |
| 112 | 112 | $this->url = $this->_menu_item_url;  | 
                                                        
| 113 | -			} else if ( isset( $this->menu_object ) && method_exists( $this->menu_object, 'get_link' ) ) { | 
                                                        |
| 113 | +			} else if ( isset($this->menu_object) && method_exists($this->menu_object, 'get_link') ) { | 
                                                        |
| 114 | 114 | $this->url = $this->menu_object->get_link();  | 
                                                        
| 115 | 115 | }  | 
                                                        
| 116 | 116 | }  | 
                                                        
@@ -123,7 +123,7 @@ discard block  | 
                                                    ||
| 123 | 123 | * @return string a relative url /my-page  | 
                                                        
| 124 | 124 | */  | 
                                                        
| 125 | 125 |  	function get_path() { | 
                                                        
| 126 | - return TimberURLHelper::get_rel_url( $this->get_link() );  | 
                                                        |
| 126 | + return TimberURLHelper::get_rel_url($this->get_link());  | 
                                                        |
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
| 129 | 129 | /**  | 
                                                        
@@ -131,17 +131,17 @@ discard block  | 
                                                    ||
| 131 | 131 | *  | 
                                                        
| 132 | 132 | * @param TimberMenuItem $item  | 
                                                        
| 133 | 133 | */  | 
                                                        
| 134 | -	function add_child( $item ) { | 
                                                        |
| 134 | +	function add_child($item) { | 
                                                        |
| 135 | 135 |  		if ( !$this->has_child_class ) { | 
                                                        
| 136 | - $this->add_class( 'menu-item-has-children' );  | 
                                                        |
| 136 | +			$this->add_class('menu-item-has-children'); | 
                                                        |
| 137 | 137 | $this->has_child_class = true;  | 
                                                        
| 138 | 138 | }  | 
                                                        
| 139 | -		if ( !isset( $this->children ) ) { | 
                                                        |
| 139 | +		if ( !isset($this->children) ) { | 
                                                        |
| 140 | 140 | $this->children = array();  | 
                                                        
| 141 | 141 | }  | 
                                                        
| 142 | 142 | $this->children[] = $item;  | 
                                                        
| 143 | 143 | $item->level = $this->level + 1;  | 
                                                        
| 144 | -		if ($item->children) { | 
                                                        |
| 144 | +		if ( $item->children ) { | 
                                                        |
| 145 | 145 | $this->update_child_levels();  | 
                                                        
| 146 | 146 | }  | 
                                                        
| 147 | 147 | }  | 
                                                        
@@ -152,8 +152,8 @@ discard block  | 
                                                    ||
| 152 | 152 | * @return bool  | 
                                                        
| 153 | 153 | */  | 
                                                        
| 154 | 154 |  	function update_child_levels() { | 
                                                        
| 155 | -		if (is_array($this->children)) { | 
                                                        |
| 156 | -			foreach( $this->children as $child ) { | 
                                                        |
| 155 | +		if ( is_array($this->children) ) { | 
                                                        |
| 156 | +			foreach ($this->children as $child) { | 
                                                        |
| 157 | 157 | $child->level = $this->level + 1;  | 
                                                        
| 158 | 158 | $child->update_child_levels();  | 
                                                        
| 159 | 159 | }  | 
                                                        
@@ -166,14 +166,14 @@ discard block  | 
                                                    ||
| 166 | 166 | * @internal  | 
                                                        
| 167 | 167 | * @param array|object $data  | 
                                                        
| 168 | 168 | */  | 
                                                        
| 169 | -	function import_classes( $data ) { | 
                                                        |
| 169 | +	function import_classes($data) { | 
                                                        |
| 170 | 170 |  		if ( is_array($data) ) { | 
                                                        
| 171 | 171 | $data = (object) $data;  | 
                                                        
| 172 | 172 | }  | 
                                                        
| 173 | - $this->classes = array_merge( $this->classes, $data->classes );  | 
                                                        |
| 174 | - $this->classes = array_unique( $this->classes );  | 
                                                        |
| 175 | - $this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this );  | 
                                                        |
| 176 | - $this->class = trim( implode( ' ', $this->classes ) );  | 
                                                        |
| 173 | + $this->classes = array_merge($this->classes, $data->classes);  | 
                                                        |
| 174 | + $this->classes = array_unique($this->classes);  | 
                                                        |
| 175 | +		$this->classes = apply_filters('nav_menu_css_class', $this->classes, $this); | 
                                                        |
| 176 | +		$this->class = trim(implode(' ', $this->classes)); | 
                                                        |
| 177 | 177 | }  | 
                                                        
| 178 | 178 | |
| 179 | 179 | /**  | 
                                                        
@@ -182,7 +182,7 @@ discard block  | 
                                                    ||
| 182 | 182 | * @return array|bool  | 
                                                        
| 183 | 183 | */  | 
                                                        
| 184 | 184 |  	function get_children() { | 
                                                        
| 185 | -		if ( isset( $this->children ) ) { | 
                                                        |
| 185 | +		if ( isset($this->children) ) { | 
                                                        |
| 186 | 186 | return $this->children;  | 
                                                        
| 187 | 187 | }  | 
                                                        
| 188 | 188 | return false;  | 
                                                        
@@ -201,18 +201,18 @@ discard block  | 
                                                    ||
| 201 | 201 |  		if ( $this->type != 'custom' ) { | 
                                                        
| 202 | 202 | return false;  | 
                                                        
| 203 | 203 | }  | 
                                                        
| 204 | - return TimberURLHelper::is_external( $this->url );  | 
                                                        |
| 204 | + return TimberURLHelper::is_external($this->url);  | 
                                                        |
| 205 | 205 | }  | 
                                                        
| 206 | 206 | |
| 207 | 207 | /**  | 
                                                        
| 208 | 208 | * @param string $key lookup key  | 
                                                        
| 209 | 209 | * @return mixed whatever value is storied in the database  | 
                                                        
| 210 | 210 | */  | 
                                                        
| 211 | -	public function meta( $key ) { | 
                                                        |
| 212 | -		if ( is_object( $this->menu_object ) && method_exists( $this->menu_object, 'meta' ) ) { | 
                                                        |
| 213 | - return $this->menu_object->meta( $key );  | 
                                                        |
| 211 | +	public function meta($key) { | 
                                                        |
| 212 | +		if ( is_object($this->menu_object) && method_exists($this->menu_object, 'meta') ) { | 
                                                        |
| 213 | + return $this->menu_object->meta($key);  | 
                                                        |
| 214 | 214 | }  | 
                                                        
| 215 | -		if ( isset( $this->$key ) ) { | 
                                                        |
| 215 | +		if ( isset($this->$key) ) { | 
                                                        |
| 216 | 216 | return $this->$key;  | 
                                                        
| 217 | 217 | }  | 
                                                        
| 218 | 218 | }  | 
                                                        
@@ -299,7 +299,7 @@ discard block  | 
                                                    ||
| 299 | 299 | * @return string the public label like Foo  | 
                                                        
| 300 | 300 | */  | 
                                                        
| 301 | 301 |  	public function title() { | 
                                                        
| 302 | -		if ( isset( $this->__title ) ) { | 
                                                        |
| 302 | +		if ( isset($this->__title) ) { | 
                                                        |
| 303 | 303 | return $this->__title;  | 
                                                        
| 304 | 304 | }  | 
                                                        
| 305 | 305 | }  | 
                                                        
@@ -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();  | 
                                                        
@@ -77,16 +77,16 @@ discard block  | 
                                                    ||
| 77 | 77 | */  | 
                                                        
| 78 | 78 |  	function __construct($slug = 0) { | 
                                                        
| 79 | 79 | $locations = get_nav_menu_locations();  | 
                                                        
| 80 | -		if ($slug != 0 && is_numeric($slug)) { | 
                                                        |
| 80 | +		if ( $slug != 0 && is_numeric($slug) ) { | 
                                                        |
| 81 | 81 | $menu_id = $slug;  | 
                                                        
| 82 | -		} else if (is_array($locations) && count($locations)) { | 
                                                        |
| 82 | +		} else if ( is_array($locations) && count($locations) ) { | 
                                                        |
| 83 | 83 | $menu_id = $this->get_menu_id_from_locations($slug, $locations);  | 
                                                        
| 84 | -		} else if ($slug === false) { | 
                                                        |
| 84 | +		} else if ( $slug === false ) { | 
                                                        |
| 85 | 85 | $menu_id = false;  | 
                                                        
| 86 | 86 |  		} else { | 
                                                        
| 87 | 87 | $menu_id = $this->get_menu_id_from_terms($slug);  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | -		if ($menu_id) { | 
                                                        |
| 89 | +		if ( $menu_id ) { | 
                                                        |
| 90 | 90 | $this->init($menu_id);  | 
                                                        
| 91 | 91 |  		} else { | 
                                                        
| 92 | 92 | $this->init_as_page_menu();  | 
                                                        
@@ -99,9 +99,9 @@ discard block  | 
                                                    ||
| 99 | 99 | */  | 
                                                        
| 100 | 100 |  	protected function init($menu_id) { | 
                                                        
| 101 | 101 | $menu = wp_get_nav_menu_items($menu_id);  | 
                                                        
| 102 | -		if ($menu) { | 
                                                        |
| 102 | +		if ( $menu ) { | 
                                                        |
| 103 | 103 | _wp_menu_item_classes_by_context($menu);  | 
                                                        
| 104 | -			if (is_array($menu)){ | 
                                                        |
| 104 | +			if ( is_array($menu) ) { | 
                                                        |
| 105 | 105 | $menu = self::order_children($menu);  | 
                                                        
| 106 | 106 | }  | 
                                                        
| 107 | 107 | $this->items = $menu;  | 
                                                        
@@ -118,12 +118,12 @@ discard block  | 
                                                    ||
| 118 | 118 | */  | 
                                                        
| 119 | 119 |  	protected function init_as_page_menu() { | 
                                                        
| 120 | 120 | $menu = get_pages();  | 
                                                        
| 121 | -		if ($menu) { | 
                                                        |
| 122 | -			foreach($menu as $mi) { | 
                                                        |
| 121 | +		if ( $menu ) { | 
                                                        |
| 122 | +			foreach ($menu as $mi) { | 
                                                        |
| 123 | 123 | $mi->__title = $mi->post_title;  | 
                                                        
| 124 | 124 | }  | 
                                                        
| 125 | 125 | _wp_menu_item_classes_by_context($menu);  | 
                                                        
| 126 | -			if (is_array($menu)){ | 
                                                        |
| 126 | +			if ( is_array($menu) ) { | 
                                                        |
| 127 | 127 | $menu = self::order_children($menu);  | 
                                                        
| 128 | 128 | }  | 
                                                        
| 129 | 129 | $this->items = $menu;  | 
                                                        
@@ -137,13 +137,13 @@ discard block  | 
                                                    ||
| 137 | 137 | * @return integer  | 
                                                        
| 138 | 138 | */  | 
                                                        
| 139 | 139 |  	protected function get_menu_id_from_locations($slug, $locations) { | 
                                                        
| 140 | -		if ($slug === 0) { | 
                                                        |
| 140 | +		if ( $slug === 0 ) { | 
                                                        |
| 141 | 141 | $slug = $this->get_menu_id_from_terms($slug);  | 
                                                        
| 142 | 142 | }  | 
                                                        
| 143 | -		if (is_numeric($slug)) { | 
                                                        |
| 143 | +		if ( is_numeric($slug) ) { | 
                                                        |
| 144 | 144 | $slug = array_search($slug, $locations);  | 
                                                        
| 145 | 145 | }  | 
                                                        
| 146 | -		if (isset($locations[$slug])) { | 
                                                        |
| 146 | +		if ( isset($locations[$slug]) ) { | 
                                                        |
| 147 | 147 | return $locations[$slug];  | 
                                                        
| 148 | 148 | }  | 
                                                        
| 149 | 149 | }  | 
                                                        
@@ -154,20 +154,20 @@ discard block  | 
                                                    ||
| 154 | 154 | * @return int  | 
                                                        
| 155 | 155 | */  | 
                                                        
| 156 | 156 |  	protected function get_menu_id_from_terms($slug = 0) { | 
                                                        
| 157 | -		if (!is_numeric($slug) && is_string($slug)) { | 
                                                        |
| 157 | +		if ( !is_numeric($slug) && is_string($slug) ) { | 
                                                        |
| 158 | 158 | //we have a string so lets search for that  | 
                                                        
| 159 | 159 |  			$menu_id = get_term_by('slug', $slug, 'nav_menu'); | 
                                                        
| 160 | -			if ($menu_id) { | 
                                                        |
| 160 | +			if ( $menu_id ) { | 
                                                        |
| 161 | 161 | return $menu_id;  | 
                                                        
| 162 | 162 | }  | 
                                                        
| 163 | 163 |  			$menu_id = get_term_by('name', $slug, 'nav_menu'); | 
                                                        
| 164 | -			if ($menu_id) { | 
                                                        |
| 164 | +			if ( $menu_id ) { | 
                                                        |
| 165 | 165 | return $menu_id;  | 
                                                        
| 166 | 166 | }  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | 168 |  		$menus = get_terms('nav_menu', array('hide_empty' => true)); | 
                                                        
| 169 | -		if (is_array($menus) && count($menus)) { | 
                                                        |
| 170 | -			if (isset($menus[0]->term_id)) { | 
                                                        |
| 169 | +		if ( is_array($menus) && count($menus) ) { | 
                                                        |
| 170 | +			if ( isset($menus[0]->term_id) ) { | 
                                                        |
| 171 | 171 | return $menus[0]->term_id;  | 
                                                        
| 172 | 172 | }  | 
                                                        
| 173 | 173 | }  | 
                                                        
@@ -181,7 +181,7 @@ discard block  | 
                                                    ||
| 181 | 181 | */  | 
                                                        
| 182 | 182 |  	function find_parent_item_in_menu($menu_items, $parent_id) { | 
                                                        
| 183 | 183 |  		foreach ($menu_items as &$item) { | 
                                                        
| 184 | -			if ($item->ID == $parent_id) { | 
                                                        |
| 184 | +			if ( $item->ID == $parent_id ) { | 
                                                        |
| 185 | 185 | return $item;  | 
                                                        
| 186 | 186 | }  | 
                                                        
| 187 | 187 | }  | 
                                                        
@@ -196,25 +196,25 @@ discard block  | 
                                                    ||
| 196 | 196 | $index = array();  | 
                                                        
| 197 | 197 | $menu = array();  | 
                                                        
| 198 | 198 |  		foreach ($items as $item) { | 
                                                        
| 199 | -			if (isset($item->title)) { | 
                                                        |
| 199 | +			if ( isset($item->title) ) { | 
                                                        |
| 200 | 200 | //items from wp can come with a $title property which conflicts with methods  | 
                                                        
| 201 | 201 | $item->__title = $item->title;  | 
                                                        
| 202 | 202 | unset($item->title);  | 
                                                        
| 203 | 203 | }  | 
                                                        
| 204 | -			if(isset($item->ID)){ | 
                                                        |
| 205 | -				if (is_object($item) && get_class($item) == 'WP_Post'){ | 
                                                        |
| 204 | +			if ( isset($item->ID) ) { | 
                                                        |
| 205 | +				if ( is_object($item) && get_class($item) == 'WP_Post' ) { | 
                                                        |
| 206 | 206 | $old_menu_item = $item;  | 
                                                        
| 207 | 207 | $item = new $this->PostClass($item);  | 
                                                        
| 208 | 208 | }  | 
                                                        
| 209 | 209 | $menu_item = new $this->MenuItemClass($item);  | 
                                                        
| 210 | -				if (isset($old_menu_item)){ | 
                                                        |
| 210 | +				if ( isset($old_menu_item) ) { | 
                                                        |
| 211 | 211 | $menu_item->import_classes($old_menu_item);  | 
                                                        
| 212 | 212 | }  | 
                                                        
| 213 | 213 | $index[$item->ID] = $menu_item;  | 
                                                        
| 214 | 214 | }  | 
                                                        
| 215 | 215 | }  | 
                                                        
| 216 | 216 |  		foreach ($index as $item) { | 
                                                        
| 217 | -			if (isset($item->menu_item_parent) && $item->menu_item_parent && isset($index[$item->menu_item_parent])) { | 
                                                        |
| 217 | +			if ( isset($item->menu_item_parent) && $item->menu_item_parent && isset($index[$item->menu_item_parent]) ) { | 
                                                        |
| 218 | 218 | $index[$item->menu_item_parent]->add_child($item);  | 
                                                        
| 219 | 219 |  			} else { | 
                                                        
| 220 | 220 | $menu[] = $item;  | 
                                                        
@@ -227,7 +227,7 @@ discard block  | 
                                                    ||
| 227 | 227 | * @return array  | 
                                                        
| 228 | 228 | */  | 
                                                        
| 229 | 229 |  	function get_items() { | 
                                                        
| 230 | -		if (is_array($this->items)) { | 
                                                        |
| 230 | +		if ( is_array($this->items) ) { | 
                                                        |
| 231 | 231 | return $this->items;  | 
                                                        
| 232 | 232 | }  | 
                                                        
| 233 | 233 | return array();  | 
                                                        
@@ -101,7 +101,7 @@ discard block  | 
                                                    ||
| 101 | 101 | $menu = wp_get_nav_menu_items($menu_id);  | 
                                                        
| 102 | 102 |  		if ($menu) { | 
                                                        
| 103 | 103 | _wp_menu_item_classes_by_context($menu);  | 
                                                        
| 104 | -			if (is_array($menu)){ | 
                                                        |
| 104 | +			if (is_array($menu)) { | 
                                                        |
| 105 | 105 | $menu = self::order_children($menu);  | 
                                                        
| 106 | 106 | }  | 
                                                        
| 107 | 107 | $this->items = $menu;  | 
                                                        
@@ -123,7 +123,7 @@ discard block  | 
                                                    ||
| 123 | 123 | $mi->__title = $mi->post_title;  | 
                                                        
| 124 | 124 | }  | 
                                                        
| 125 | 125 | _wp_menu_item_classes_by_context($menu);  | 
                                                        
| 126 | -			if (is_array($menu)){ | 
                                                        |
| 126 | +			if (is_array($menu)) { | 
                                                        |
| 127 | 127 | $menu = self::order_children($menu);  | 
                                                        
| 128 | 128 | }  | 
                                                        
| 129 | 129 | $this->items = $menu;  | 
                                                        
@@ -201,13 +201,13 @@ discard block  | 
                                                    ||
| 201 | 201 | $item->__title = $item->title;  | 
                                                        
| 202 | 202 | unset($item->title);  | 
                                                        
| 203 | 203 | }  | 
                                                        
| 204 | -			if(isset($item->ID)){ | 
                                                        |
| 205 | -				if (is_object($item) && get_class($item) == 'WP_Post'){ | 
                                                        |
| 204 | +			if(isset($item->ID)) { | 
                                                        |
| 205 | +				if (is_object($item) && get_class($item) == 'WP_Post') { | 
                                                        |
| 206 | 206 | $old_menu_item = $item;  | 
                                                        
| 207 | 207 | $item = new $this->PostClass($item);  | 
                                                        
| 208 | 208 | }  | 
                                                        
| 209 | 209 | $menu_item = new $this->MenuItemClass($item);  | 
                                                        
| 210 | -				if (isset($old_menu_item)){ | 
                                                        |
| 210 | +				if (isset($old_menu_item)) { | 
                                                        |
| 211 | 211 | $menu_item->import_classes($old_menu_item);  | 
                                                        
| 212 | 212 | }  | 
                                                        
| 213 | 213 | $index[$item->ID] = $menu_item;  | 
                                                        
@@ -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();  | 
                                                        
@@ -188,13 +188,13 @@ discard block  | 
                                                    ||
| 188 | 188 | && get_class($wp_query->queried_object) == 'WP_Post'  | 
                                                        
| 189 | 189 |  			) { | 
                                                        
| 190 | 190 | $pid = $wp_query->queried_object_id;  | 
                                                        
| 191 | -		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id )  { | 
                                                        |
| 191 | +		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) { | 
                                                        |
| 192 | 192 | //hack for static page as home page  | 
                                                        
| 193 | 193 | $pid = $wp_query->queried_object_id;  | 
                                                        
| 194 | 194 |  		} else if ( $pid === null ) { | 
                                                        
| 195 | 195 | $gtid = false;  | 
                                                        
| 196 | 196 | $maybe_post = get_post();  | 
                                                        
| 197 | -			if ( isset($maybe_post->ID) ){ | 
                                                        |
| 197 | +			if ( isset($maybe_post->ID) ) { | 
                                                        |
| 198 | 198 | $gtid = true;  | 
                                                        
| 199 | 199 | }  | 
                                                        
| 200 | 200 |  			if ( $gtid ) { | 
                                                        
@@ -1028,7 +1028,7 @@ discard block  | 
                                                    ||
| 1028 | 1028 | $post = $this;  | 
                                                        
| 1029 | 1029 | $class_array = get_post_class($class, $this->ID);  | 
                                                        
| 1030 | 1030 | $post = $old_global_post;  | 
                                                        
| 1031 | -		if ( is_array($class_array) ){ | 
                                                        |
| 1031 | +		if ( is_array($class_array) ) { | 
                                                        |
| 1032 | 1032 |  			return implode(' ', $class_array); | 
                                                        
| 1033 | 1033 | }  | 
                                                        
| 1034 | 1034 | return $class_array;  | 
                                                        
@@ -1248,7 +1248,7 @@ discard block  | 
                                                    ||
| 1248 | 1248 | /**  | 
                                                        
| 1249 | 1249 | * @return string  | 
                                                        
| 1250 | 1250 | */  | 
                                                        
| 1251 | -	public function name(){ | 
                                                        |
| 1251 | +	public function name() { | 
                                                        |
| 1252 | 1252 | return $this->title();  | 
                                                        
| 1253 | 1253 | }  | 
                                                        
| 1254 | 1254 | |
@@ -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 | |
@@ -168,7 +168,7 @@ discard block  | 
                                                    ||
| 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 | |
@@ -188,13 +188,13 @@ discard block  | 
                                                    ||
| 188 | 188 | && get_class($wp_query->queried_object) == 'WP_Post'  | 
                                                        
| 189 | 189 |  			) { | 
                                                        
| 190 | 190 | $pid = $wp_query->queried_object_id;  | 
                                                        
| 191 | -		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id )  { | 
                                                        |
| 191 | +		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) { | 
                                                        |
| 192 | 192 | //hack for static page as home page  | 
                                                        
| 193 | 193 | $pid = $wp_query->queried_object_id;  | 
                                                        
| 194 | 194 |  		} else if ( $pid === null ) { | 
                                                        
| 195 | 195 | $gtid = false;  | 
                                                        
| 196 | 196 | $maybe_post = get_post();  | 
                                                        
| 197 | -			if ( isset($maybe_post->ID) ){ | 
                                                        |
| 197 | +			if ( isset($maybe_post->ID) ) { | 
                                                        |
| 198 | 198 | $gtid = true;  | 
                                                        
| 199 | 199 | }  | 
                                                        
| 200 | 200 |  			if ( $gtid ) { | 
                                                        
@@ -260,7 +260,7 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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);  | 
                                                        
@@ -297,7 +297,7 @@ discard block  | 
                                                    ||
| 297 | 297 | * @internal  | 
                                                        
| 298 | 298 | * @return integer ID number of a post  | 
                                                        
| 299 | 299 | */  | 
                                                        
| 300 | -	protected function check_post_id( $pid ) { | 
                                                        |
| 300 | +	protected function check_post_id($pid) { | 
                                                        |
| 301 | 301 |  		if ( is_numeric($pid) && $pid === 0 ) { | 
                                                        
| 302 | 302 | $pid = get_the_ID();  | 
                                                        
| 303 | 303 | return $pid;  | 
                                                        
@@ -323,7 +323,7 @@ discard block  | 
                                                    ||
| 323 | 323 | global $wpdb;  | 
                                                        
| 324 | 324 |  		$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s LIMIT 1", $post_name); | 
                                                        
| 325 | 325 | $result = $wpdb->get_row($query);  | 
                                                        
| 326 | -		if (!$result) { | 
                                                        |
| 326 | +		if ( !$result ) { | 
                                                        |
| 327 | 327 | return null;  | 
                                                        
| 328 | 328 | }  | 
                                                        
| 329 | 329 | return $result->ID;  | 
                                                        
@@ -362,7 +362,7 @@ discard block  | 
                                                    ||
| 362 | 362 | $text = TimberHelper::trim_words($text, $len, false);  | 
                                                        
| 363 | 363 | $trimmed = true;  | 
                                                        
| 364 | 364 | }  | 
                                                        
| 365 | - $text = do_shortcode( $text );  | 
                                                        |
| 365 | + $text = do_shortcode($text);  | 
                                                        |
| 366 | 366 | }  | 
                                                        
| 367 | 367 |  		if ( !strlen($text) ) { | 
                                                        
| 368 | 368 | $text = TimberHelper::trim_words($this->get_content(), $len, false);  | 
                                                        
@@ -391,11 +391,11 @@ discard block  | 
                                                    ||
| 391 | 391 | }  | 
                                                        
| 392 | 392 |  			$read_more_class = apply_filters('timber/post/get_preview/read_more_class', "read-more"); | 
                                                        
| 393 | 393 |  			if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) { | 
                                                        
| 394 | - $text .= ' <a href="' . $this->get_permalink() . '" class="'.$read_more_class .'">' . trim($readmore_matches[1]) . '</a>';  | 
                                                        |
| 394 | + $text .= ' <a href="' . $this->get_permalink() . '" class="' . $read_more_class . '">' . trim($readmore_matches[1]) . '</a>';  | 
                                                        |
| 395 | 395 |  			} elseif ( $readmore ) { | 
                                                        
| 396 | - $text .= ' <a href="' . $this->get_permalink() . '" class="'.$read_more_class .'">' . trim($readmore) . '</a>';  | 
                                                        |
| 396 | + $text .= ' <a href="' . $this->get_permalink() . '" class="' . $read_more_class . '">' . trim($readmore) . '</a>';  | 
                                                        |
| 397 | 397 | }  | 
                                                        
| 398 | -			if ( !$strip && $last_p_tag && ( strpos($text, '<p>') || strpos($text, '<p ') ) ) { | 
                                                        |
| 398 | +			if ( !$strip && $last_p_tag && (strpos($text, '<p>') || strpos($text, '<p ')) ) { | 
                                                        |
| 399 | 399 | $text .= '</p>';  | 
                                                        
| 400 | 400 | }  | 
                                                        
| 401 | 401 | }  | 
                                                        
@@ -407,7 +407,7 @@ discard block  | 
                                                    ||
| 407 | 407 | * @internal  | 
                                                        
| 408 | 408 | * @param bool|int $pid a post ID number  | 
                                                        
| 409 | 409 | */  | 
                                                        
| 410 | -	function import_custom( $pid = false ) { | 
                                                        |
| 410 | +	function import_custom($pid = false) { | 
                                                        |
| 411 | 411 |  		if ( !$pid ) { | 
                                                        
| 412 | 412 | $pid = $this->ID;  | 
                                                        
| 413 | 413 | }  | 
                                                        
@@ -422,13 +422,13 @@ discard block  | 
                                                    ||
| 422 | 422 | * @param int $pid  | 
                                                        
| 423 | 423 | * @return array  | 
                                                        
| 424 | 424 | */  | 
                                                        
| 425 | -	protected function get_post_custom( $pid ) { | 
                                                        |
| 425 | +	protected function get_post_custom($pid) { | 
                                                        |
| 426 | 426 |  		apply_filters('timber_post_get_meta_pre', array(), $pid, $this); | 
                                                        
| 427 | 427 | $customs = get_post_custom($pid);  | 
                                                        
| 428 | 428 |  		if ( !is_array($customs) || empty($customs) ) { | 
                                                        
| 429 | 429 | return array();  | 
                                                        
| 430 | 430 | }  | 
                                                        
| 431 | -		foreach ( $customs as $key => $value ) { | 
                                                        |
| 431 | +		foreach ($customs as $key => $value) { | 
                                                        |
| 432 | 432 |  			if ( is_array($value) && count($value) == 1 && isset($value[0]) ) { | 
                                                        
| 433 | 433 | $value = $value[0];  | 
                                                        
| 434 | 434 | }  | 
                                                        
@@ -482,7 +482,7 @@ discard block  | 
                                                    ||
| 482 | 482 | * @param bool $taxonomy  | 
                                                        
| 483 | 483 | * @return TimberPost|boolean  | 
                                                        
| 484 | 484 | */  | 
                                                        
| 485 | -	function get_next( $taxonomy = false ) { | 
                                                        |
| 485 | +	function get_next($taxonomy = false) { | 
                                                        |
| 486 | 486 |  		if ( !isset($this->_next) || !isset($this->_next[$taxonomy]) ) { | 
                                                        
| 487 | 487 | global $post;  | 
                                                        
| 488 | 488 | $this->_next = array();  | 
                                                        
@@ -513,7 +513,7 @@ discard block  | 
                                                    ||
| 513 | 513 | $post = $this;  | 
                                                        
| 514 | 514 | $ret = array();  | 
                                                        
| 515 | 515 |  		if ( $multipage ) { | 
                                                        
| 516 | -			for ( $i = 1; $i <= $numpages; $i++ ) { | 
                                                        |
| 516 | +			for ($i = 1; $i <= $numpages; $i++) { | 
                                                        |
| 517 | 517 | $link = self::get_wp_link_page($i);  | 
                                                        
| 518 | 518 |  				$data = array('name' => $i, 'title' => $i, 'text' => $i, 'link' => $link); | 
                                                        
| 519 | 519 |  				if ( $i == $page ) { | 
                                                        
@@ -565,7 +565,7 @@ discard block  | 
                                                    ||
| 565 | 565 | * @param bool $taxonomy  | 
                                                        
| 566 | 566 | * @return TimberPost|boolean  | 
                                                        
| 567 | 567 | */  | 
                                                        
| 568 | -	function get_prev( $taxonomy = false ) { | 
                                                        |
| 568 | +	function get_prev($taxonomy = false) { | 
                                                        |
| 569 | 569 |  		if ( isset($this->_prev) && isset($this->_prev[$taxonomy]) ) { | 
                                                        
| 570 | 570 | return $this->_prev[$taxonomy];  | 
                                                        
| 571 | 571 | }  | 
                                                        
@@ -632,7 +632,7 @@ discard block  | 
                                                    ||
| 632 | 632 | $post->slug = $post->post_name;  | 
                                                        
| 633 | 633 | $customs = $this->get_post_custom($post->ID);  | 
                                                        
| 634 | 634 | $post->custom = $customs;  | 
                                                        
| 635 | - $post = (object) array_merge((array)$customs, (array)$post);  | 
                                                        |
| 635 | + $post = (object) array_merge((array) $customs, (array) $post);  | 
                                                        |
| 636 | 636 | return $post;  | 
                                                        
| 637 | 637 | }  | 
                                                        
| 638 | 638 | |
@@ -643,7 +643,7 @@ discard block  | 
                                                    ||
| 643 | 643 | * @param string $use  | 
                                                        
| 644 | 644 | * @return string  | 
                                                        
| 645 | 645 | */  | 
                                                        
| 646 | -	function get_display_date( $use = 'post_date' ) { | 
                                                        |
| 646 | +	function get_display_date($use = 'post_date') { | 
                                                        |
| 647 | 647 |  		return date(get_option('date_format'), strtotime($this->$use)); | 
                                                        
| 648 | 648 | }  | 
                                                        
| 649 | 649 | |
@@ -653,9 +653,9 @@ discard block  | 
                                                    ||
| 653 | 653 | * @param string $date_format  | 
                                                        
| 654 | 654 | * @return string  | 
                                                        
| 655 | 655 | */  | 
                                                        
| 656 | -	function get_date( $date_format = '' ) { | 
                                                        |
| 656 | +	function get_date($date_format = '') { | 
                                                        |
| 657 | 657 |  		$df = $date_format ? $date_format : get_option('date_format'); | 
                                                        
| 658 | - $the_date = (string)mysql2date($df, $this->post_date);  | 
                                                        |
| 658 | + $the_date = (string) mysql2date($df, $this->post_date);  | 
                                                        |
| 659 | 659 |  		return apply_filters('get_the_date', $the_date, $df); | 
                                                        
| 660 | 660 | }  | 
                                                        
| 661 | 661 | |
@@ -664,7 +664,7 @@ discard block  | 
                                                    ||
| 664 | 664 | * @param string $date_format  | 
                                                        
| 665 | 665 | * @return string  | 
                                                        
| 666 | 666 | */  | 
                                                        
| 667 | -	function get_modified_date( $date_format = '' ) { | 
                                                        |
| 667 | +	function get_modified_date($date_format = '') { | 
                                                        |
| 668 | 668 |  		$df = $date_format ? $date_format : get_option('date_format'); | 
                                                        
| 669 | 669 | $the_time = $this->get_modified_time($df);  | 
                                                        
| 670 | 670 |  		return apply_filters('get_the_modified_date', $the_time, $date_format); | 
                                                        
@@ -675,7 +675,7 @@ discard block  | 
                                                    ||
| 675 | 675 | * @param string $time_format  | 
                                                        
| 676 | 676 | * @return string  | 
                                                        
| 677 | 677 | */  | 
                                                        
| 678 | -	function get_modified_time( $time_format = '' ) { | 
                                                        |
| 678 | +	function get_modified_time($time_format = '') { | 
                                                        |
| 679 | 679 |  		$tf = $time_format ? $time_format : get_option('time_format'); | 
                                                        
| 680 | 680 | $the_time = get_post_modified_time($tf, false, $this->ID, true);  | 
                                                        
| 681 | 681 |  		return apply_filters('get_the_modified_time', $the_time, $time_format); | 
                                                        
@@ -688,7 +688,7 @@ discard block  | 
                                                    ||
| 688 | 688 | * @param bool|string $childPostClass  | 
                                                        
| 689 | 689 | * @return array  | 
                                                        
| 690 | 690 | */  | 
                                                        
| 691 | -	function get_children( $post_type = 'any', $childPostClass = false ) { | 
                                                        |
| 691 | +	function get_children($post_type = 'any', $childPostClass = false) { | 
                                                        |
| 692 | 692 |  		if ( $childPostClass === false ) { | 
                                                        
| 693 | 693 | $childPostClass = $this->PostClass;  | 
                                                        
| 694 | 694 | }  | 
                                                        
@@ -696,7 +696,7 @@ discard block  | 
                                                    ||
| 696 | 696 | $post_type = $this->post_type;  | 
                                                        
| 697 | 697 | }  | 
                                                        
| 698 | 698 |  		$children = get_children('post_parent=' . $this->ID . '&post_type=' . $post_type . '&numberposts=-1&orderby=menu_order title&order=ASC'); | 
                                                        
| 699 | -		foreach ( $children as &$child ) { | 
                                                        |
| 699 | +		foreach ($children as &$child) { | 
                                                        |
| 700 | 700 | $child = new $childPostClass($child->ID);  | 
                                                        
| 701 | 701 | }  | 
                                                        
| 702 | 702 | $children = array_values($children);  | 
                                                        
@@ -732,20 +732,20 @@ discard block  | 
                                                    ||
| 732 | 732 | }  | 
                                                        
| 733 | 733 | |
| 734 | 734 |  		if ( $user_ID ) { | 
                                                        
| 735 | - $args['include_unapproved'] = array( $user_ID );  | 
                                                        |
| 736 | -		} elseif ( ! empty( $comment_author_email ) ) { | 
                                                        |
| 737 | - $args['include_unapproved'] = array( $comment_author_email );  | 
                                                        |
| 735 | + $args['include_unapproved'] = array($user_ID);  | 
                                                        |
| 736 | +		} elseif ( !empty($comment_author_email) ) { | 
                                                        |
| 737 | + $args['include_unapproved'] = array($comment_author_email);  | 
                                                        |
| 738 | 738 | }  | 
                                                        
| 739 | 739 | |
| 740 | 740 | $comments = get_comments($args);  | 
                                                        
| 741 | 741 | $timber_comments = array();  | 
                                                        
| 742 | 742 | |
| 743 | 743 |  		if ( '' == get_query_var('cpage') && get_option('page_comments') ) { | 
                                                        
| 744 | -			set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 ); | 
                                                        |
| 744 | +			set_query_var('cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1); | 
                                                        |
| 745 | 745 | $overridden_cpage = true;  | 
                                                        
| 746 | 746 | }  | 
                                                        
| 747 | 747 | |
| 748 | -    foreach($comments as $key => &$comment) { | 
                                                        |
| 748 | +    foreach ($comments as $key => &$comment) { | 
                                                        |
| 749 | 749 | $timber_comment = new $CommentClass($comment);  | 
                                                        
| 750 | 750 | $timber_comment->reply_link = $this->TimberComment_reply_link($comment->comment_ID, $this->ID);  | 
                                                        
| 751 | 751 | $timber_comments[$timber_comment->id] = $timber_comment;  | 
                                                        
@@ -753,21 +753,21 @@ discard block  | 
                                                    ||
| 753 | 753 | |
| 754 | 754 | // Build a flattened (depth=1) comment tree  | 
                                                        
| 755 | 755 | $comments_tree = array();  | 
                                                        
| 756 | -    foreach( $timber_comments as $key => $comment ) { | 
                                                        |
| 757 | -      if ( ! $comment->is_child() ) { | 
                                                        |
| 756 | +    foreach ($timber_comments as $key => $comment) { | 
                                                        |
| 757 | +      if ( !$comment->is_child() ) { | 
                                                        |
| 758 | 758 | continue;  | 
                                                        
| 759 | 759 | }  | 
                                                        
| 760 | 760 | |
| 761 | 761 | $tree_element = $comment;  | 
                                                        
| 762 | 762 |        do { | 
                                                        
| 763 | 763 | $tree_element = $timber_comments[$tree_element->comment_parent];  | 
                                                        
| 764 | - } while($tree_element->is_child());  | 
                                                        |
| 764 | + } while ($tree_element->is_child());  | 
                                                        |
| 765 | 765 | $comments_tree[$tree_element->id][] = $comment->id;  | 
                                                        
| 766 | 766 | }  | 
                                                        
| 767 | 767 | |
| 768 | 768 | // Add child comments to the relative "super parents"  | 
                                                        
| 769 | -    foreach($comments_tree as $comment_parent => $comment_children) { | 
                                                        |
| 770 | -      foreach($comment_children as $comment_child) { | 
                                                        |
| 769 | +    foreach ($comments_tree as $comment_parent => $comment_children) { | 
                                                        |
| 770 | +      foreach ($comment_children as $comment_child) { | 
                                                        |
| 771 | 771 | $timber_comments[$comment_parent]->children[] = $timber_comments[$comment_child];  | 
                                                        
| 772 | 772 | unset($timber_comments[$comment_child]);  | 
                                                        
| 773 | 773 | }  | 
                                                        
@@ -807,7 +807,7 @@ discard block  | 
                                                    ||
| 807 | 807 | * @param string $TermClass  | 
                                                        
| 808 | 808 | * @return array  | 
                                                        
| 809 | 809 | */  | 
                                                        
| 810 | -	function get_terms( $tax = '', $merge = true, $TermClass = '' ) { | 
                                                        |
| 810 | +	function get_terms($tax = '', $merge = true, $TermClass = '') { | 
                                                        |
| 811 | 811 | |
| 812 | 812 | $TermClass = $TermClass ?: $this->TermClass;  | 
                                                        
| 813 | 813 | |
@@ -818,7 +818,7 @@ discard block  | 
                                                    ||
| 818 | 818 | $taxonomies = $tax;  | 
                                                        
| 819 | 819 | }  | 
                                                        
| 820 | 820 |  		if ( is_string($tax) ) { | 
                                                        
| 821 | -			if ( in_array($tax, array('all','any','')) ) { | 
                                                        |
| 821 | +			if ( in_array($tax, array('all', 'any', '')) ) { | 
                                                        |
| 822 | 822 | $taxonomies = get_object_taxonomies($this->post_type);  | 
                                                        
| 823 | 823 |  			} else { | 
                                                        
| 824 | 824 | $taxonomies = array($tax);  | 
                                                        
@@ -827,8 +827,8 @@ discard block  | 
                                                    ||
| 827 | 827 | |
| 828 | 828 | $term_class_objects = array();  | 
                                                        
| 829 | 829 | |
| 830 | -		foreach ( $taxonomies as $taxonomy ) { | 
                                                        |
| 831 | -			if ( in_array($taxonomy, array('tag','tags')) ) { | 
                                                        |
| 830 | +		foreach ($taxonomies as $taxonomy) { | 
                                                        |
| 831 | +			if ( in_array($taxonomy, array('tag', 'tags')) ) { | 
                                                        |
| 832 | 832 | $taxonomy = 'post_tag';  | 
                                                        
| 833 | 833 | }  | 
                                                        
| 834 | 834 |  			if ( $taxonomy == 'categories' ) { | 
                                                        
@@ -865,11 +865,11 @@ discard block  | 
                                                    ||
| 865 | 865 | * @param string $taxonomy  | 
                                                        
| 866 | 866 | * @return bool  | 
                                                        
| 867 | 867 | */  | 
                                                        
| 868 | -	function has_term( $term_name_or_id, $taxonomy = 'all' ) { | 
                                                        |
| 868 | +	function has_term($term_name_or_id, $taxonomy = 'all') { | 
                                                        |
| 869 | 869 |  		if ( $taxonomy == 'all' || $taxonomy == 'any' ) { | 
                                                        
| 870 | 870 | $taxes = get_object_taxonomies($this->post_type, 'names');  | 
                                                        
| 871 | 871 | $ret = false;  | 
                                                        
| 872 | -			foreach ( $taxes as $tax ) { | 
                                                        |
| 872 | +			foreach ($taxes as $tax) { | 
                                                        |
| 873 | 873 |  				if ( has_term($term_name_or_id, $tax, $this->ID) ) { | 
                                                        
| 874 | 874 | $ret = true;  | 
                                                        
| 875 | 875 | break;  | 
                                                        
@@ -884,7 +884,7 @@ discard block  | 
                                                    ||
| 884 | 884 | * @param string $field  | 
                                                        
| 885 | 885 | * @return TimberImage  | 
                                                        
| 886 | 886 | */  | 
                                                        
| 887 | -	function get_image( $field ) { | 
                                                        |
| 887 | +	function get_image($field) { | 
                                                        |
| 888 | 888 | return new $this->ImageClass($this->$field);  | 
                                                        
| 889 | 889 | }  | 
                                                        
| 890 | 890 | |
@@ -934,7 +934,7 @@ discard block  | 
                                                    ||
| 934 | 934 | * @param int $page  | 
                                                        
| 935 | 935 | * @return string  | 
                                                        
| 936 | 936 | */  | 
                                                        
| 937 | -	function get_content( $len = 0, $page = 0 ) { | 
                                                        |
| 937 | +	function get_content($len = 0, $page = 0) { | 
                                                        |
| 938 | 938 |  		if ( $len == 0 && $page == 0 && $this->_content ) { | 
                                                        
| 939 | 939 | return $this->_content;  | 
                                                        
| 940 | 940 | }  | 
                                                        
@@ -994,7 +994,7 @@ discard block  | 
                                                    ||
| 994 | 994 | * @param string $field_name  | 
                                                        
| 995 | 995 | * @return mixed  | 
                                                        
| 996 | 996 | */  | 
                                                        
| 997 | -	public function get_field( $field_name ) { | 
                                                        |
| 997 | +	public function get_field($field_name) { | 
                                                        |
| 998 | 998 |  		$value = apply_filters('timber_post_get_meta_field_pre', null, $this->ID, $field_name, $this); | 
                                                        
| 999 | 999 |  		if ( $value === null ) { | 
                                                        
| 1000 | 1000 | $value = get_post_meta($this->ID, $field_name);  | 
                                                        
@@ -1012,7 +1012,7 @@ discard block  | 
                                                    ||
| 1012 | 1012 | /**  | 
                                                        
| 1013 | 1013 | * @param string $field_name  | 
                                                        
| 1014 | 1014 | */  | 
                                                        
| 1015 | -	function import_field( $field_name ) { | 
                                                        |
| 1015 | +	function import_field($field_name) { | 
                                                        |
| 1016 | 1016 | $this->$field_name = $this->get_field($field_name);  | 
                                                        
| 1017 | 1017 | }  | 
                                                        
| 1018 | 1018 | |
@@ -1043,13 +1043,13 @@ discard block  | 
                                                    ||
| 1043 | 1043 | * ```  | 
                                                        
| 1044 | 1044 | * @return string a space-seperated list of classes  | 
                                                        
| 1045 | 1045 | */  | 
                                                        
| 1046 | -	public function post_class( $class='' ) { | 
                                                        |
| 1046 | +	public function post_class($class = '') { | 
                                                        |
| 1047 | 1047 | global $post;  | 
                                                        
| 1048 | 1048 | $old_global_post = $post;  | 
                                                        
| 1049 | 1049 | $post = $this;  | 
                                                        
| 1050 | 1050 | $class_array = get_post_class($class, $this->ID);  | 
                                                        
| 1051 | 1051 | $post = $old_global_post;  | 
                                                        
| 1052 | -		if ( is_array($class_array) ){ | 
                                                        |
| 1052 | +		if ( is_array($class_array) ) { | 
                                                        |
| 1053 | 1053 |  			return implode(' ', $class_array); | 
                                                        
| 1054 | 1054 | }  | 
                                                        
| 1055 | 1055 | return $class_array;  | 
                                                        
@@ -1151,8 +1151,8 @@ discard block  | 
                                                    ||
| 1151 | 1151 | * @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.  | 
                                                        
| 1152 | 1152 | * @return array  | 
                                                        
| 1153 | 1153 | */  | 
                                                        
| 1154 | -	public function children( $post_type = 'any', $childPostClass = false ) { | 
                                                        |
| 1155 | - return $this->get_children( $post_type, $childPostClass );  | 
                                                        |
| 1154 | +	public function children($post_type = 'any', $childPostClass = false) { | 
                                                        |
| 1155 | + return $this->get_children($post_type, $childPostClass);  | 
                                                        |
| 1156 | 1156 | }  | 
                                                        
| 1157 | 1157 | |
| 1158 | 1158 | /**  | 
                                                        
@@ -1176,7 +1176,7 @@ discard block  | 
                                                    ||
| 1176 | 1176 | * ```  | 
                                                        
| 1177 | 1177 | * @return bool|array  | 
                                                        
| 1178 | 1178 | */  | 
                                                        
| 1179 | -	public function comments( $count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment' ) { | 
                                                        |
| 1179 | +	public function comments($count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment') { | 
                                                        |
| 1180 | 1180 | return $this->get_comments($count, $order, $type, $status, $CommentClass);  | 
                                                        
| 1181 | 1181 | }  | 
                                                        
| 1182 | 1182 | |
@@ -1193,7 +1193,7 @@ discard block  | 
                                                    ||
| 1193 | 1193 | * @param int $page  | 
                                                        
| 1194 | 1194 | * @return string  | 
                                                        
| 1195 | 1195 | */  | 
                                                        
| 1196 | -	public function content( $page = 0 ) { | 
                                                        |
| 1196 | +	public function content($page = 0) { | 
                                                        |
| 1197 | 1197 | return $this->get_content(0, $page);  | 
                                                        
| 1198 | 1198 | }  | 
                                                        
| 1199 | 1199 | |
@@ -1222,7 +1222,7 @@ discard block  | 
                                                    ||
| 1222 | 1222 | * @param string $date_format  | 
                                                        
| 1223 | 1223 | * @return string  | 
                                                        
| 1224 | 1224 | */  | 
                                                        
| 1225 | -	public function date( $date_format = '' ) { | 
                                                        |
| 1225 | +	public function date($date_format = '') { | 
                                                        |
| 1226 | 1226 | return $this->get_date($date_format);  | 
                                                        
| 1227 | 1227 | }  | 
                                                        
| 1228 | 1228 | |
@@ -1244,9 +1244,9 @@ discard block  | 
                                                    ||
| 1244 | 1244 | * @param string $time_format  | 
                                                        
| 1245 | 1245 | * @return string  | 
                                                        
| 1246 | 1246 | */  | 
                                                        
| 1247 | -	public function time( $time_format = '' ) { | 
                                                        |
| 1247 | +	public function time($time_format = '') { | 
                                                        |
| 1248 | 1248 |  		$tf = $time_format ? $time_format : get_option('time_format'); | 
                                                        
| 1249 | - $the_time = (string)mysql2date($tf, $this->post_date);  | 
                                                        |
| 1249 | + $the_time = (string) mysql2date($tf, $this->post_date);  | 
                                                        |
| 1250 | 1250 |  	 	return apply_filters('get_the_time', $the_time, $tf); | 
                                                        
| 1251 | 1251 | }  | 
                                                        
| 1252 | 1252 | |
@@ -1282,7 +1282,7 @@ discard block  | 
                                                    ||
| 1282 | 1282 | * @param string $field_name  | 
                                                        
| 1283 | 1283 | * @return mixed  | 
                                                        
| 1284 | 1284 | */  | 
                                                        
| 1285 | -	public function meta( $field_name = null ) { | 
                                                        |
| 1285 | +	public function meta($field_name = null) { | 
                                                        |
| 1286 | 1286 |  		if ( $field_name === null ) { | 
                                                        
| 1287 | 1287 | //on the off-chance the field is actually named meta  | 
                                                        
| 1288 | 1288 | $field_name = 'meta';  | 
                                                        
@@ -1293,7 +1293,7 @@ discard block  | 
                                                    ||
| 1293 | 1293 | /**  | 
                                                        
| 1294 | 1294 | * @return string  | 
                                                        
| 1295 | 1295 | */  | 
                                                        
| 1296 | -	public function name(){ | 
                                                        |
| 1296 | +	public function name() { | 
                                                        |
| 1297 | 1297 | return $this->title();  | 
                                                        
| 1298 | 1298 | }  | 
                                                        
| 1299 | 1299 | |
@@ -1301,7 +1301,7 @@ discard block  | 
                                                    ||
| 1301 | 1301 | * @param string $date_format  | 
                                                        
| 1302 | 1302 | * @return string  | 
                                                        
| 1303 | 1303 | */  | 
                                                        
| 1304 | -	public function modified_date( $date_format = '' ) { | 
                                                        |
| 1304 | +	public function modified_date($date_format = '') { | 
                                                        |
| 1305 | 1305 | return $this->get_modified_date($date_format);  | 
                                                        
| 1306 | 1306 | }  | 
                                                        
| 1307 | 1307 | |
@@ -1309,7 +1309,7 @@ discard block  | 
                                                    ||
| 1309 | 1309 | * @param string $time_format  | 
                                                        
| 1310 | 1310 | * @return string  | 
                                                        
| 1311 | 1311 | */  | 
                                                        
| 1312 | -	public function modified_time( $time_format = '' ) { | 
                                                        |
| 1312 | +	public function modified_time($time_format = '') { | 
                                                        |
| 1313 | 1313 | return $this->get_modified_time($time_format);  | 
                                                        
| 1314 | 1314 | }  | 
                                                        
| 1315 | 1315 | |
@@ -1318,7 +1318,7 @@ discard block  | 
                                                    ||
| 1318 | 1318 | * @param bool $in_same_cat  | 
                                                        
| 1319 | 1319 | * @return mixed  | 
                                                        
| 1320 | 1320 | */  | 
                                                        
| 1321 | -	public function next( $in_same_cat = false ) { | 
                                                        |
| 1321 | +	public function next($in_same_cat = false) { | 
                                                        |
| 1322 | 1322 | return $this->get_next($in_same_cat);  | 
                                                        
| 1323 | 1323 | }  | 
                                                        
| 1324 | 1324 | |
@@ -1376,7 +1376,7 @@ discard block  | 
                                                    ||
| 1376 | 1376 | * @param bool $in_same_cat  | 
                                                        
| 1377 | 1377 | * @return mixed  | 
                                                        
| 1378 | 1378 | */  | 
                                                        
| 1379 | -	public function prev( $in_same_cat = false ) { | 
                                                        |
| 1379 | +	public function prev($in_same_cat = false) { | 
                                                        |
| 1380 | 1380 | return $this->get_prev($in_same_cat);  | 
                                                        
| 1381 | 1381 | }  | 
                                                        
| 1382 | 1382 | |
@@ -1388,7 +1388,7 @@ discard block  | 
                                                    ||
| 1388 | 1388 | * @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)?  | 
                                                        
| 1389 | 1389 | * @return array  | 
                                                        
| 1390 | 1390 | */  | 
                                                        
| 1391 | -	public function terms( $tax = '', $merge = true ) { | 
                                                        |
| 1391 | +	public function terms($tax = '', $merge = true) { | 
                                                        |
| 1392 | 1392 | return $this->get_terms($tax, $merge);  | 
                                                        
| 1393 | 1393 | }  | 
                                                        
| 1394 | 1394 | |