@@ -150,27 +150,27 @@ discard block |
||
| 150 | 150 | * @internal |
| 151 | 151 | * @param int $iid the id number of the image in the WP database |
| 152 | 152 | */ |
| 153 | - protected function get_image_info( $iid ) { |
|
| 153 | + protected function get_image_info($iid) { |
|
| 154 | 154 | $image_info = $iid; |
| 155 | - if (is_numeric($iid)) { |
|
| 155 | + if ( is_numeric($iid) ) { |
|
| 156 | 156 | $image_info = wp_get_attachment_metadata($iid); |
| 157 | - if (!is_array($image_info)) { |
|
| 157 | + if ( !is_array($image_info) ) { |
|
| 158 | 158 | $image_info = array(); |
| 159 | 159 | } |
| 160 | 160 | $image_custom = get_post_custom($iid); |
| 161 | 161 | $basic = get_post($iid); |
| 162 | - if ($basic) { |
|
| 163 | - if (isset($basic->post_excerpt)) { |
|
| 162 | + if ( $basic ) { |
|
| 163 | + if ( isset($basic->post_excerpt) ) { |
|
| 164 | 164 | $this->caption = $basic->post_excerpt; |
| 165 | 165 | } |
| 166 | 166 | $image_custom = array_merge($image_custom, get_object_vars($basic)); |
| 167 | 167 | } |
| 168 | 168 | return array_merge($image_info, $image_custom); |
| 169 | 169 | } |
| 170 | - if (is_array($image_info) && isset($image_info['image'])) { |
|
| 170 | + if ( is_array($image_info) && isset($image_info['image']) ) { |
|
| 171 | 171 | return $image_info['image']; |
| 172 | 172 | } |
| 173 | - if (is_object($image_info)) { |
|
| 173 | + if ( is_object($image_info) ) { |
|
| 174 | 174 | return get_object_vars($image_info); |
| 175 | 175 | } |
| 176 | 176 | return $iid; |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | * @internal |
| 203 | 203 | * @param int $iid |
| 204 | 204 | */ |
| 205 | - function init( $iid = false ) { |
|
| 206 | - if ( !is_numeric( $iid ) && is_string( $iid ) ) { |
|
| 207 | - if (strstr($iid, '://')) { |
|
| 205 | + function init($iid = false) { |
|
| 206 | + if ( !is_numeric($iid) && is_string($iid) ) { |
|
| 207 | + if ( strstr($iid, '://') ) { |
|
| 208 | 208 | $this->init_with_url($iid); |
| 209 | 209 | return; |
| 210 | 210 | } |
@@ -215,15 +215,15 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $relative = false; |
| 217 | 217 | $iid_lower = strtolower($iid); |
| 218 | - foreach( $this->file_types as $type ) { if( strstr( $iid_lower, $type ) ) { $relative = true; break; } }; |
|
| 218 | + foreach ($this->file_types as $type) { if ( strstr($iid_lower, $type) ) { $relative = true; break; } }; |
|
| 219 | 219 | if ( $relative ) { |
| 220 | - $this->init_with_relative_path( $iid ); |
|
| 220 | + $this->init_with_relative_path($iid); |
|
| 221 | 221 | return; |
| 222 | 222 | } |
| 223 | 223 | } else if ( $iid instanceof WP_Post ) { |
| 224 | 224 | $ref = new ReflectionClass($this); |
| 225 | 225 | $post = $ref->getParentClass()->newInstance($iid->ID); |
| 226 | - if (isset($post->_thumbnail_id) && $post->_thumbnail_id) { |
|
| 226 | + if ( isset($post->_thumbnail_id) && $post->_thumbnail_id ) { |
|
| 227 | 227 | return $this->init((int) $post->_thumbnail_id); |
| 228 | 228 | } |
| 229 | 229 | return $this->init($post->ID); |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | * @internal |
| 266 | 266 | * @param string $relative_path |
| 267 | 267 | */ |
| 268 | - protected function init_with_relative_path( $relative_path ) { |
|
| 269 | - $this->abs_url = home_url( $relative_path ); |
|
| 270 | - $file_path = TimberURLHelper::get_full_path( $relative_path ); |
|
| 268 | + protected function init_with_relative_path($relative_path) { |
|
| 269 | + $this->abs_url = home_url($relative_path); |
|
| 270 | + $file_path = TimberURLHelper::get_full_path($relative_path); |
|
| 271 | 271 | $this->file_loc = $file_path; |
| 272 | 272 | $this->file = $file_path; |
| 273 | 273 | } |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | * @internal |
| 277 | 277 | * @param string $file_path |
| 278 | 278 | */ |
| 279 | - protected function init_with_file_path( $file_path ) { |
|
| 280 | - $url = TimberURLHelper::file_system_to_url( $file_path ); |
|
| 279 | + protected function init_with_file_path($file_path) { |
|
| 280 | + $url = TimberURLHelper::file_system_to_url($file_path); |
|
| 281 | 281 | $this->abs_url = $url; |
| 282 | 282 | $this->file_loc = $file_path; |
| 283 | 283 | $this->file = $file_path; |
@@ -476,8 +476,8 @@ discard block |
||
| 476 | 476 | * @param string $size |
| 477 | 477 | * @return bool|string |
| 478 | 478 | */ |
| 479 | - function get_src( $size = '' ) { |
|
| 480 | - return $this->src( $size ); |
|
| 479 | + function get_src($size = '') { |
|
| 480 | + return $this->src($size); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |