Autodetect binary files for FTP filesystems. Fixes #7568 props DD32.

git-svn-id: https://develop.svn.wordpress.org/trunk@8990 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood
2008-09-26 06:53:57 +00:00
parent 2e12a7cc82
commit 55ebbd699f
3 changed files with 42 additions and 48 deletions
@@ -166,6 +166,20 @@ class WP_Filesystem_Base {
$newmode .= $mode[6] + $mode[7] + $mode[8];
return $newmode;
}
/**
* Determines if the string provided contains binary characters.
*
* @since 2.7
* @package WordPress
* @subpackage WP_Filesystem
*
* @param string $text String to test against
*
*/
function is_binary( $text ) {
return (bool) preg_match('|[^\x20-\x7E]|', $text); //chr(32)..chr(127)
}
}
?>