Interplay: Media File Renamer ?? WP sanitize_file_name() in formatting.php
-
Meanwhile found the relevant doc:
https://developer.www.ads-software.com/reference/functions/sanitize_file_name/
Whether/how can Media File Renamer (MFR) rules or user filters interact/overrule what’s happening in
wp-includes/formatting.php
?See me 3 questions as inline comments:
function sanitize_file_name( $filename ) { $filename_raw = $filename; // 1) Do MFR rules or user filters change ("overload" is the term AFAIR) the remove_accents() function? $filename = remove_accents( $filename ); // ... // 2) Do MFR rules or user filters change the $special_chars / sanitize_file_name_chars constant ? $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '?', '?', '”', '“', chr( 0 ) ); $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw ); $filename = str_replace( $special_chars, '', $filename ); $filename = str_replace( array( '%20', '+' ), '-', $filename ); $filename = preg_replace( '/\.{2,}/', '.', $filename ); // 3) Possible to override this rule which reduces consecutive whitespace and hyphens to a single hyphen? $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename ); $filename = trim( $filename, '.-_' );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Interplay: Media File Renamer ?? WP sanitize_file_name() in formatting.php’ is closed to new replies.