| @@ -47,12 +47,12 @@ | ||
| 47 | 47 | public function create_file( $file_content ) { |
| 48 | 48 | if ( $this->has_permission ) { |
| 49 | 49 | $dirs_exist = true; |
| 50 | 50 | |
| 51 | - // Create the directories if need be | |
| 51 | + // Create the directories if need be. | |
| 52 | 52 | $this->create_directories( $dirs_exist ); |
| 53 | 53 | |
| 54 | - // only write the file if the folders exist | |
| 54 | + // Only write the file if the folders exist. | |
| 55 | 55 | if ( $dirs_exist ) { |
| 56 | 56 | global $wp_filesystem; |
| 57 | 57 | $wp_filesystem->put_contents( $this->new_file_path, $file_content, $this->chmod_file ); |
| 58 | 58 | } |
| @@ -81,9 +81,9 @@ | ||
| 81 | 81 | * Combine an array of files into one |
| 82 | 82 | * |
| 83 | 83 | * @since 3.0 |
| 84 | 84 | * |
| 85 | - * @param array $file_names And array of file paths | |
| 85 | + * @param array $file_names And array of file paths. | |
| 86 | 86 | * |
| 87 | 87 | * @return void |
| 88 | 88 | */ |
| 89 | 89 | public function combine_files( $file_names ) { |
| @@ -203,14 +203,15 @@ | ||
| 203 | 203 | $credentials['hostname'] = defined( 'FTP_HOST' ) ? FTP_HOST : $credentials['hostname']; |
| 204 | 204 | $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : $credentials['username']; |
| 205 | 205 | $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : ''; |
| 206 | 206 | |
| 207 | - // Check to see if we are setting the public/private keys for ssh | |
| 207 | + // Check to see if we are setting the public/private keys for ssh. | |
| 208 | 208 | $credentials['public_key'] = defined( 'FTP_PUBKEY' ) ? FTP_PUBKEY : ''; |
| 209 | 209 | $credentials['private_key'] = defined( 'FTP_PRIKEY' ) ? FTP_PRIKEY : ''; |
| 210 | 210 | |
| 211 | - // Sanitize the hostname, Some people might pass in odd-data: | |
| 212 | - $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); //Strip any schemes off | |
| 211 | + // Sanitize the hostname, Some people might pass in odd-data. | |
| 212 | + // Strip any schemes off. | |
| 213 | + $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); | |
| 213 | 214 | |
| 214 | 215 | if ( strpos( $credentials['hostname'], ':' ) ) { |
| 215 | 216 | list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 ); |
| 216 | 217 | if ( ! is_numeric( $credentials['port'] ) ) { |
| @@ -222,12 +223,12 @@ | ||
| 222 | 223 | |
| 223 | 224 | if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' == FS_METHOD ) ) { |
| 224 | 225 | $credentials['connection_type'] = 'ssh'; |
| 225 | 226 | } elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' == $type ) { |
| 226 | - //Only the FTP Extension understands SSL | |
| 227 | + // Only the FTP Extension understands SSL. | |
| 227 | 228 | $credentials['connection_type'] = 'ftps'; |
| 228 | 229 | } elseif ( ! isset( $credentials['connection_type'] ) ) { |
| 229 | - //All else fails (And it's not defaulted to something else saved), Default to FTP | |
| 230 | + // All else fails (And it's not defaulted to something else saved), Default to FTP. | |
| 230 | 231 | $credentials['connection_type'] = 'ftp'; |
| 231 | 232 | } |
| 232 | 233 | |
| 233 | 234 | $has_creds = ( ! empty( $credentials['password'] ) && ! empty( $credentials['username'] ) && ! empty( $credentials['hostname'] ) ); |
| @@ -234,9 +235,9 @@ | ||
| 234 | 235 | $can_ssh = ( 'ssh' == $credentials['connection_type'] && ! empty( $credentials['public_key'] ) && ! empty( $credentials['private_key'] ) ); |
| 235 | 236 | if ( $has_creds || $can_ssh ) { |
| 236 | 237 | $stored_credentials = $credentials; |
| 237 | 238 | if ( ! empty( $stored_credentials['port'] ) ) { |
| 238 | - //save port as part of hostname to simplify above code. | |
| 239 | + // Save port as part of hostname to simplify above code. | |
| 239 | 240 | $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; |
| 240 | 241 | } |
| 241 | 242 | |
| 242 | 243 | unset( $stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key'] ); |