コード例 #1
0
ファイル: File.php プロジェクト: bhirsch/voipdev
 /**
  * Given a file name, determine if the file contents make it an ascii file
  *
  * @param string $name name of file
  *
  * @return boolean     true if file is ascii
  * @access public
  */
 static function isAscii($name)
 {
     $fd = fopen($name, "r");
     if (!$fd) {
         return false;
     }
     $ascii = true;
     while (!feof($fd)) {
         $line = fgets($fd, 8192);
         if (!CRM_Utils_String::isAscii($line)) {
             $ascii = false;
             break;
         }
     }
     fclose($fd);
     return $ascii;
 }
コード例 #2
0
ファイル: File.php プロジェクト: routinet/civicrm-core
 /**
  * Given a file name, determine if the file contents make it an ascii file
  *
  * @param string $name
  *   Name of file.
  *
  * @return bool
  *   true if file is ascii
  */
 public static function isAscii($name)
 {
     $fd = fopen($name, "r");
     if (!$fd) {
         return FALSE;
     }
     $ascii = TRUE;
     while (!feof($fd)) {
         $line = fgets($fd, 8192);
         if (!CRM_Utils_String::isAscii($line)) {
             $ascii = FALSE;
             break;
         }
     }
     fclose($fd);
     return $ascii;
 }