wp/wp-admin/includes/class-wp-filesystem-ftpext.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   448 	 */
   448 	 */
   449 	public function is_dir( $path ) {
   449 	public function is_dir( $path ) {
   450 		$cwd    = $this->cwd();
   450 		$cwd    = $this->cwd();
   451 		$result = @ftp_chdir( $this->link, trailingslashit( $path ) );
   451 		$result = @ftp_chdir( $this->link, trailingslashit( $path ) );
   452 
   452 
   453 		if ( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
   453 		if ( $result && $path === $this->cwd() || $this->cwd() !== $cwd ) {
   454 			@ftp_chdir( $this->link, $cwd );
   454 			@ftp_chdir( $this->link, $cwd );
   455 			return true;
   455 			return true;
   456 		}
   456 		}
   457 
   457 
   458 		return false;
   458 		return false;
   539 	/**
   539 	/**
   540 	 * Creates a directory.
   540 	 * Creates a directory.
   541 	 *
   541 	 *
   542 	 * @since 2.5.0
   542 	 * @since 2.5.0
   543 	 *
   543 	 *
   544 	 * @param string     $path  Path for new directory.
   544 	 * @param string           $path  Path for new directory.
   545 	 * @param int|false  $chmod Optional. The permissions as octal number (or false to skip chmod).
   545 	 * @param int|false        $chmod Optional. The permissions as octal number (or false to skip chmod).
   546 	 *                          Default false.
   546 	 *                                Default false.
   547 	 * @param string|int $chown Optional. A user name or number (or false to skip chown).
   547 	 * @param string|int|false $chown Optional. A user name or number (or false to skip chown).
   548 	 *                          Default false.
   548 	 *                                Default false.
   549 	 * @param string|int $chgrp Optional. A group name or number (or false to skip chgrp).
   549 	 * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
   550 	 *                          Default false.
   550 	 *                                Default false.
   551 	 * @return bool True on success, false on failure.
   551 	 * @return bool True on success, false on failure.
   552 	 */
   552 	 */
   553 	public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
   553 	public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
   554 		$path = untrailingslashit( $path );
   554 		$path = untrailingslashit( $path );
   555 
   555 
   612 			$b['month']  = $lucifer[1];
   612 			$b['month']  = $lucifer[1];
   613 			$b['day']    = $lucifer[2];
   613 			$b['day']    = $lucifer[2];
   614 			$b['year']   = $lucifer[3];
   614 			$b['year']   = $lucifer[3];
   615 			$b['hour']   = $lucifer[4];
   615 			$b['hour']   = $lucifer[4];
   616 			$b['minute'] = $lucifer[5];
   616 			$b['minute'] = $lucifer[5];
   617 			$b['time']   = mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) == 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] );
   617 			$b['time']   = mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) === 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] );
   618 			$b['am/pm']  = $lucifer[6];
   618 			$b['am/pm']  = $lucifer[6];
   619 			$b['name']   = $lucifer[8];
   619 			$b['name']   = $lucifer[8];
   620 		} elseif ( ! $is_windows ) {
   620 		} elseif ( ! $is_windows ) {
   621 			$lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY );
   621 			$lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY );
   622 
   622 
   645 				$b['number'] = $lucifer[1];
   645 				$b['number'] = $lucifer[1];
   646 				$b['owner']  = $lucifer[2];
   646 				$b['owner']  = $lucifer[2];
   647 				$b['group']  = $lucifer[3];
   647 				$b['group']  = $lucifer[3];
   648 				$b['size']   = $lucifer[4];
   648 				$b['size']   = $lucifer[4];
   649 
   649 
   650 				if ( 8 == $lcount ) {
   650 				if ( 8 === $lcount ) {
   651 					sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] );
   651 					sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] );
   652 					sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] );
   652 					sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] );
   653 
   653 
   654 					$b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );
   654 					$b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );
   655 					$b['name'] = $lucifer[7];
   655 					$b['name'] = $lucifer[7];
   743 
   743 
   744 			if ( ! $include_hidden && '.' === $entry['name'][0] ) {
   744 			if ( ! $include_hidden && '.' === $entry['name'][0] ) {
   745 				continue;
   745 				continue;
   746 			}
   746 			}
   747 
   747 
   748 			if ( $limit_file && $entry['name'] != $limit_file ) {
   748 			if ( $limit_file && $entry['name'] !== $limit_file ) {
   749 				continue;
   749 				continue;
   750 			}
   750 			}
   751 
   751 
   752 			$dirlist[ $entry['name'] ] = $entry;
   752 			$dirlist[ $entry['name'] ] = $entry;
   753 		}
   753 		}