function _validate($result) { $result['data']['notused'] = 'image'; it_classes_load('it-file-utility.php'); if (ITFileUtility::file_uploaded('image')) { $file = ITFileUtility::upload_file('image'); if (is_wp_error($file)) { $result['errors'][] = sprintf(__("Unable to save uploaded image. Ensure that the web server has permissions to write to the uploads folder.\n\nMessage: %s", 'it-l10n-Builder-Paige'), $file->get_error_message()); } else { $result['data']['attachment'] = $file['id']; $_POST['attachment'] = $file['id']; } } else { if (empty($_POST['attachment'])) { $result['errors'][] = __('You must upload an image.', 'it-l10n-Builder-Paige'); } } if (empty($_POST['height']) || preg_match('/[^0-9]/', $_POST['height'])) { $result['errors'][] = __('You must enter an integer value for the Height.', 'it-l10n-Builder-Paige'); } else { if ($_POST['height'] < 10) { $result['errors'][] = __('The minimum Height is 10 pixels. Please increase the Height.', 'it-l10n-Builder-Paige'); } } return $result; }