public static function safeFileWrite($filepath, $str = '', $opts = array())
	{
		$return = false;
		$opts = array_merge(array(
			'est_size' => strlen($str),
		), $opts);
		$fh = self::safeFopen($filepath, $opts);
		if ($fh) {
			if (fwrite($fh, $str) !== false) {
				$return = true;
			} else {
				trigger_error('Error writing to '.$filepath, E_USER_ERROR);
			}
			self::safeFclose($fh);
		}
		return $return;
	}