浏览代码

prevent some unwanted string formating

Nicolas Cannasse 13 年之前
父节点
当前提交
470f709580
共有 4 个文件被更改,包括 7 次插入9 次删除
  1. 1 1
      std/php/Web.hx
  2. 1 1
      std/php/_std/Reflect.hx
  3. 4 6
      std/php/_std/sys/FileSystem.hx
  4. 1 1
      std/php/_std/sys/net/Socket.hx

+ 1 - 1
std/php/Web.hx

@@ -286,7 +286,7 @@ class Web {
 		Get the current script directory in the local filesystem.
 	**/
 	public static inline function getCwd() : String {
-		return untyped __php__('dirname($_SERVER["SCRIPT_FILENAME"])') + "/";
+		return untyped __php__("dirname($_SERVER[\"SCRIPT_FILENAME\"])") + "/";
 	}
 
 	/**

+ 1 - 1
std/php/_std/Reflect.hx

@@ -62,7 +62,7 @@
 
 	public static function fields( o : Dynamic ) : Array<String> {
 		if( o == null ) return new Array();
-		return untyped __php__('$o instanceof _hx_array')
+		return untyped __php__("$o instanceof _hx_array")
 				? __php__("new _hx_array(array('concat','copy','insert','iterator','length','join','pop','push','remove','reverse','shift','slice','sort','splice','toString','unshift'))")
 				: (__call__('is_string', o)
 					? __php__("new _hx_array(array('charAt','charCodeAt','indexOf','lastIndexOf','length','split','substr','toLowerCase','toString','toUpperCase'))")

+ 4 - 6
std/php/_std/sys/FileSystem.hx

@@ -39,9 +39,7 @@ class FileSystem {
 	}
 
 	public static function stat( path : String ) : FileStat {
-		untyped __php__('$fp = fopen($path, "r");
-		$fstat = fstat($fp);
-		fclose($fp);');
+		untyped __php__("$fp = fopen($path, \"r\"); $fstat = fstat($fp); fclose($fp);");
 		return untyped {
 			gid   : __php__("$fstat['gid']"),
 			uid   : __php__("$fstat['uid']"),
@@ -92,9 +90,9 @@ class FileSystem {
 
 	public static function readDirectory( path : String ) : Array<String> {
 		var l = untyped __call__("array");
-		untyped __php__('$dh = opendir($path);
-        while (($file = readdir($dh)) !== false) if("." != $file && ".." != $file) $l[] = $file;
-        closedir($dh);');
+		untyped __php__("$dh = opendir($path);
+        while (($file = readdir($dh)) !== false) if(\".\" != $file && \"..\" != $file) $l[] = $file;
+        closedir($dh);");
 		return untyped __call__("new _hx_array", l);
 	}
 }

+ 1 - 1
std/php/_std/sys/net/Socket.hx

@@ -55,7 +55,7 @@ class Socket {
 
 	public function read() : String {
 		var b = '';
-		untyped __php__('while (!feof($this->__s)) $b .= fgets($this->__s)');
+		untyped __php__("while (!feof($this->__s)) $b .= fgets($this->__s)");
 		return b;
 	}