wp/wp-admin/includes/class-ftp.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     6  * @since 2.5.0
     6  * @since 2.5.0
     7  *
     7  *
     8  * @version 1.0
     8  * @version 1.0
     9  * @copyright Alexey Dotsenko
     9  * @copyright Alexey Dotsenko
    10  * @author Alexey Dotsenko
    10  * @author Alexey Dotsenko
    11  * @link http://www.phpclasses.org/browse/package/1743.html Site
    11  * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html
    12  * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
    12  * @license LGPL https://opensource.org/licenses/lgpl-license.html
    13  */
    13  */
    14 
    14 
    15 /**
    15 /**
    16  * Defines the newline characters, if not defined already.
    16  * Defines the newline characters, if not defined already.
    17  *
    17  *
   183 		} else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
   183 		} else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
   184 			//echo $line."\n";
   184 			//echo $line."\n";
   185 			$lcount=count($lucifer);
   185 			$lcount=count($lucifer);
   186 			if ($lcount<8) return '';
   186 			if ($lcount<8) return '';
   187 			$b = array();
   187 			$b = array();
   188 			$b['isdir'] = $lucifer[0]{0} === "d";
   188 			$b['isdir'] = $lucifer[0][0] === "d";
   189 			$b['islink'] = $lucifer[0]{0} === "l";
   189 			$b['islink'] = $lucifer[0][0] === "l";
   190 			if ( $b['isdir'] )
   190 			if ( $b['isdir'] )
   191 				$b['type'] = 'd';
   191 				$b['type'] = 'd';
   192 			elseif ( $b['islink'] )
   192 			elseif ( $b['islink'] )
   193 				$b['type'] = 'l';
   193 				$b['type'] = 'l';
   194 			else
   194 			else
   205 				$b['name'] = $lucifer[7];
   205 				$b['name'] = $lucifer[7];
   206 			} else {
   206 			} else {
   207 				$b['month'] = $lucifer[5];
   207 				$b['month'] = $lucifer[5];
   208 				$b['day'] = $lucifer[6];
   208 				$b['day'] = $lucifer[6];
   209 				if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
   209 				if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
   210 					$b['year'] = date("Y");
   210 					$b['year'] = gmdate("Y");
   211 					$b['hour'] = $l2[1];
   211 					$b['hour'] = $l2[1];
   212 					$b['minute'] = $l2[2];
   212 					$b['minute'] = $l2[2];
   213 				} else {
   213 				} else {
   214 					$b['year'] = $lucifer[7];
   214 					$b['year'] = $lucifer[7];
   215 					$b['hour'] = 0;
   215 					$b['hour'] = 0;
   897 }
   897 }
   898 
   898 
   899 $mod_sockets = extension_loaded( 'sockets' );
   899 $mod_sockets = extension_loaded( 'sockets' );
   900 if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) {
   900 if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) {
   901 	$prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : '';
   901 	$prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : '';
   902 	@dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX );
   902 	@dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX ); // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.dlDeprecated
   903 	$mod_sockets = extension_loaded( 'sockets' );
   903 	$mod_sockets = extension_loaded( 'sockets' );
   904 }
   904 }
   905 
   905 
   906 require_once dirname( __FILE__ ) . "/class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php";
   906 require_once __DIR__ . "/class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php";
   907 
   907 
   908 if ( $mod_sockets ) {
   908 if ( $mod_sockets ) {
   909 	class ftp extends ftp_sockets {}
   909 	class ftp extends ftp_sockets {}
   910 } else {
   910 } else {
   911 	class ftp extends ftp_pure {}
   911 	class ftp extends ftp_pure {}