]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-ftp.php
WordPress 4.4
[autoinstalls/wordpress.git] / wp-admin / includes / class-ftp.php
index 1ae3e870ebf4243745d12235373d27ff311b07c7..4f75e409f8faeaf07933a3be57617dac8b157db7 100644 (file)
@@ -9,7 +9,7 @@
  * @copyright Alexey Dotsenko
  * @author Alexey Dotsenko
  * @link http://www.phpclasses.org/browse/package/1743.html Site
- * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
+ * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
  */
 
 /**
@@ -121,10 +121,6 @@ class ftp_base {
        var $AutoAsciiExt;
 
        /* Constructor */
-       function ftp_base($port_mode=FALSE) {
-               $this->__construct($port_mode);
-       }
-
        function __construct($port_mode=FALSE, $verb=FALSE, $le=FALSE) {
                $this->LocalEcho=$le;
                $this->Verbose=$verb;
@@ -157,6 +153,10 @@ class ftp_base {
                elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac;
        }
 
+       function ftp_base($port_mode=FALSE) {
+               $this->__construct($port_mode);
+       }
+
 // <!-- --------------------------------------------------------------------------------------- -->
 // <!--       Public functions                                                                  -->
 // <!-- --------------------------------------------------------------------------------------- -->
@@ -380,7 +380,7 @@ class ftp_base {
        function pwd() {
                if(!$this->_exec("PWD", "pwd")) return FALSE;
                if(!$this->_checkCode()) return FALSE;
-               return ereg_replace("^[0-9]{3} \"(.+)\".+", "\\1", $this->_message);
+               return preg_replace("/^[0-9]{3} \"(.+)\".*$/s", "\\1", $this->_message);
        }
 
        function cdup() {
@@ -424,7 +424,7 @@ class ftp_base {
                }
                if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE;
                if(!$this->_checkCode()) return FALSE;
-               return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
+               return preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message);
        }
 
        function abort() {
@@ -444,7 +444,7 @@ class ftp_base {
                }
                if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE;
                if(!$this->_checkCode()) return FALSE;
-               $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message);
+               $mdtm = preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message);
                $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
                $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
                return $timestamp;
@@ -504,7 +504,7 @@ class ftp_base {
                return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist");
        }
 
-       function nlist($pathname="") {
+       function nlist($pathname="", $arg="") {
                return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist");
        }
 
@@ -818,8 +818,8 @@ class ftp_base {
        function glob_regexp($pattern,$probe) {
                $sensitive=(PHP_OS!='WIN32');
                return ($sensitive?
-                       ereg($pattern,$probe):
-                       eregi($pattern,$probe)
+                       preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $probe ) : 
+                       preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $probe )
                );
        }
 
@@ -903,5 +903,4 @@ if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) {
        $mod_sockets = extension_loaded( 'sockets' );
 }
 
-require_once "class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php";
-?>
+require_once dirname( __FILE__ ) . "/class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php";