154 |
158 |
155 return '/tmp/'; |
159 return '/tmp/'; |
156 } |
160 } |
157 |
161 |
158 /** |
162 /** |
159 * {@internal Missing Short Description}} |
163 * Returns a filename of a Temporary unique file. |
160 * |
164 * Please note that the calling function must unlink() this itself. |
161 * @since unknown |
165 * |
162 * |
166 * The filename is based off the passed parameter or defaults to the current unix timestamp, |
163 * @param unknown_type $filename |
167 * while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory. |
164 * @param unknown_type $dir |
168 * |
165 * @return unknown |
169 * @since 2.6.0 |
|
170 * |
|
171 * @param string $filename (optional) Filename to base the Unique file off |
|
172 * @param string $dir (optional) Directory to store the file in |
|
173 * @return string a writable filename |
166 */ |
174 */ |
167 function wp_tempnam($filename = '', $dir = ''){ |
175 function wp_tempnam($filename = '', $dir = ''){ |
168 if ( empty($dir) ) |
176 if ( empty($dir) ) |
169 $dir = get_temp_dir(); |
177 $dir = get_temp_dir(); |
170 $filename = basename($filename); |
178 $filename = basename($filename); |
171 if ( empty($filename) ) |
179 if ( empty($filename) ) |
172 $filename = time(); |
180 $filename = time(); |
173 |
181 |
|
182 $filename = preg_replace('|\..*$|', '.tmp', $filename); |
174 $filename = $dir . wp_unique_filename($dir, $filename); |
183 $filename = $dir . wp_unique_filename($dir, $filename); |
175 touch($filename); |
184 touch($filename); |
176 return $filename; |
185 return $filename; |
177 } |
186 } |
178 |
187 |
184 * @param unknown_type $file |
193 * @param unknown_type $file |
185 * @param unknown_type $allowed_files |
194 * @param unknown_type $allowed_files |
186 * @return unknown |
195 * @return unknown |
187 */ |
196 */ |
188 function validate_file_to_edit( $file, $allowed_files = '' ) { |
197 function validate_file_to_edit( $file, $allowed_files = '' ) { |
189 $file = stripslashes( $file ); |
|
190 |
|
191 $code = validate_file( $file, $allowed_files ); |
198 $code = validate_file( $file, $allowed_files ); |
192 |
199 |
193 if (!$code ) |
200 if (!$code ) |
194 return $file; |
201 return $file; |
195 |
202 |
196 switch ( $code ) { |
203 switch ( $code ) { |
197 case 1 : |
204 case 1 : |
198 wp_die( __('Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' )); |
205 wp_die( __('Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' )); |
199 |
206 |
200 case 2 : |
207 //case 2 : |
201 wp_die( __('Sorry, can’t call files with their real path.' )); |
208 // wp_die( __('Sorry, can’t call files with their real path.' )); |
202 |
209 |
203 case 3 : |
210 case 3 : |
204 wp_die( __('Sorry, that file cannot be edited.' )); |
211 wp_die( __('Sorry, that file cannot be edited.' )); |
205 } |
212 } |
206 } |
213 } |
220 function wp_handle_upload_error( &$file, $message ) { |
227 function wp_handle_upload_error( &$file, $message ) { |
221 return array( 'error'=>$message ); |
228 return array( 'error'=>$message ); |
222 } |
229 } |
223 } |
230 } |
224 |
231 |
|
232 $file = apply_filters( 'wp_handle_upload_prefilter', $file ); |
|
233 |
225 // You may define your own function and pass the name in $overrides['upload_error_handler'] |
234 // You may define your own function and pass the name in $overrides['upload_error_handler'] |
226 $upload_error_handler = 'wp_handle_upload_error'; |
235 $upload_error_handler = 'wp_handle_upload_error'; |
|
236 |
|
237 // You may have had one or more 'wp_handle_upload_prefilter' functions error out the file. Handle that gracefully. |
|
238 if ( isset( $file['error'] ) && !is_numeric( $file['error'] ) && $file['error'] ) |
|
239 return $upload_error_handler( $file, $file['error'] ); |
227 |
240 |
228 // You may define your own function and pass the name in $overrides['unique_filename_callback'] |
241 // You may define your own function and pass the name in $overrides['unique_filename_callback'] |
229 $unique_filename_callback = null; |
242 $unique_filename_callback = null; |
230 |
243 |
231 // $_POST['action'] must be set and its value must equal $overrides['action'] or this: |
244 // $_POST['action'] must be set and its value must equal $overrides['action'] or this: |
262 if ( $file['error'] > 0 ) |
275 if ( $file['error'] > 0 ) |
263 return $upload_error_handler( $file, $upload_error_strings[$file['error']] ); |
276 return $upload_error_handler( $file, $upload_error_strings[$file['error']] ); |
264 |
277 |
265 // A non-empty file will pass this test. |
278 // A non-empty file will pass this test. |
266 if ( $test_size && !($file['size'] > 0 ) ) |
279 if ( $test_size && !($file['size'] > 0 ) ) |
267 return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' )); |
280 return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' )); |
268 |
281 |
269 // A properly uploaded file will pass this test. There should be no reason to override this one. |
282 // A properly uploaded file will pass this test. There should be no reason to override this one. |
270 if (! @ is_uploaded_file( $file['tmp_name'] ) ) |
283 if (! @ is_uploaded_file( $file['tmp_name'] ) ) |
271 return $upload_error_handler( $file, __( 'Specified file failed upload test.' )); |
284 return $upload_error_handler( $file, __( 'Specified file failed upload test.' )); |
272 |
285 |
464 |
477 |
465 return $tmpfname; |
478 return $tmpfname; |
466 } |
479 } |
467 |
480 |
468 /** |
481 /** |
469 * {@internal Missing Short Description}} |
482 * Unzip's a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction. |
470 * |
483 * Assumes that WP_Filesystem() has already been called and set up. |
471 * @since unknown |
484 * |
472 * |
485 * Attempts to increase the PHP Memory limit to 256M before uncompressing, |
473 * @param unknown_type $file |
486 * However, The most memory required shouldn't be much larger than the Archive itself. |
474 * @param unknown_type $to |
487 * |
475 * @return unknown |
488 * @since 2.5.0 |
|
489 * |
|
490 * @param string $file Full path and filename of zip archive |
|
491 * @param string $to Full path on the filesystem to extract archive to |
|
492 * @return mixed WP_Error on failure, True on success |
476 */ |
493 */ |
477 function unzip_file($file, $to) { |
494 function unzip_file($file, $to) { |
478 global $wp_filesystem; |
495 global $wp_filesystem; |
479 |
496 |
480 if ( ! $wp_filesystem || !is_object($wp_filesystem) ) |
497 if ( ! $wp_filesystem || !is_object($wp_filesystem) ) |
481 return new WP_Error('fs_unavailable', __('Could not access filesystem.')); |
498 return new WP_Error('fs_unavailable', __('Could not access filesystem.')); |
482 |
499 |
483 // Unzip uses a lot of memory |
500 // Unzip uses a lot of memory, but not this much hopefully |
484 @ini_set('memory_limit', '256M'); |
501 @ini_set('memory_limit', '256M'); |
485 |
502 |
486 $fs =& $wp_filesystem; |
503 $fs =& $wp_filesystem; |
487 |
504 |
488 require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php'); |
505 require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php'); |
571 $result = copy_dir($from . $filename, $to . $filename); |
589 $result = copy_dir($from . $filename, $to . $filename); |
572 if ( is_wp_error($result) ) |
590 if ( is_wp_error($result) ) |
573 return $result; |
591 return $result; |
574 } |
592 } |
575 } |
593 } |
576 } |
594 return true; |
577 |
595 } |
578 /** |
596 |
579 * {@internal Missing Short Description}} |
597 /** |
580 * |
598 * Initialises and connects the WordPress Filesystem Abstraction classes. |
581 * @since unknown |
599 * This function will include the chosen transport and attempt connecting. |
582 * |
600 * |
583 * @param unknown_type $args |
601 * Plugins may add extra transports, And force WordPress to use them by returning the filename via the 'filesystem_method_file' filter. |
584 * @return unknown |
602 * |
|
603 * @since 2.5.0 |
|
604 * |
|
605 * @param array $args (optional) Connection args, These are passed directly to the WP_Filesystem_*() classes. |
|
606 * @param string $context (optional) Context for get_filesystem_method(), See function declaration for more information. |
|
607 * @return boolean false on failure, true on success |
585 */ |
608 */ |
586 function WP_Filesystem( $args = false, $context = false ) { |
609 function WP_Filesystem( $args = false, $context = false ) { |
587 global $wp_filesystem; |
610 global $wp_filesystem; |
588 |
611 |
589 require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
612 require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
595 |
618 |
596 if ( ! class_exists("WP_Filesystem_$method") ) { |
619 if ( ! class_exists("WP_Filesystem_$method") ) { |
597 $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); |
620 $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); |
598 if( ! file_exists($abstraction_file) ) |
621 if( ! file_exists($abstraction_file) ) |
599 return; |
622 return; |
600 |
623 |
601 require_once($abstraction_file); |
624 require_once($abstraction_file); |
602 } |
625 } |
603 $method = "WP_Filesystem_$method"; |
626 $method = "WP_Filesystem_$method"; |
604 |
627 |
605 $wp_filesystem = new $method($args); |
628 $wp_filesystem = new $method($args); |
|
629 |
|
630 //Define the timeouts for the connections. Only available after the construct is called to allow for per-transport overriding of the default. |
|
631 if ( ! defined('FS_CONNECT_TIMEOUT') ) |
|
632 define('FS_CONNECT_TIMEOUT', 30); |
|
633 if ( ! defined('FS_TIMEOUT') ) |
|
634 define('FS_TIMEOUT', 30); |
606 |
635 |
607 if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) |
636 if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) |
608 return false; |
637 return false; |
609 |
638 |
610 if ( !$wp_filesystem->connect() ) |
639 if ( !$wp_filesystem->connect() ) |
618 |
647 |
619 return true; |
648 return true; |
620 } |
649 } |
621 |
650 |
622 /** |
651 /** |
623 * {@internal Missing Short Description}} |
652 * Determines which Filesystem Method to use. |
624 * |
653 * The priority of the Transports are: Direct, SSH2, FTP PHP Extension, FTP Sockets (Via Sockets class, or fsoxkopen()) |
625 * @since unknown |
654 * |
626 * |
655 * Note that the return value of this function can be overridden in 2 ways |
627 * @param unknown_type $args |
656 * - By defining FS_METHOD in your <code>wp-config.php</code> file |
|
657 * - By using the filesystem_method filter |
|
658 * Valid values for these are: 'direct', 'ssh', 'ftpext' or 'ftpsockets' |
|
659 * Plugins may also define a custom transport handler, See the WP_Filesystem function for more information. |
|
660 * |
|
661 * @since 2.5.0 |
|
662 * |
|
663 * @param array $args Connection details. |
628 * @param string $context Full path to the directory that is tested for being writable. |
664 * @param string $context Full path to the directory that is tested for being writable. |
629 * @return unknown |
665 * @return string The transport to use, see description for valid return values. |
630 */ |
666 */ |
631 function get_filesystem_method($args = array(), $context = false) { |
667 function get_filesystem_method($args = array(), $context = false) { |
632 $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' |
668 $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' |
633 |
669 |
634 if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ |
670 if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ |
635 if ( !$context ) |
671 if ( !$context ) |
636 $context = WP_CONTENT_DIR; |
672 $context = WP_CONTENT_DIR; |
637 $context = trailingslashit($context); |
673 $context = trailingslashit($context); |
638 $temp_file_name = $context . '.write-test-' . time(); |
674 $temp_file_name = $context . 'temp-write-test-' . time(); |
639 $temp_handle = @fopen($temp_file_name, 'w'); |
675 $temp_handle = @fopen($temp_file_name, 'w'); |
640 if ( $temp_handle ) { |
676 if ( $temp_handle ) { |
641 if ( getmyuid() == fileowner($temp_file_name) ) |
677 if ( getmyuid() == @fileowner($temp_file_name) ) |
642 $method = 'direct'; |
678 $method = 'direct'; |
643 @fclose($temp_handle); |
679 @fclose($temp_handle); |
644 unlink($temp_file_name); |
680 @unlink($temp_file_name); |
645 } |
681 } |
646 } |
682 } |
647 |
683 |
648 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2'; |
684 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2'; |
649 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; |
685 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; |
650 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread |
686 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread |
651 return apply_filters('filesystem_method', $method, $args); |
687 return apply_filters('filesystem_method', $method, $args); |
652 } |
688 } |
653 |
689 |
654 /** |
690 /** |
655 * {@internal Missing Short Description}} |
691 * Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
656 * |
692 * All chosen/entered details are saved, Excluding the Password. |
657 * @since unknown |
693 * |
658 * |
694 * Hostnames may be in the form of hostname:portnumber (eg: wordpress.org:2467) to specify an alternate FTP/SSH port. |
659 * @param unknown_type $form_post |
695 * |
660 * @param unknown_type $type |
696 * Plugins may override this form by returning true|false via the <code>request_filesystem_credentials</code> filter. |
661 * @param unknown_type $error |
697 * |
662 * @return unknown |
698 * @since 2.5.0 |
|
699 * |
|
700 * @param string $form_post the URL to post the form to |
|
701 * @param string $type the chosen Filesystem method in use |
|
702 * @param boolean $error if the current request has failed to connect |
|
703 * @param string $context The directory which is needed access to, The write-test will be performed on this directory by get_filesystem_method() |
|
704 * @return boolean False on failure. True on success. |
663 */ |
705 */ |
664 function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) { |
706 function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) { |
665 $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context); |
707 $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context); |
666 if ( '' !== $req_cred ) |
708 if ( '' !== $req_cred ) |
667 return $req_cred; |
709 return $req_cred; |
673 return true; |
715 return true; |
674 |
716 |
675 $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => '')); |
717 $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => '')); |
676 |
718 |
677 // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) |
719 // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) |
678 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); |
720 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? stripslashes($_POST['hostname']) : $credentials['hostname']); |
679 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); |
721 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? stripslashes($_POST['username']) : $credentials['username']); |
680 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : ''); |
722 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? stripslashes($_POST['password']) : ''); |
681 |
723 |
682 // Check to see if we are setting the public/private keys for ssh |
724 // Check to see if we are setting the public/private keys for ssh |
683 $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : ''); |
725 $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? stripslashes($_POST['public_key']) : ''); |
684 $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : ''); |
726 $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? stripslashes($_POST['private_key']) : ''); |
685 |
727 |
686 //sanitize the hostname, Some people might pass in odd-data: |
728 //sanitize the hostname, Some people might pass in odd-data: |
687 $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off |
729 $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off |
688 |
730 |
689 if ( strpos($credentials['hostname'], ':') ) |
731 if ( strpos($credentials['hostname'], ':') ) { |
690 list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2); |
732 list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2); |
691 else |
733 if ( ! is_numeric($credentials['port']) ) |
|
734 unset($credentials['port']); |
|
735 } else { |
692 unset($credentials['port']); |
736 unset($credentials['port']); |
693 |
737 } |
694 if ( defined('FTP_SSH') || (defined('FS_METHOD') && 'ssh' == FS_METHOD) ) |
738 |
|
739 if ( (defined('FTP_SSH') && FTP_SSH) || (defined('FS_METHOD') && 'ssh' == FS_METHOD) ) |
695 $credentials['connection_type'] = 'ssh'; |
740 $credentials['connection_type'] = 'ssh'; |
696 else if ( defined('FTP_SSL') && 'ftpext' == $type ) //Only the FTP Extension understands SSL |
741 else if ( (defined('FTP_SSL') && FTP_SSL) && 'ftpext' == $type ) //Only the FTP Extension understands SSL |
697 $credentials['connection_type'] = 'ftps'; |
742 $credentials['connection_type'] = 'ftps'; |
698 else if ( !empty($_POST['connection_type']) ) |
743 else if ( !empty($_POST['connection_type']) ) |
699 $credentials['connection_type'] = $_POST['connection_type']; |
744 $credentials['connection_type'] = stripslashes($_POST['connection_type']); |
700 else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP |
745 else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP |
701 $credentials['connection_type'] = 'ftp'; |
746 $credentials['connection_type'] = 'ftp'; |
702 |
747 |
703 if ( ! $error && |
748 if ( ! $error && |
704 ( |
749 ( |
723 $error_string = __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.'); |
768 $error_string = __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.'); |
724 if ( is_wp_error($error) ) |
769 if ( is_wp_error($error) ) |
725 $error_string = $error->get_error_message(); |
770 $error_string = $error->get_error_message(); |
726 echo '<div id="message" class="error"><p>' . $error_string . '</p></div>'; |
771 echo '<div id="message" class="error"><p>' . $error_string . '</p></div>'; |
727 } |
772 } |
|
773 |
|
774 $types = array(); |
|
775 if ( extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen') ) |
|
776 $types[ 'ftp' ] = __('FTP'); |
|
777 if ( extension_loaded('ftp') ) //Only this supports FTPS |
|
778 $types[ 'ftps' ] = __('FTPS (SSL)'); |
|
779 if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) |
|
780 $types[ 'ssh' ] = __('SSH2'); |
|
781 |
|
782 $types = apply_filters('fs_ftp_connection_types', $types, $credentials, $type, $error, $context); |
|
783 |
728 ?> |
784 ?> |
729 <script type="text/javascript"> |
785 <script type="text/javascript"> |
730 <!-- |
786 <!-- |
731 jQuery(function($){ |
787 jQuery(function($){ |
732 jQuery("#ssh").click(function () { |
788 jQuery("#ssh").click(function () { |
759 <tr valign="top"> |
815 <tr valign="top"> |
760 <th scope="row"><label for="password"><?php _e('Password') ?></label></th> |
816 <th scope="row"><label for="password"><?php _e('Password') ?></label></th> |
761 <td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td> |
817 <td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td> |
762 </tr> |
818 </tr> |
763 |
819 |
764 <?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?> |
820 <?php if ( isset($types['ssh']) ) : ?> |
765 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>"> |
821 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>"> |
766 <th scope="row"><?php _e('Authentication Keys') ?> |
822 <th scope="row"><?php _e('Authentication Keys') ?> |
767 <div class="key-labels textright"> |
823 <div class="key-labels textright"> |
768 <label for="public_key"><?php _e('Public Key:') ?></label ><br /> |
824 <label for="public_key"><?php _e('Public Key:') ?></label ><br /> |
769 <label for="private_key"><?php _e('Private Key:') ?></label> |
825 <label for="private_key"><?php _e('Private Key:') ?></label> |
775 |
831 |
776 <tr valign="top"> |
832 <tr valign="top"> |
777 <th scope="row"><?php _e('Connection Type') ?></th> |
833 <th scope="row"><?php _e('Connection Type') ?></th> |
778 <td> |
834 <td> |
779 <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend> |
835 <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend> |
780 <label><input id="ftp" name="connection_type" type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label> |
836 <?php |
781 <?php if ( 'ftpext' == $type ) : ?> |
837 |
782 <br /><label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTPS (SSL)') ?></label> |
838 $disabled = (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH) ? ' disabled="disabled"' : ''; |
783 <?php endif; ?> |
839 |
784 <?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?> |
840 foreach ( $types as $name => $text ) : ?> |
785 <br /><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label> |
841 <label for="<?php echo esc_attr($name) ?>"> |
786 <?php endif; ?> |
842 <input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>" <?php checked($name, $connection_type); echo $disabled; ?>/> |
|
843 <?php echo $text ?> |
|
844 </label> |
|
845 <?php endforeach; ?> |
787 </fieldset> |
846 </fieldset> |
788 </td> |
847 </td> |
789 </tr> |
848 </tr> |
790 </table> |
849 </table> |
791 |
850 |
792 <?php if ( isset( $_POST['version'] ) ) : ?> |
851 <?php if ( isset( $_POST['version'] ) ) : ?> |
793 <input type="hidden" name="version" value="<?php echo esc_attr($_POST['version']) ?>" /> |
852 <input type="hidden" name="version" value="<?php echo esc_attr(stripslashes($_POST['version'])) ?>" /> |
794 <?php endif; ?> |
853 <?php endif; ?> |
795 <?php if ( isset( $_POST['locale'] ) ) : ?> |
854 <?php if ( isset( $_POST['locale'] ) ) : ?> |
796 <input type="hidden" name="locale" value="<?php echo esc_attr($_POST['locale']) ?>" /> |
855 <input type="hidden" name="locale" value="<?php echo esc_attr(stripslashes($_POST['locale'])) ?>" /> |
797 <?php endif; ?> |
856 <?php endif; ?> |
798 <p class="submit"> |
857 <p class="submit"> |
799 <input id="upgrade" name="upgrade" type="submit" class="button" value="<?php esc_attr_e('Proceed'); ?>" /> |
858 <input id="upgrade" name="upgrade" type="submit" class="button" value="<?php esc_attr_e('Proceed'); ?>" /> |
800 </p> |
859 </p> |
801 </div> |
860 </div> |