-
-
Save sunny/1442272 to your computer and use it in GitHub Desktop.
WordPress plugin that removes evil characters in file names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Sunnytize | |
Plugin URI: | |
Description: A better file name sanitizer | |
Version: 2.0 | |
Author: Sunny Ripert, Bastien Maillard, Guillaume Morisseau | |
Author URI: http://sunfox.org | |
*/ | |
function sunnytize($name, $name_raw = "") { | |
return preg_replace('/[^a-z0-9-_\/]+/', '', $name); | |
} | |
add_filter('sanitize_file_name', 'sunnytize'); | |
add_filter('editable_slug', 'sunnytize'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment