/** * Sanitize code textareas * @since 1.0.2 * @param string $meta Meta value * @param array $field Field config array * @return string Sanitized data */ public static function file($meta, $field) { $_id_name = $field['id'] . '_id'; // get _id old value $_id_old = cmb_Meta_Box::get_data($_id_name); // If specified NOT to save the file ID if (isset($field['save_id']) && !$field['save_id']) { $_new_id = ''; } else { // otherwise get the file ID $_new_id = isset($_POST[$_id_name]) ? $_POST[$_id_name] : null; // If there is no ID saved yet, try to get it from the url if (isset($_POST[$field['id']]) && $_POST[$field['id']] && !$_new_id) { $_new_id = cmb_Meta_Box::image_id_from_url(esc_url_raw($_POST[$field['id']])); } } if ($_new_id && $_new_id != $_id_old) { $updated[] = $_id_name; cmb_Meta_Box::update_data($_new_id, $_id_name); } elseif ('' == $_new_id && $_id_old) { $updated[] = $_id_name; cmb_Meta_Box::remove_data($_id_name, $old); } return self::default_sanitization($meta, $field); }