wp/wp-admin/includes/class-ftp.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
--- a/wp/wp-admin/includes/class-ftp.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-admin/includes/class-ftp.php	Tue Sep 27 16:37:53 2022 +0200
@@ -334,7 +334,7 @@
 		} while($this->_code<200);
 		$this->_ready=true;
 		$syst=$this->systype();
-		if(!$syst) $this->SendMSG("Can't detect remote OS");
+		if(!$syst) $this->SendMSG("Cannot detect remote OS");
 		else {
 			if(preg_match("/win|dos|novell/i", $syst[0])) $this->OS_remote=FTP_OS_Windows;
 			elseif(preg_match("/os/i", $syst[0])) $this->OS_remote=FTP_OS_Mac;
@@ -342,7 +342,7 @@
 			else $this->OS_remote=FTP_OS_Mac;
 			$this->SendMSG("Remote OS: ".$this->OS_FullName[$this->OS_remote]);
 		}
-		if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled");
+		if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled");
 		else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
 		return TRUE;
 	}
@@ -371,7 +371,7 @@
 		}
 		$this->SendMSG("Authentication succeeded");
 		if(empty($this->_features)) {
-			if(!$this->features()) $this->SendMSG("Can't get features list. All supported - disabled");
+			if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled");
 			else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
 		}
 		return TRUE;
@@ -480,7 +480,7 @@
 			return FALSE;
 		}
 		if($this->_curtype!=FTP_BINARY) {
-			$this->PushError("restore", "can't restore in ASCII mode");
+			$this->PushError("restore", "cannot restore in ASCII mode");
 			return FALSE;
 		}
 		if(!$this->_exec("REST ".$from, "resore")) return FALSE;
@@ -553,7 +553,7 @@
 		if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
 		$fp = @fopen($localfile, "w");
 		if (!$fp) {
-			$this->PushError("get","can't open local file", "Cannot create \"".$localfile."\"");
+			$this->PushError("get","cannot open local file", "Cannot create \"".$localfile."\"");
 			return FALSE;
 		}
 		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
@@ -610,13 +610,13 @@
 	function put($localfile, $remotefile=NULL, $rest=0) {
 		if(is_null($remotefile)) $remotefile=$localfile;
 		if (!file_exists($localfile)) {
-			$this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\"");
+			$this->PushError("put","cannot open local file", "No such file or directory \"".$localfile."\"");
 			return FALSE;
 		}
 		$fp = @fopen($localfile, "r");
 
 		if (!$fp) {
-			$this->PushError("put","can't open local file", "Cannot read file \"".$localfile."\"");
+			$this->PushError("put","cannot open local file", "Cannot read file \"".$localfile."\"");
 			return FALSE;
 		}
 		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
@@ -649,7 +649,7 @@
 	function mput($local=".", $remote=NULL, $continious=false) {
 		$local=realpath($local);
 		if(!@file_exists($local)) {
-			$this->PushError("mput","can't open local folder", "Cannot stat folder \"".$local."\"");
+			$this->PushError("mput","cannot open local folder", "Cannot stat folder \"".$local."\"");
 			return FALSE;
 		}
 		if(!is_dir($local)) return $this->put($local, $remote);
@@ -662,7 +662,7 @@
 			}
 			closedir($handle);
 		} else {
-			$this->PushError("mput","can't open local folder", "Cannot read folder \"".$local."\"");
+			$this->PushError("mput","cannot open local folder", "Cannot read folder \"".$local."\"");
 			return FALSE;
 		}
 		if(empty($list)) return TRUE;
@@ -682,13 +682,13 @@
 	function mget($remote, $local=".", $continious=false) {
 		$list=$this->rawlist($remote, "-lA");
 		if($list===false) {
-			$this->PushError("mget","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
+			$this->PushError("mget","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents");
 			return FALSE;
 		}
 		if(empty($list)) return true;
 		if(!@file_exists($local)) {
 			if(!@mkdir($local)) {
-				$this->PushError("mget","can't create local folder", "Cannot create folder \"".$local."\"");
+				$this->PushError("mget","cannot create local folder", "Cannot create folder \"".$local."\"");
 				return FALSE;
 			}
 		}
@@ -700,13 +700,13 @@
 		foreach($list as $el) {
 			if($el["type"]=="d") {
 				if(!$this->mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) {
-					$this->PushError("mget", "can't copy folder", "Can't copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
+					$this->PushError("mget", "cannot copy folder", "Cannot copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
 					$ret=false;
 					if(!$continious) break;
 				}
 			} else {
 				if(!$this->get($remote."/".$el["name"], $local."/".$el["name"])) {
-					$this->PushError("mget", "can't copy file", "Can't copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
+					$this->PushError("mget", "cannot copy file", "Cannot copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
 					$ret=false;
 					if(!$continious) break;
 				}
@@ -721,7 +721,7 @@
 	function mdel($remote, $continious=false) {
 		$list=$this->rawlist($remote, "-la");
 		if($list===false) {
-			$this->PushError("mdel","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
+			$this->PushError("mdel","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents");
 			return false;
 		}
 
@@ -742,7 +742,7 @@
 				}
 			} else {
 				if (!$this->delete($remote."/".$el["name"])) {
-					$this->PushError("mdel", "can't delete file", "Can't delete remote file \"".$remote."/".$el["name"]."\"");
+					$this->PushError("mdel", "cannot delete file", "Cannot delete remote file \"".$remote."/".$el["name"]."\"");
 					$ret=false;
 					if(!$continious) break;
 				}
@@ -750,7 +750,7 @@
 		}
 
 		if(!$this->rmdir($remote)) {
-			$this->PushError("mdel", "can't delete folder", "Can't delete remote folder \"".$remote."/".$el["name"]."\"");
+			$this->PushError("mdel", "cannot delete folder", "Cannot delete remote folder \"".$remote."/".$el["name"]."\"");
 			$ret=false;
 		}
 		return $ret;
@@ -792,7 +792,7 @@
 		return false;
 	}
 
-	function glob_pattern_match($pattern,$string) {
+	function glob_pattern_match($pattern,$subject) {
 		$out=null;
 		$chunks=explode(';',$pattern);
 		foreach($chunks as $pattern) {
@@ -807,26 +807,27 @@
 						str_replace('?','.{1,1}',$pattern))));
 			$out[]=$pattern;
 		}
-		if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string));
+		if(count($out)==1) return($this->glob_regexp("^$out[0]$",$subject));
 		else {
 			foreach($out as $tester)
-				if($this->my_regexp("^$tester$",$string)) return true;
+				// TODO: This should probably be glob_regexp(), but needs tests.
+				if($this->my_regexp("^$tester$",$subject)) return true;
 		}
 		return false;
 	}
 
-	function glob_regexp($pattern,$probe) {
+	function glob_regexp($pattern,$subject) {
 		$sensitive=(PHP_OS!='WIN32');
 		return ($sensitive?
-			preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $probe ) :
-			preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $probe )
+			preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $subject ) :
+			preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $subject )
 		);
 	}
 
 	function dirlist($remote) {
 		$list=$this->rawlist($remote, "-la");
 		if($list===false) {
-			$this->PushError("dirlist","can't read remote folder list", "Can't read remote folder \"".$remote."\" contents");
+			$this->PushError("dirlist","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents");
 			return false;
 		}