Skip to content

Instantly share code, notes, and snippets.

@sunny
Created May 31, 2011 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sunny/1000952 to your computer and use it in GitHub Desktop.
Save sunny/1000952 to your computer and use it in GitHub Desktop.
WordPress plugin that removes evil characters in file names
<?php
/*
Plugin Name: Sunnytize
Plugin URI:
Description: A better file name sanitizer
Version: 1.0
Author: Sunny Ripert
Author URI: http://sunfox.org
*/
function sunnytize_file_name_chars($special_chars, $filename_raw = '') {
return array_merge($special_chars, str_split('éè’ààäçéèêöôùûü£€%@+«»°'));
}
add_filter('sanitize_file_name_chars', 'sunnytize_file_name_chars');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment