Changeset 682155
- Timestamp:
- 03/15/2013 05:45:40 AM (13 years ago)
- Location:
- wp-smushit/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
wp-smushit.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-smushit/trunk/readme.txt
r680988 r682155 61 61 62 62 == Changelog == 63 64 = 1.6.3 = 65 * attempt to smush more than one image before bailing (kind thanks to <a href="http://wordpress.org/support/profile/xrampage16">xrampage16</a>) 63 66 64 67 = 1.6.2 = -
wp-smushit/trunk/wp-smushit.php
r680986 r682155 63 63 @ini_set('zlib.output_compression', 0); 64 64 @ini_set('implicit_flush', 1); 65 65 66 66 $attachments = null; 67 67 $auto_start = false; 68 68 69 69 if ( isset($_REQUEST['ids'])) { 70 70 $attachments = get_posts( array( … … 82 82 )); 83 83 } 84 84 85 85 86 86 require( dirname(__FILE__) . '/bulk.php' ); … … 127 127 128 128 // canonicalize path - disabled 2011-02-1 troubleshooting 'Could not find...' errors. 129 // From the PHP docs: "The running script must have executable permissions on 129 // From the PHP docs: "The running script must have executable permissions on 130 130 // all directories in the hierarchy, otherwise realpath() will return FALSE." 131 131 // $file_path = realpath($file); 132 132 133 133 $file_path = $file; 134 134 // check that the file exists … … 221 221 return TRUE; 222 222 } 223 223 224 224 if ( stripos($previous_status, 'no savings') !== FALSE || stripos($previous_status, 'reduced') !== FALSE ) { 225 225 return FALSE; … … 294 294 295 295 $data = false; 296 296 297 297 if ( function_exists('wp_remote_get') ) { 298 $response = wp_remote_get($req, array('user-agent' => WP_SMUSHIT_UA, 'timeout' => 20)); 299 300 if( is_wp_error( $response ) ) { 301 wp_smushit_temporarily_disable(); 302 $msg = 'Automatic smushing has been disabled temporarily due to an error. ' . $response->get_error_message(); 303 wp_die( $msg ); 304 } 305 306 $data = wp_remote_retrieve_body($response); 298 $count = 0; 299 $finished = FALSE; 300 do { 301 $response = wp_remote_get($req, array('user-agent' => WP_SMUSHIT_UA, 'timeout' => 20)); 302 if ( is_wp_error( $response ) ) { 303 $count++; 304 } else { 305 $finished = TRUE; 306 } 307 if ($count == 3) { 308 //$msg = 'Automatic smushing has been disabled temporarily due to an error. ' . $response->get_error_message() .' - url | '. $file_url; 309 //wp_die( $msg ); 310 $response = FALSE; 311 $finished = TRUE; 312 } 313 } while (!$finished); 314 315 if ( !$response ) { 316 $data = FALSE; 317 } else { 318 $data = wp_remote_retrieve_body($response); 319 } 307 320 } else { 308 321 wp_die( __('WP Smush.it requires WordPress 2.8 or greater', WP_SMUSHIT_DOMAIN) ); 309 322 } 310 323 311 324 return $data; 312 325 }
Note: See TracChangeset
for help on using the changeset viewer.