Changeset 8811 for trunk/wp-admin/includes/file.php
- Timestamp:
- 09/05/2008 05:35:58 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r8718 r8811 449 449 require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); 450 450 451 $method = get_filesystem_method( );451 $method = get_filesystem_method($args); 452 452 453 453 if ( ! $method ) … … 472 472 } 473 473 474 function get_filesystem_method( ) {474 function get_filesystem_method($args = array()) { 475 475 $method = false; 476 476 if( function_exists('getmyuid') && function_exists('fileowner') ){ … … 481 481 } 482 482 483 if ( isset($args['connection_type']) && 'ssh' == $args['connection_type'] ) { 484 $method = 'SSH2'; 485 return apply_filters('filesystem_method', $method); 486 } 487 483 488 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 484 489 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread … … 503 508 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 504 509 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); 505 $credentials['ssl'] = defined('FTP_SSL') ? FTP_SSL : ( isset($_POST['ssl']) ? $_POST['ssl'] : $credentials['ssl']); 510 if ( defined('FTP_SSH') || 'ssh' == $_POST['connection_type'] ) 511 $credentials['connection_type'] = 'ssh'; 512 else if ( defined('FTP_SSL') || 'ftps' == $_POST['connection_type'] ) 513 $credentials['connection_type'] = 'ftps'; 514 else 515 $credentials['connection_type'] = 'ftp'; 506 516 507 517 if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { … … 517 527 if ( !empty($credentials) ) 518 528 extract($credentials, EXTR_OVERWRITE); 519 if( $error ) 520 echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.') . '</p></div>'; 529 if ( $error ) { 530 $error_string = __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.'); 531 if ( is_wp_error($error) ) 532 $error_string = $error->get_error_message(); 533 echo '<div id="message" class="error"><p>' . $error_string . '</p></div>'; 534 } 521 535 ?> 522 536 <form action="<?php echo $form_post ?>" method="post"> … … 526 540 <table class="form-table"> 527 541 <tr valign="top"> 528 <th scope="row"><label for="hostname"><?php _e('Hostname :') ?></label></th>542 <th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th> 529 543 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td> 530 544 </tr> 531 545 <tr valign="top"> 532 <th scope="row"><label for="username"><?php _e('Username :') ?></label></th>546 <th scope="row"><label for="username"><?php _e('Username') ?></label></th> 533 547 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td> 534 548 </tr> 535 549 <tr valign="top"> 536 <th scope="row"><label for="password"><?php _e('Password :') ?></label></th>550 <th scope="row"><label for="password"><?php _e('Password') ?></label></th> 537 551 <td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td> 538 552 </tr> 539 553 <tr valign="top"> 540 <th scope="row">< label for="ssl"><?php _e('Use SSL:') ?></label></th>554 <th scope="row"><?php _e('Connection Type') ?></th> 541 555 <td> 542 <select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>> 543 <?php 544 foreach ( array(0 => __('No'), 1 => __('Yes')) as $key => $value ) : 545 $selected = ($ssl == $value) ? 'selected="selected"' : ''; 546 echo "\n\t<option value='$key' $selected>" . $value . '</option>'; 547 endforeach; 548 ?> 549 </select> 556 <fieldset><legend class="hidden"><?php _e('Connection Type') ?> </legend> 557 <p><label><input name="connection_type" type="radio" value="ftp" <?php checked('ftp', $connection_type); ?> /> <?php _e('FTP') ?></label><br /> 558 <label><input name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); ?> /> <?php _e('FTPS (SSL)') ?></label><br /> 559 <label><input name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type); ?> /> <?php _e('SSH') ?></label></p> 560 </fieldset> 550 561 </td> 551 562 </tr>
Note: See TracChangeset
for help on using the changeset viewer.