Last active
December 16, 2015 06:19
-
-
Save Dianakc/b32df6af7322a3e765e9 to your computer and use it in GitHub Desktop.
Adiciona um hash e/outras coisas no arquivo enviado
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 | |
function make_filename_hash($filename) { | |
$nomedosite = get_bloginfo('name'); | |
$info = pathinfo($filename); | |
$ext = empty($info['extension']) ? '' : '.' . $info['extension']; | |
$name = basename($filename, $ext); | |
return $nomedosite.'_'.md5($name) . $ext; | |
} | |
add_filter('sanitize_file_name', 'make_filename_hash', 10); | |
;?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment