Changeset 2936 for trunk/wp-admin/image-uploading.php
- Timestamp:
- 10/06/2005 12:44:04 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/image-uploading.php
r2929 r2936 4 4 5 5 if (!current_user_can('edit_posts')) 6 die( 'You do not have permission to edit posts.');6 die(__('You do not have permission to edit posts.')); 7 7 8 8 $wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object'); … … 50 50 // Define the error messages for bad uploads. 51 51 $upload_err = array(false, 52 "The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>.",53 "The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form.",54 "The uploaded file was only partially uploaded.",55 "No file was uploaded.",56 "Missing a temporary folder.",57 "Failed to write file to disk.");52 __("The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>."), 53 __("The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form."), 54 __("The uploaded file was only partially uploaded."), 55 __("No file was uploaded."), 56 __("Missing a temporary folder."), 57 __("Failed to write file to disk.")); 58 58 59 59 $iuerror = false; … … 63 63 // A correct form post will pass this test. 64 64 if ( !isset($_POST['action']) || $_POST['action'] != 'save' || count($_FILES) != 1 || ! isset($_FILES['image']) || is_array($_FILES['image']['name']) ) 65 $error = 'Invalid form submission. Only submit approved forms.';65 $error = __('Invalid form submission. Only submit approved forms.'); 66 66 67 67 // A successful upload will pass this test. … … 71 71 // A non-empty file will pass this test. 72 72 elseif ( 0 == $_FILES['image']['size'] ) 73 $error = 'File is empty. Please upload something more substantial.';73 $error = __('File is empty. Please upload something more substantial.'); 74 74 75 75 // A correct MIME category will pass this test. Full types are not consistent across browsers. 76 76 elseif ( ! 'image/' == substr($_FILES['image']['type'], 0, 6) ) 77 $error = 'Bad MIME type submitted by your browser.';77 $error = __('Bad MIME type submitted by your browser.'); 78 78 79 79 // An acceptable file extension will pass this test. 80 80 elseif ( ! ( ( 0 !== preg_match('#\.?([^\.]*)$#', $_FILES['image']['name'], $matches) ) && ( $ext = strtolower($matches[1]) ) && array_key_exists($ext, $exts) ) ) 81 $error = 'Bad file extension.';81 $error = __('Bad file extension.'); 82 82 83 83 // A valid uploaded file will pass this test. 84 84 elseif ( ! is_uploaded_file($_FILES['image']['tmp_name']) ) 85 $error = 'Bad temp file. Try renaming the file and uploading again.';85 $error = __('Bad temp file. Try renaming the file and uploading again.'); 86 86 87 87 // A valid image file will pass this test. 88 88 elseif ( function_exists('exif_imagetype') && $exts[$ext] != $imagetype = exif_imagetype($_FILES['image']['tmp_name']) ) 89 $error = 'Bad image file. Try again, or try recreating it.';89 $error = __('Bad image file. Try again, or try recreating it.'); 90 90 91 91 // An image with at least one pixel will pass this test. 92 92 elseif ( ! ( ( $imagesize = getimagesize($_FILES['image']['tmp_name']) ) && $imagesize[0] > 1 && $imagesize[1] > 1 ) ) 93 $error = 'The image has no pixels. Isn\'t that odd?';93 $error = __('The image has no pixels. Isn\'t that odd?'); 94 94 95 95 // A writable uploads dir will pass this test.
Note: See TracChangeset
for help on using the changeset viewer.