@@ -21,6 +21,6 @@ |
||
21 | 21 | */ |
22 | 22 | foreach ( $dirs as $dir ){ |
23 | 23 | foreach ( glob( plugin_dir_path( __FILE__ ) . "/$dir/*.php", GLOB_NOSORT ) as $filename ){ |
24 | - require_once $filename; |
|
24 | + require_once $filename; |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -252,29 +252,29 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | // Download the file |
255 | - $tmp = \download_url( $url ); |
|
255 | + $tmp = \download_url( $url ); |
|
256 | 256 | |
257 | - preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches ); |
|
257 | + preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches ); |
|
258 | 258 | |
259 | - $file_array['name'] = basename( $matches[0] ); |
|
260 | - $file_array['tmp_name'] = $tmp; |
|
259 | + $file_array['name'] = basename( $matches[0] ); |
|
260 | + $file_array['tmp_name'] = $tmp; |
|
261 | 261 | |
262 | - // Check for download errors |
|
263 | - if ( is_wp_error( $tmp ) ) { |
|
264 | - unlink( $file_array[ 'tmp_name' ] ); |
|
265 | - return $tmp->get_error_message(); |
|
266 | - } |
|
262 | + // Check for download errors |
|
263 | + if ( is_wp_error( $tmp ) ) { |
|
264 | + unlink( $file_array[ 'tmp_name' ] ); |
|
265 | + return $tmp->get_error_message(); |
|
266 | + } |
|
267 | 267 | |
268 | 268 | // Pull the image into the media library |
269 | - $image_id = media_handle_sideload( $file_array, $post_id ); |
|
269 | + $image_id = media_handle_sideload( $file_array, $post_id ); |
|
270 | 270 | |
271 | - // Check for handle sideload errors. |
|
272 | - if ( is_wp_error( $image_id ) ) { |
|
273 | - unlink( $file_array['tmp_name'] ); |
|
274 | - return $image_id->get_error_message(); |
|
275 | - } |
|
271 | + // Check for handle sideload errors. |
|
272 | + if ( is_wp_error( $image_id ) ) { |
|
273 | + unlink( $file_array['tmp_name'] ); |
|
274 | + return $image_id->get_error_message(); |
|
275 | + } |
|
276 | 276 | |
277 | - return $image_id; |
|
277 | + return $image_id; |
|
278 | 278 | |
279 | 279 | } |
280 | 280 | |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | |
298 | 298 | // If our cURL failed |
299 | 299 | if ( $curl_response === false ) { |
300 | - $info = curl_getinfo( $curl ); |
|
301 | - curl_close( $curl ); |
|
302 | - die( 'error occured during curl exec. Additional info: ' . var_export( $info ) ); |
|
300 | + $info = curl_getinfo( $curl ); |
|
301 | + curl_close( $curl ); |
|
302 | + die( 'error occured during curl exec. Additional info: ' . var_export( $info ) ); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | curl_close( $curl ); |