Make WordPress Core


Ignore:
Timestamp:
09/26/2008 06:53:57 AM (16 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-base.php

    r8645 r8990  
    167167        return $newmode;
    168168    }
     169
     170    /**
     171    * Determines if the string provided contains binary characters.
     172    *
     173    * @since 2.7
     174    * @package WordPress
     175    * @subpackage WP_Filesystem
     176    *
     177    * @param string $text String to test against
     178    *
     179    */
     180    function is_binary( $text ) {
     181        return (bool) preg_match('|[^\x20-\x7E]|', $text); //chr(32)..chr(127)
     182    }
    169183}
    170184
Note: See TracChangeset for help on using the changeset viewer.