| 1 |
<?php |
| 2 |
|
| 3 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- verified on settings page |
| 4 |
namespace WPDataAccess\Settings { |
| 5 |
|
| 6 |
use WPDataAccess\Drive\WPDA_Drives; |
| 7 |
use WPDataAccess\Drive\WPDA_Dropbox; |
| 8 |
use WPDataAccess\Drive\WPDA_Ftp; |
| 9 |
use WPDataAccess\Drive\WPDA_Google_Drive; |
| 10 |
use WPDataAccess\Drive\WPDA_Local; |
| 11 |
use WPDataAccess\Drive\WPDA_Sftp; |
| 12 |
use WPDataAccess\Utilities\WPDA_Message_Box; |
| 13 |
use WPDataAccess\WPDA; |
| 14 |
|
| 15 |
class WPDA_Settings_Drives extends WPDA_Settings { |
| 16 |
|
| 17 |
private $drives = null; |
| 18 |
private $canSftp = false; |
| 19 |
|
| 20 |
private function get_drive( $drive_type ) { |
| 21 |
|
| 22 |
if ( is_array( $this->drives ) ) { |
| 23 |
return array_filter( |
| 24 |
$this->drives, |
| 25 |
function( $v, $k ) use ( $drive_type ) { |
| 26 |
return $v['type'] === $drive_type; |
| 27 |
}, ARRAY_FILTER_USE_BOTH |
| 28 |
); |
| 29 |
} else { |
| 30 |
return array(); |
| 31 |
} |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
private function save_local_drive() { |
| 36 |
|
| 37 |
$local_file_system = trim( sanitize_text_field( wp_unslash( $_POST['local_file_system'] ) ) ); // phpcs:ignore |
| 38 |
$local_enabled = isset( $_POST['local_enabled'] ) && 'on' === $_POST['local_enabled']; // phpcs:ignore |
| 39 |
|
| 40 |
if ( '' === $local_file_system ) { |
| 41 |
WPDA_Drives::delete_drive( 'local' ); |
| 42 |
} else { |
| 43 |
$local_drive = new WPDA_Local(); |
| 44 |
if ( |
| 45 |
! $local_drive->authorize( |
| 46 |
array( |
| 47 |
'path' => $local_file_system, |
| 48 |
), |
| 49 |
$local_enabled |
| 50 |
) |
| 51 |
) { |
| 52 |
$msg = new WPDA_Message_Box( |
| 53 |
array( |
| 54 |
'message_text' => 'Could not add local folder', |
| 55 |
'message_type' => 'error', |
| 56 |
'message_is_dismissible' => false, |
| 57 |
) |
| 58 |
); |
| 59 |
$msg->box(); |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
} |
| 64 |
|
| 65 |
private function save_ftp_server( $index ) { |
| 66 |
|
| 67 |
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated |
| 68 |
$ftp_server_name = trim( sanitize_text_field( wp_unslash( $_POST['ftp_server_name'][ $index ] ) ) ); |
| 69 |
$ftp_enabled = isset( $_POST['ftp_enabled'] ) && 'on' === $_POST['ftp_enabled'][ $index ]; |
| 70 |
$ftp_host = sanitize_text_field( wp_unslash( $_POST['ftp_host'][ $index ] ) ); |
| 71 |
$ftp_username = sanitize_text_field( wp_unslash( $_POST['ftp_username'][ $index ] ) ); |
| 72 |
$ftp_password = sanitize_text_field( wp_unslash( $_POST['ftp_password'][ $index ] ) ); |
| 73 |
$ftp_port = sanitize_text_field( wp_unslash( $_POST['ftp_port'][ $index ] ) ); |
| 74 |
$ftp_ssl = isset( $_POST['ftp_ssl'] ) && 'on' === $_POST['ftp_ssl'][ $index ]; |
| 75 |
$ftp_passive = isset( $_POST['ftp_passive'] ) && 'on' === $_POST['ftp_passive'][ $index ]; |
| 76 |
$ftp_timeout = sanitize_text_field( wp_unslash( $_POST['ftp_timeout'][ $index ] ) ); |
| 77 |
$ftp_directory = sanitize_text_field( wp_unslash( $_POST['ftp_directory'][ $index ] ) ); |
| 78 |
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated |
| 79 |
|
| 80 |
$ftp_drive = new WPDA_Ftp( $ftp_server_name ); |
| 81 |
if ( |
| 82 |
! $ftp_drive->authorize( |
| 83 |
array( |
| 84 |
'host' => $ftp_host, |
| 85 |
'username' => $ftp_username, |
| 86 |
'password' => $ftp_password, |
| 87 |
'port' => $ftp_port, |
| 88 |
'ssl' => $ftp_ssl, |
| 89 |
'passive' => $ftp_passive, |
| 90 |
'timeout' => $ftp_timeout, |
| 91 |
'directory' => $ftp_directory, |
| 92 |
), |
| 93 |
$ftp_enabled |
| 94 |
) |
| 95 |
) { |
| 96 |
$msg = new WPDA_Message_Box( |
| 97 |
array( |
| 98 |
'message_text' => 'Could not add FTP server', |
| 99 |
'message_type' => 'error', |
| 100 |
'message_is_dismissible' => false, |
| 101 |
) |
| 102 |
); |
| 103 |
$msg->box(); |
| 104 |
} |
| 105 |
|
| 106 |
} |
| 107 |
|
| 108 |
private function save_sftp_server( $index ) { |
| 109 |
|
| 110 |
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated |
| 111 |
$sftp_server_name = trim( sanitize_text_field( wp_unslash( $_POST['sftp_server_name'][ $index ] ) ) ); |
| 112 |
$sftp_enabled = isset( $_POST['sftp_enabled'] ) && 'on' === $_POST['sftp_enabled'][ $index ]; |
| 113 |
$sftp_host = sanitize_text_field( wp_unslash( $_POST['sftp_host'][ $index ] ) ); |
| 114 |
$sftp_username = sanitize_text_field( wp_unslash( $_POST['sftp_username'][ $index ] ) ); |
| 115 |
$sftp_password = sanitize_text_field( wp_unslash( $_POST['sftp_password'][ $index ] ) ); |
| 116 |
$sftp_port = sanitize_text_field( wp_unslash( $_POST['sftp_port'][ $index ] ) ); |
| 117 |
$sftp_timeout = sanitize_text_field( wp_unslash( $_POST['sftp_timeout'][ $index ] ) ); |
| 118 |
$sftp_directory = sanitize_text_field( wp_unslash( $_POST['sftp_directory'][ $index ] ) ); |
| 119 |
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated |
| 120 |
|
| 121 |
$ftp_drive = new WPDA_Sftp( $sftp_server_name ); |
| 122 |
if ( |
| 123 |
! $ftp_drive->authorize( |
| 124 |
array( |
| 125 |
'host' => $sftp_host, |
| 126 |
'username' => $sftp_username, |
| 127 |
'password' => $sftp_password, |
| 128 |
'port' => $sftp_port, |
| 129 |
'timeout' => $sftp_timeout, |
| 130 |
'directory' => $sftp_directory, |
| 131 |
), |
| 132 |
$sftp_enabled |
| 133 |
) |
| 134 |
) { |
| 135 |
$msg = new WPDA_Message_Box( |
| 136 |
array( |
| 137 |
'message_text' => 'Could not add SFTP server', |
| 138 |
'message_type' => 'error', |
| 139 |
'message_is_dismissible' => false, |
| 140 |
) |
| 141 |
); |
| 142 |
$msg->box(); |
| 143 |
} |
| 144 |
|
| 145 |
} |
| 146 |
|
| 147 |
private function save_dropbox() { |
| 148 |
|
| 149 |
$dropbox_authorization = trim( sanitize_text_field( wp_unslash( $_POST['dropbox_authorization'] ) ) ); // phpcs:ignore |
| 150 |
|
| 151 |
if ( '' !== trim( $dropbox_authorization ) ) { |
| 152 |
$dropbox_drive = new WPDA_Dropbox(); |
| 153 |
$response = $dropbox_drive->authorize( $dropbox_authorization ); |
| 154 |
if ( false === $response ) { |
| 155 |
$msg = new WPDA_Message_Box( |
| 156 |
array( |
| 157 |
'message_text' => 'Could not update Dropbox', |
| 158 |
'message_type' => 'error', |
| 159 |
'message_is_dismissible' => false, |
| 160 |
) |
| 161 |
); |
| 162 |
$msg->box(); |
| 163 |
} elseif ( is_string( $response ) ) { |
| 164 |
$msg = new WPDA_Message_Box( |
| 165 |
array( |
| 166 |
'message_text' => $response, |
| 167 |
'message_type' => 'error', |
| 168 |
'message_is_dismissible' => false, |
| 169 |
) |
| 170 |
); |
| 171 |
$msg->box(); |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
} |
| 176 |
|
| 177 |
private function update_dropbox() { |
| 178 |
|
| 179 |
$dropbox_enabled = isset( $_POST['dropbox_enabled'] ) && 'on' === $_POST['dropbox_enabled']; // phpcs:ignore |
| 180 |
|
| 181 |
$dropbox_drive = WPDA_Drives::get_drive( 'dropbox' ); |
| 182 |
if ( false !== $dropbox_drive ) { |
| 183 |
$dropbox_drive->toggle( $dropbox_enabled ); |
| 184 |
} |
| 185 |
|
| 186 |
} |
| 187 |
|
| 188 |
private function save_google_drive() { |
| 189 |
|
| 190 |
$google_drive_authorization = trim( sanitize_text_field( wp_unslash( $_POST['google_drive_authorization'] ) ) ); // phpcs:ignore |
| 191 |
|
| 192 |
if ( '' !== trim( $google_drive_authorization ) ) { |
| 193 |
$google_drive_drive = new WPDA_Google_Drive(); |
| 194 |
$response = $google_drive_drive->authorize( $google_drive_authorization ); |
| 195 |
if ( false === $response ) { |
| 196 |
$msg = new WPDA_Message_Box( |
| 197 |
array( |
| 198 |
'message_text' => 'Could not update Google Drive', |
| 199 |
'message_type' => 'error', |
| 200 |
'message_is_dismissible' => false, |
| 201 |
) |
| 202 |
); |
| 203 |
$msg->box(); |
| 204 |
} elseif ( is_string( $response ) ) { |
| 205 |
$msg = new WPDA_Message_Box( |
| 206 |
array( |
| 207 |
'message_text' => $response, |
| 208 |
'message_type' => 'error', |
| 209 |
'message_is_dismissible' => false, |
| 210 |
) |
| 211 |
); |
| 212 |
$msg->box(); |
| 213 |
} |
| 214 |
} |
| 215 |
|
| 216 |
} |
| 217 |
|
| 218 |
private function update_google_drive() { |
| 219 |
|
| 220 |
$google_drive_enabled = isset( $_POST['google_drive_enabled'] ) && 'on' === $_POST['google_drive_enabled']; // phpcs:ignore -- verified |
| 221 |
|
| 222 |
$google_drive_drive = WPDA_Drives::get_drive( 'google_drive' ); |
| 223 |
if ( false !== $google_drive_drive ) { |
| 224 |
$google_drive_drive->toggle( $google_drive_enabled ); |
| 225 |
} |
| 226 |
|
| 227 |
} |
| 228 |
|
| 229 |
protected function add_content() { |
| 230 |
|
| 231 |
if ( function_exists('ftp_ssl_connect') ) { |
| 232 |
$this->canSftp = true; |
| 233 |
} |
| 234 |
|
| 235 |
if ( isset( $_POST['action'] ) ) { |
| 236 |
$action = sanitize_text_field( wp_unslash( $_POST['action'] ) ); // input var okay. |
| 237 |
|
| 238 |
// Security check. |
| 239 |
$wp_nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : ''; // input var okay. |
| 240 |
if ( ! wp_verify_nonce( $wp_nonce, 'wpda-drives-settings-' . WPDA::get_current_user_login() ) ) { |
| 241 |
wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); |
| 242 |
} |
| 243 |
|
| 244 |
if ( 'save' === $action ) { |
| 245 |
if ( isset( $_POST['local_file_system'] ) ) { |
| 246 |
// Local file system |
| 247 |
$this->save_local_drive(); |
| 248 |
} |
| 249 |
|
| 250 |
if ( |
| 251 |
isset( |
| 252 |
$_POST['ftp_server_name'], |
| 253 |
$_POST['old_ftp_server_name'], |
| 254 |
$_POST['ftp_host'], |
| 255 |
$_POST['ftp_username'], |
| 256 |
$_POST['ftp_password'], |
| 257 |
$_POST['ftp_port'], |
| 258 |
$_POST['ftp_timeout'], |
| 259 |
$_POST['ftp_directory'] |
| 260 |
) |
| 261 |
) { |
| 262 |
// FTP servers |
| 263 |
$count = count( $_POST['ftp_server_name'] ); |
| 264 |
for ( $i = 0; $i < $count; $i++ ) { |
| 265 |
$this->save_ftp_server( $i ); |
| 266 |
} |
| 267 |
} |
| 268 |
|
| 269 |
if ( |
| 270 |
isset( |
| 271 |
$_POST['sftp_server_name'], |
| 272 |
$_POST['old_sftp_server_name'], |
| 273 |
$_POST['sftp_host'], |
| 274 |
$_POST['sftp_username'], |
| 275 |
$_POST['sftp_password'], |
| 276 |
$_POST['sftp_port'], |
| 277 |
$_POST['sftp_timeout'], |
| 278 |
$_POST['sftp_directory'] |
| 279 |
) |
| 280 |
) { |
| 281 |
// SFTP servers |
| 282 |
$count = count( $_POST['sftp_server_name'] ); |
| 283 |
for ( $i = 0; $i < $count; $i++ ) { |
| 284 |
$this->save_sftp_server( $i ); |
| 285 |
} |
| 286 |
} |
| 287 |
|
| 288 |
if ( isset( $_POST['dropbox_authorization'] ) ) { |
| 289 |
$this->save_dropbox(); |
| 290 |
} else if ( isset( $_POST['dropbox_authorized'] ) ) { |
| 291 |
$this->update_dropbox(); |
| 292 |
} |
| 293 |
|
| 294 |
if ( isset( $_POST['google_drive_authorization'] ) ) { |
| 295 |
$this->save_google_drive(); |
| 296 |
} else if ( isset( $_POST['google_drive_authorized'] ) ) { |
| 297 |
$this->update_google_drive(); |
| 298 |
} |
| 299 |
|
| 300 |
// Delete drives |
| 301 |
if ( isset( $_POST['deleted_drives'] ) ) { |
| 302 |
$deleted_drives = sanitize_text_field( wp_unslash( $_POST['deleted_drives'] ) ); |
| 303 |
$drive_names = explode( ',', $deleted_drives ); |
| 304 |
foreach ( $drive_names as $drive_name ) { |
| 305 |
WPDA_Drives::delete_drive( $drive_name); |
| 306 |
} |
| 307 |
} |
| 308 |
|
| 309 |
WPDA_Drives::save(); |
| 310 |
} elseif ( 'setdefaults' === $action ) { |
| 311 |
// Set all back-end settings back to default. |
| 312 |
} |
| 313 |
|
| 314 |
$msg = new WPDA_Message_Box( |
| 315 |
array( |
| 316 |
'message_text' => __( 'Settings saved', 'wp-data-access' ), |
| 317 |
) |
| 318 |
); |
| 319 |
$msg->box(); |
| 320 |
} |
| 321 |
|
| 322 |
$this->drives = WPDA_Drives::get_drives(); |
| 323 |
|
| 324 |
$this->css(); |
| 325 |
$this->js(); |
| 326 |
|
| 327 |
?> |
| 328 |
|
| 329 |
<form |
| 330 |
id="wpda_settings_drives" |
| 331 |
method="post" |
| 332 |
action="?page=<?php echo esc_attr( $this->page ); ?>&tab=drives" |
| 333 |
> |
| 334 |
<table class="wpda-table-settings"> |
| 335 |
|
| 336 |
<tr> |
| 337 |
<th></th> |
| 338 |
<td> |
| 339 |
Plugin drives for storing files generated by <strong>unattended scheduled exports</strong>. |
| 340 |
</td> |
| 341 |
</tr> |
| 342 |
|
| 343 |
<?php |
| 344 |
$local = $this->get_drive( 'local' ); |
| 345 |
if ( isset( $local['local'] ) ) { |
| 346 |
$local_drive = $local['local']; |
| 347 |
} |
| 348 |
?> |
| 349 |
<tr id="local_main_container"> |
| 350 |
<th> |
| 351 |
Local File System |
| 352 |
</th> |
| 353 |
<td> |
| 354 |
<div> |
| 355 |
<div> |
| 356 |
<i>Save files to the local file system.</i> |
| 357 |
</div> |
| 358 |
|
| 359 |
<div> |
| 360 |
<label style="display:block">Enter full local path:</label> |
| 361 |
<input type="text" name="local_file_system" style="width: 240px" value="<?php echo isset( $local_drive['drive']['path'] ) ? $local_drive['drive']['path'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput ?>" /> |
| 362 |
<div> </div> |
| 363 |
<div> |
| 364 |
Verify that the folder exists and that the server has permission to write files to it. |
| 365 |
</div> |
| 366 |
<div> </div> |
| 367 |
<label style="font-weight: normal"> |
| 368 |
<input |
| 369 |
type="checkbox" |
| 370 |
name="local_enabled" |
| 371 |
<?php echo isset( $local_drive['enabled'] ) && $local_drive['enabled'] ? 'checked' : ''; ?> |
| 372 |
/> <?php esc_html_e( 'Activate', 'wp-data-access' ); ?> |
| 373 |
</label> |
| 374 |
</div> |
| 375 |
</div> |
| 376 |
</td> |
| 377 |
</tr> |
| 378 |
|
| 379 |
<tr id="ftp_main_container"> |
| 380 |
<th> |
| 381 |
FTP Server |
| 382 |
</th> |
| 383 |
<td> |
| 384 |
<div id="ftp_container"> |
| 385 |
<div> |
| 386 |
<i>Upload files to an FTP server.</i> |
| 387 |
<span> |
| 388 |
<a href="javascript:void(0)" |
| 389 |
onclick="ftpContainer(true)" |
| 390 |
style="text-decoration:none;" |
| 391 |
class="wpda_tooltip" |
| 392 |
title="Add new FTP Server"> |
| 393 |
<span class="dashicons dashicons-plus-alt" style="font-size:18px;"></span> |
| 394 |
</a> |
| 395 |
</span> |
| 396 |
</div> |
| 397 |
|
| 398 |
<?php |
| 399 |
$ftp_drives = $this->get_drive( 'ftp' ); |
| 400 |
foreach ( $ftp_drives as $drive_name => $ftp_drive ) { |
| 401 |
?> |
| 402 |
<script> |
| 403 |
ftpContainer( |
| 404 |
false, |
| 405 |
"<?php echo esc_attr( $drive_name ); ?>", |
| 406 |
<?php echo isset( $ftp_drive['enabled'] ) && true === $ftp_drive['enabled'] ? 1 : 0; ?>, |
| 407 |
"<?php echo isset( $ftp_drive['drive']['host'] ) ? esc_attr( $ftp_drive['drive']['host'] ) : ''; ?>", |
| 408 |
"<?php echo isset( $ftp_drive['drive']['username'] ) ? esc_attr( $ftp_drive['drive']['username'] ) : ''; ?>", |
| 409 |
"<?php echo isset( $ftp_drive['drive']['password'] ) ? esc_attr( $ftp_drive['drive']['password'] ) : ''; ?>", |
| 410 |
"<?php echo isset( $ftp_drive['drive']['port'] ) ? esc_attr( $ftp_drive['drive']['port'] ) : ''; ?>", |
| 411 |
<?php echo isset( $ftp_drive['drive']['ssl'] ) && true === $ftp_drive['drive']['ssl'] ? 1 : 0; ?>, |
| 412 |
<?php echo isset( $ftp_drive['drive']['passive'] ) && true === $ftp_drive['drive']['passive'] ? 1 : 0; ?>, |
| 413 |
"<?php echo isset( $ftp_drive['drive']['timeout'] ) ? esc_attr( $ftp_drive['drive']['timeout'] ) : ''; ?>", |
| 414 |
"<?php echo isset( $ftp_drive['drive']['directory'] ) ? esc_attr( $ftp_drive['drive']['directory'] ) : '/'; ?>" |
| 415 |
) |
| 416 |
</script> |
| 417 |
<?php |
| 418 |
} |
| 419 |
?> |
| 420 |
</div> |
| 421 |
</td> |
| 422 |
</tr> |
| 423 |
|
| 424 |
<tr id="sftp_main_container"> |
| 425 |
<th> |
| 426 |
SFTP Server |
| 427 |
</th> |
| 428 |
<td> |
| 429 |
<div id="sftp_container"> |
| 430 |
<div> |
| 431 |
<i>Upload files securely via SFTP.</i> |
| 432 |
<span> |
| 433 |
<a href="javascript:void(0)" |
| 434 |
onclick="sftpContainer(true)" |
| 435 |
style="text-decoration:none;" |
| 436 |
class="wpda_tooltip" |
| 437 |
title="Add new SFTP Server"> |
| 438 |
<span class="dashicons dashicons-plus-alt" style="font-size:18px;"></span> |
| 439 |
</a> |
| 440 |
</span> |
| 441 |
</div> |
| 442 |
|
| 443 |
<?php |
| 444 |
$ftp_drives = $this->get_drive( 'sftp' ); |
| 445 |
foreach ( $ftp_drives as $drive_name => $ftp_drive ) { |
| 446 |
?> |
| 447 |
<script> |
| 448 |
sftpContainer( |
| 449 |
false, |
| 450 |
"<?php echo esc_attr( $drive_name ); ?>", |
| 451 |
<?php echo isset( $ftp_drive['enabled'] ) && true === $ftp_drive['enabled'] ? 1 : 0; ?>, |
| 452 |
"<?php echo isset( $ftp_drive['drive']['host'] ) ? esc_attr( $ftp_drive['drive']['host'] ) : ''; ?>", |
| 453 |
"<?php echo isset( $ftp_drive['drive']['username'] ) ? esc_attr( $ftp_drive['drive']['username'] ) : ''; ?>", |
| 454 |
"<?php echo isset( $ftp_drive['drive']['password'] ) ? esc_attr( $ftp_drive['drive']['password'] ) : ''; ?>", |
| 455 |
"<?php echo isset( $ftp_drive['drive']['port'] ) ? esc_attr( $ftp_drive['drive']['port'] ) : ''; ?>", |
| 456 |
"<?php echo isset( $ftp_drive['drive']['timeout'] ) ? esc_attr( $ftp_drive['drive']['timeout'] ) : ''; ?>", |
| 457 |
"<?php echo isset( $ftp_drive['drive']['directory'] ) ? esc_attr( $ftp_drive['drive']['directory'] ) : '/'; ?>" |
| 458 |
) |
| 459 |
</script> |
| 460 |
<?php |
| 461 |
} |
| 462 |
?> |
| 463 |
</div> |
| 464 |
</td> |
| 465 |
</tr> |
| 466 |
|
| 467 |
<?php |
| 468 |
$dropbox = $this->get_drive( 'dropbox' ); |
| 469 |
if ( isset( $dropbox['dropbox'] ) ) { |
| 470 |
$dropbox_drive = $dropbox['dropbox']; |
| 471 |
} |
| 472 |
$dropbox_client_id = WPDA_Dropbox::DROPBOX_CLIENT_ID; |
| 473 |
?> |
| 474 |
<tr id="dropbox_main_container"> |
| 475 |
<th> |
| 476 |
Dropbox |
| 477 |
</th> |
| 478 |
<td> |
| 479 |
<div> |
| 480 |
<div> |
| 481 |
<i>Store files in your Dropbox folder.</i> |
| 482 |
<?php |
| 483 |
if ( |
| 484 |
isset( |
| 485 |
$dropbox_drive['drive']['access_token'], |
| 486 |
$dropbox_drive['drive']['refresh_token'] |
| 487 |
) |
| 488 |
) { |
| 489 |
// Dropbox is already authorized |
| 490 |
?> |
| 491 |
<a href="javascript:void(0)" |
| 492 |
id="dropbox_delete" |
| 493 |
onclick="if (confirm('Are you sure you want to delete your Dropbox drive? This action cannot be undone!')) { jQuery('#dropbox_delete').hide(); jQuery('#dropbox_container').hide(); jQuery('#dropbox_container_unauthorize').show(); deleteDrive('dropbox'); }" |
| 494 |
style="text-decoration:none;" |
| 495 |
class="wpda_tooltip" |
| 496 |
title="Delete Dropbox drive"> |
| 497 |
<span class="dashicons dashicons-trash" style="font-size:18px;"></span> |
| 498 |
</a> |
| 499 |
<?php |
| 500 |
} |
| 501 |
?> |
| 502 |
</div> |
| 503 |
|
| 504 |
<div id="dropbox_container"> |
| 505 |
<?php |
| 506 |
if ( |
| 507 |
isset( |
| 508 |
$dropbox_drive['drive']['access_token'], |
| 509 |
$dropbox_drive['drive']['refresh_token'] |
| 510 |
) |
| 511 |
) { |
| 512 |
// Dropbox is already authorized |
| 513 |
?> |
| 514 |
<label style="font-weight: normal"> |
| 515 |
<input |
| 516 |
type="checkbox" |
| 517 |
name="dropbox_enabled" |
| 518 |
<?php echo isset( $dropbox_drive['enabled'] ) && $dropbox_drive['enabled'] ? 'checked' : ''; ?> |
| 519 |
/> <?php esc_html_e( 'Activate', 'wp-data-access' ); ?> |
| 520 |
</label> |
| 521 |
<input type="hidden" name="dropbox_authorized" /> |
| 522 |
<?php |
| 523 |
} else { |
| 524 |
// Dropbox not authorized |
| 525 |
?> |
| 526 |
<p style="margin-top: 0"> |
| 527 |
Storing export files in a Dropbox folder requires a Dropbox account. |
| 528 |
<a href="https://www.dropbox.com/" target="_blank">Create a Dropbox account if you don't have one.</a> |
| 529 |
</p> |
| 530 |
|
| 531 |
<ol> |
| 532 |
<li>Click the button below to authorize the Dropbox app</li> |
| 533 |
<li>Enter the authorization code in the text box below</li> |
| 534 |
<li>Press the <strong>Save Drive Settings</strong> button to activate</li> |
| 535 |
</ol> |
| 536 |
|
| 537 |
<div> </div> |
| 538 |
|
| 539 |
<a |
| 540 |
href="https://www.dropbox.com/oauth2/authorize?client_id=<?php echo esc_attr( $dropbox_client_id ); ?>&response_type=code&token_access_type=offline" |
| 541 |
target="_blank" |
| 542 |
class="button button-primary" |
| 543 |
> |
| 544 |
GET DROPBOX AUTHORIZATION CODE |
| 545 |
</a> |
| 546 |
|
| 547 |
<input type="text" name="dropbox_authorization" style="width: 240px" /> |
| 548 |
<?php |
| 549 |
} |
| 550 |
?> |
| 551 |
</div> |
| 552 |
|
| 553 |
<div id="dropbox_container_unauthorize" style="display:none"> |
| 554 |
<div> |
| 555 |
Press the <strong>Save Drive Settings</strong> button to complete this action. |
| 556 |
</div> |
| 557 |
</div> |
| 558 |
</div> |
| 559 |
</td> |
| 560 |
</tr> |
| 561 |
|
| 562 |
<?php |
| 563 |
$google_drive = $this->get_drive( 'google_drive' ); |
| 564 |
if ( isset( $google_drive['google_drive'] ) ) { |
| 565 |
$google_drive_drive = $google_drive['google_drive']; |
| 566 |
} |
| 567 |
$google_drive_client_id = WPDA_Google_Drive::GOOGLE_CLIENT_ID; |
| 568 |
$google_drive_redirect_uri = 'http://localhost'; |
| 569 |
?> |
| 570 |
<tr id="google_drive_main_container"> |
| 571 |
<th> |
| 572 |
Google Drive |
| 573 |
</th> |
| 574 |
<td> |
| 575 |
<div> |
| 576 |
<div> |
| 577 |
<i>Save files to your Google Drive.</i> |
| 578 |
<?php |
| 579 |
if ( |
| 580 |
isset( |
| 581 |
$google_drive_drive['drive']['access_token'], |
| 582 |
$google_drive_drive['drive']['refresh_token'] |
| 583 |
) |
| 584 |
) { |
| 585 |
// Google Drive is already authorized |
| 586 |
?> |
| 587 |
<a href="javascript:void(0)" |
| 588 |
id="google_drive_delete" |
| 589 |
onclick="if (confirm('Are you sure you want to delete your Google Drive? This action cannot be undone!')) { jQuery('#google_drive_delete').hide(); jQuery('#google_drive_container').hide(); jQuery('#google_drive_container_unauthorize').show(); deleteDrive('google_drive'); }" |
| 590 |
style="text-decoration:none;" |
| 591 |
class="wpda_tooltip" |
| 592 |
title="Delete Google Drive"> |
| 593 |
<span class="dashicons dashicons-trash" style="font-size:18px;"></span> |
| 594 |
</a> |
| 595 |
<?php |
| 596 |
} |
| 597 |
?> |
| 598 |
</div> |
| 599 |
|
| 600 |
<div id="google_drive_container"> |
| 601 |
<?php |
| 602 |
if ( |
| 603 |
isset( |
| 604 |
$google_drive_drive['drive']['access_token'], |
| 605 |
$google_drive_drive['drive']['refresh_token'] |
| 606 |
) |
| 607 |
) { |
| 608 |
// Google Drive is already authorized |
| 609 |
?> |
| 610 |
<label style="font-weight: normal"> |
| 611 |
<input |
| 612 |
type="checkbox" |
| 613 |
name="google_drive_enabled" |
| 614 |
<?php echo isset( $google_drive_drive['enabled'] ) && $google_drive_drive['enabled'] ? 'checked' : ''; ?> |
| 615 |
/> <?php esc_html_e( 'Activate', 'wp-data-access' ); ?> |
| 616 |
</label> |
| 617 |
<input type="hidden" name="google_drive_authorized" /> |
| 618 |
<?php |
| 619 |
} else { |
| 620 |
// Google Drive not authorized |
| 621 |
?> |
| 622 |
<p style="margin-top: 0"> |
| 623 |
Storing export files in a Google Drive folder requires a Google account. |
| 624 |
<a href="https://accounts.google.com/signup/v2/webcreateaccount?hl=en-GB&flowName=GlifWebSignIn&flowEntry=SignUp/" target="_blank">Create a Google account if you don't have one.</a> |
| 625 |
</p> |
| 626 |
|
| 627 |
<ol> |
| 628 |
<li>Click the button below to authorize the Google Drive app</li> |
| 629 |
<li>Enter the authorization code in the text box below</li> |
| 630 |
<li>Press the <strong>Save Drive Settings</strong> button to activate</li> |
| 631 |
</ol> |
| 632 |
|
| 633 |
<div> </div> |
| 634 |
|
| 635 |
<a |
| 636 |
href="https://accounts.google.com/o/oauth2/v2/auth?client_id=<?php echo esc_attr( $google_drive_client_id ); ?>&redirect_uri=<?php echo esc_attr( $google_drive_redirect_uri ); ?>&response_type=code&scope=https://www.googleapis.com/auth/drive.file%20https://www.googleapis.com/auth/drive.readonly&access_type=offline&prompt=consent" |
| 637 |
target="_blank" |
| 638 |
class="button button-primary" |
| 639 |
> |
| 640 |
GET GOOGLE DRIVE AUTHORIZATION CODE |
| 641 |
</a> |
| 642 |
|
| 643 |
<input type="text" name="google_drive_authorization" style="width: 240px" /> |
| 644 |
<?php |
| 645 |
} |
| 646 |
?> |
| 647 |
</div> |
| 648 |
|
| 649 |
<div id="google_drive_container_unauthorize" style="display:none"> |
| 650 |
<div> |
| 651 |
Press the <strong>Save Drive Settings</strong> button to complete this action. |
| 652 |
</div> |
| 653 |
</div> |
| 654 |
</div> |
| 655 |
</td> |
| 656 |
</tr> |
| 657 |
|
| 658 |
</table> |
| 659 |
|
| 660 |
<div class="wpda-table-settings-button"> |
| 661 |
<input type="hidden" name="action" value="save"/> |
| 662 |
<input type="hidden" name="deleted_drives" id="deleted_drives" /> |
| 663 |
<button type="submit" class="button button-primary"> |
| 664 |
<i class="fas fa-check wpda_icon_on_button"></i> |
| 665 |
<?php esc_html_e( 'Save Drive Settings', 'wp-data-access' ); ?> |
| 666 |
</button> |
| 667 |
<a href="javascript:void(0)" |
| 668 |
onclick="if (confirm('<?php esc_html_e( 'Reset to defaults?', 'wp-data-access' ); ?>')) { |
| 669 |
jQuery('input[name=\'action\']').val('setdefaults'); |
| 670 |
jQuery('#wpda_settings_drives').trigger('submit'); |
| 671 |
}" |
| 672 |
class="button button-secondary"> |
| 673 |
<i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 674 |
<?php esc_html_e( 'Reset Drive Settings To Defaults', 'wp-data-access' ); ?> |
| 675 |
</a> |
| 676 |
</div> |
| 677 |
|
| 678 |
<?php wp_nonce_field( 'wpda-drives-settings-' . WPDA::get_current_user_login(), '_wpnonce', false ); ?> |
| 679 |
|
| 680 |
</form> |
| 681 |
|
| 682 |
<?php |
| 683 |
|
| 684 |
} |
| 685 |
|
| 686 |
private function css() { |
| 687 |
?> |
| 688 |
|
| 689 |
<style> |
| 690 |
table.wpda-table-settings tr th, |
| 691 |
table.wpda-table-settings tr td { |
| 692 |
vertical-align: text-top; |
| 693 |
} |
| 694 |
|
| 695 |
table.wpda-table-settings tr th { |
| 696 |
white-space: nowrap; |
| 697 |
} |
| 698 |
|
| 699 |
table.wpda-table-settings tr td > div { |
| 700 |
display: grid; |
| 701 |
grid-gap: 20px; |
| 702 |
} |
| 703 |
|
| 704 |
table.wpda-table-settings tr td fieldset.wpda_fieldset { |
| 705 |
margin-right: 20px; |
| 706 |
} |
| 707 |
|
| 708 |
.form-control { |
| 709 |
line-height: 1.8rem; |
| 710 |
} |
| 711 |
|
| 712 |
.form-control > *:first-child { |
| 713 |
display: inline-block; |
| 714 |
width: 110px; |
| 715 |
text-align: right; |
| 716 |
} |
| 717 |
.form-control > *:last-child { |
| 718 |
display: inline-block; |
| 719 |
width: 240px; |
| 720 |
} |
| 721 |
|
| 722 |
.form-control-toolbar { |
| 723 |
display: inline-flex !important; |
| 724 |
grid-template-columns: auto auto; |
| 725 |
justify-content: space-between; |
| 726 |
align-items: center; |
| 727 |
} |
| 728 |
.form-control-toolbar div { |
| 729 |
display: flex; |
| 730 |
} |
| 731 |
.form-control-toolbar a { |
| 732 |
display: flex; |
| 733 |
} |
| 734 |
|
| 735 |
.form-control-toolbar a.form-control-details, |
| 736 |
.form-control-details { |
| 737 |
display: none; |
| 738 |
} |
| 739 |
|
| 740 |
.wpda-is-new .form-control-toolbar a.form-control-details { |
| 741 |
display: flex; |
| 742 |
} |
| 743 |
.wpda-is-new .form-control-details { |
| 744 |
display: block; |
| 745 |
} |
| 746 |
|
| 747 |
#sftp_main_container, |
| 748 |
#dropbox_main_container, |
| 749 |
#google_drive_main_container { |
| 750 |
display: none; |
| 751 |
} |
| 752 |
</style> |
| 753 |
|
| 754 |
<?php |
| 755 |
} |
| 756 |
|
| 757 |
private function js() { |
| 758 |
$drive_names = array(); |
| 759 |
foreach ( $this->drives as $drive_name => $drive ) { |
| 760 |
$drive_names[] = $drive_name; |
| 761 |
} |
| 762 |
?> |
| 763 |
|
| 764 |
<script> |
| 765 |
const driveNames = <?php echo json_encode( $drive_names ); ?>; |
| 766 |
|
| 767 |
jQuery(function() { |
| 768 |
jQuery( "#wpda_settings_drives" ).on( |
| 769 |
"submit", |
| 770 |
function() { |
| 771 |
let doSumbit = true; |
| 772 |
|
| 773 |
const ftpServerNames = jQuery("input[name='ftp_server_name[]']"); |
| 774 |
const oldFtpServerNames = jQuery("input[name='old_ftp_server_name[]']"); |
| 775 |
for (let i = 0; i < ftpServerNames.length; i++) { |
| 776 |
const ftpServerName = jQuery(ftpServerNames[i]).val().trim(); |
| 777 |
const oldFtpServerName = jQuery(oldFtpServerNames[i]).val().trim(); |
| 778 |
|
| 779 |
if (ftpServerName.trim() === "") { |
| 780 |
alert("FTP Server Name is required!"); |
| 781 |
doSumbit = false; |
| 782 |
} else if (driveNames.includes(ftpServerName) && oldFtpServerName !== ftpServerName) { |
| 783 |
alert("Drive Name is already taken!"); |
| 784 |
doSumbit = false; |
| 785 |
} |
| 786 |
} |
| 787 |
|
| 788 |
const sftpServerNames = jQuery("input[name='sftp_server_name[]']"); |
| 789 |
const oldSftpServerNames = jQuery("input[name='old_sftp_server_name[]']"); |
| 790 |
for (let i = 0; i < sftpServerNames.length; i++) { |
| 791 |
const sftpServerName = jQuery(sftpServerNames[i]).val().trim(); |
| 792 |
const oldSftpServerName = jQuery(oldSftpServerNames[i]).val().trim(); |
| 793 |
|
| 794 |
if (sftpServerName.trim() === "") { |
| 795 |
alert("SFTP Server Name is required!"); |
| 796 |
doSumbit = false; |
| 797 |
} else if (driveNames.includes(sftpServerName) && oldSftpServerName !== sftpServerName) { |
| 798 |
alert("Drive Name is already taken!"); |
| 799 |
doSumbit = false; |
| 800 |
} |
| 801 |
} |
| 802 |
|
| 803 |
// Make sure to send unchecked checkbox values |
| 804 |
jQuery("input[type=checkbox]").each( |
| 805 |
function() { |
| 806 |
if (!jQuery(this).is(":checked")) { |
| 807 |
jQuery(this).prop("checked", true); |
| 808 |
jQuery(this).val("off"); |
| 809 |
} |
| 810 |
} |
| 811 |
) |
| 812 |
|
| 813 |
return doSumbit; |
| 814 |
} |
| 815 |
); |
| 816 |
}); |
| 817 |
|
| 818 |
function deleteDrive(driveName) { |
| 819 |
if (jQuery("#deleted_drives").val() === "") { |
| 820 |
jQuery("#deleted_drives").val( |
| 821 |
jQuery("#deleted_drives").val() + driveName |
| 822 |
); |
| 823 |
} else { |
| 824 |
jQuery("#deleted_drives").val( |
| 825 |
jQuery("#deleted_drives").val() + "," + driveName |
| 826 |
); |
| 827 |
} |
| 828 |
} |
| 829 |
|
| 830 |
function ftpOnClick(event) { |
| 831 |
if ( |
| 832 |
jQuery(event.target) |
| 833 |
.closest('fieldset') |
| 834 |
.find('.form-control-details:visible') |
| 835 |
.length === 0 |
| 836 |
) { |
| 837 |
jQuery(event.target) |
| 838 |
.attr('title', 'Hide FTP Server details'); |
| 839 |
jQuery(event.target) |
| 840 |
.removeClass('dashicons-visibility') |
| 841 |
.addClass('dashicons-hidden'); |
| 842 |
jQuery(event.target) |
| 843 |
.closest('fieldset') |
| 844 |
.find('.form-control-details') |
| 845 |
.css('display', 'block'); |
| 846 |
jQuery(event.target) |
| 847 |
.closest('fieldset') |
| 848 |
.find('a.form-control-details') |
| 849 |
.css('display', 'flex'); |
| 850 |
} else { |
| 851 |
jQuery(event.target) |
| 852 |
.attr('title', 'Show FTP Server details'); |
| 853 |
jQuery(event.target) |
| 854 |
.removeClass('dashicons-hidden') |
| 855 |
.addClass('dashicons-visibility'); |
| 856 |
jQuery(event.target) |
| 857 |
.closest('fieldset') |
| 858 |
.find('.form-control-details') |
| 859 |
.hide(); |
| 860 |
} |
| 861 |
} |
| 862 |
|
| 863 |
function ftpContainer( |
| 864 |
isNew, |
| 865 |
driveName = '', |
| 866 |
isChecked = false, |
| 867 |
host = '', |
| 868 |
username = '', |
| 869 |
password = '', |
| 870 |
port = 21, |
| 871 |
ssl = false, |
| 872 |
passive = false, |
| 873 |
timeout = 90, |
| 874 |
directory = '/' |
| 875 |
) { |
| 876 |
const canSftp = <?php echo $this->canSftp ? 'true' : 'false'; ?>; |
| 877 |
if (!canSftp) { |
| 878 |
ssl = false; |
| 879 |
} |
| 880 |
const sftpMessage = !canSftp |
| 881 |
? `<div class="form-control form-control-details"> |
| 882 |
<label></label> |
| 883 |
<span style="line-height:1.6;margin-bottom:10px;"> |
| 884 |
<span class="dashicons dashicons-warning"></span> This server does not support SSL, ftp_ssl_connect is currently not available. (<a href="https://www.php.net/manual/en/function.ftp-ssl-connect.php" target="_blank">Read More...</a>) |
| 885 |
</span> |
| 886 |
</div>` |
| 887 |
: ""; |
| 888 |
|
| 889 |
jQuery("#ftp_container").append(` |
| 890 |
<fieldset class="wpda_fieldset${isNew ? ' wpda-is-new' : ''}"> |
| 891 |
|
| 892 |
<div class="form-control"> |
| 893 |
<label>Server Name</label> |
| 894 |
<input type="hidden" name="old_ftp_server_name[]" value="${driveName}" /> |
| 895 |
<input type="text" name="ftp_server_name[]" value="${driveName}" placeholder="New FTP Server" /> |
| 896 |
</div> |
| 897 |
|
| 898 |
<div class="form-control"> |
| 899 |
<div></div> |
| 900 |
<div class="form-control-toolbar"> |
| 901 |
<label> |
| 902 |
<input type="checkbox" name="ftp_enabled[]" ${isChecked ? 'checked' : ''} /> |
| 903 |
Activate |
| 904 |
</label> |
| 905 |
|
| 906 |
<div> |
| 907 |
<a href="javascript:void(0)" |
| 908 |
onclick="ftpOnClick(event)" |
| 909 |
style="text-decoration:none;${isNew ? 'display:none;' : ''}" |
| 910 |
class="wpda_tooltip form-control-icons" |
| 911 |
title="Show FTP Server details"> |
| 912 |
<span class="dashicons dashicons-visibility" style="font-size:18px;"></span> |
| 913 |
</a> |
| 914 |
|
| 915 |
<a href="javascript:void(0)" |
| 916 |
onclick="if (confirm('Are you sure you want to delete this FTP Server? This action cannot be undone!')) { jQuery(this).closest('fieldset').remove(); deleteDrive('${driveName}'); }" |
| 917 |
style="text-decoration:none;" |
| 918 |
class="wpda_tooltip" |
| 919 |
title="Delete FTP Server"> |
| 920 |
<span class="dashicons dashicons-trash" style="font-size:18px;"></span> |
| 921 |
</a> |
| 922 |
</div> |
| 923 |
</div> |
| 924 |
</div> |
| 925 |
|
| 926 |
<div class="form-control form-control-details"> |
| 927 |
<label>Host</label> |
| 928 |
<input type="text" name="ftp_host[]" value="${host}" /> |
| 929 |
</div> |
| 930 |
|
| 931 |
<div class="form-control form-control-details"> |
| 932 |
<label>Username</label> |
| 933 |
<input type="text" name="ftp_username[]" value="${username}" /> |
| 934 |
</div> |
| 935 |
|
| 936 |
<div class="form-control form-control-details"> |
| 937 |
<label>Password</label> |
| 938 |
<input type="password" name="ftp_password[]" value="${password}" /> |
| 939 |
</div> |
| 940 |
|
| 941 |
<div class="form-control form-control-details"> |
| 942 |
<label>Port</label> |
| 943 |
<input type="number" name="ftp_port[]" value="${port}" /> |
| 944 |
</div> |
| 945 |
|
| 946 |
<div class="form-control form-control-details"> |
| 947 |
<div></div> |
| 948 |
<div> |
| 949 |
<label> |
| 950 |
<input type="checkbox" name="ftp_ssl[]" ${ssl ? 'checked' : ''} <?php echo $this->canSftp ? '' : 'disabled="disabled"'; ?> /> |
| 951 |
SSL |
| 952 |
</label> |
| 953 |
|
| 954 |
<label> |
| 955 |
<input type="checkbox" name="ftp_passive[]" ${passive ? 'checked' : ''} /> |
| 956 |
Passive |
| 957 |
</label> |
| 958 |
</div> |
| 959 |
</div> |
| 960 |
${sftpMessage} |
| 961 |
|
| 962 |
<div class="form-control form-control-details"> |
| 963 |
<label>Timeout</label> |
| 964 |
<input type="number" name="ftp_timeout[]" value="${timeout}" /> |
| 965 |
</div> |
| 966 |
|
| 967 |
<div class="form-control form-control-details"> |
| 968 |
<label>Directory</label> |
| 969 |
<input type="text" name="ftp_directory[]" value="${directory}" /> |
| 970 |
</div> |
| 971 |
</fieldset> |
| 972 |
`); |
| 973 |
} |
| 974 |
|
| 975 |
function sftpContainer( |
| 976 |
isNew, |
| 977 |
driveName = '', |
| 978 |
isChecked = false, |
| 979 |
host = '', |
| 980 |
username = '', |
| 981 |
password = '', |
| 982 |
port = 21, |
| 983 |
timeout = 90, |
| 984 |
directory = '/' |
| 985 |
) { |
| 986 |
jQuery("#sftp_container").append(` |
| 987 |
<fieldset class="wpda_fieldset${isNew ? ' wpda-is-new' : ''}"> |
| 988 |
|
| 989 |
<div class="form-control"> |
| 990 |
<label>Server Name</label> |
| 991 |
<input type="hidden" name="old_sftp_server_name[]" value="${driveName}" /> |
| 992 |
<input type="text" name="sftp_server_name[]" value="${driveName}" placeholder="New SFTP Server" /> |
| 993 |
</div> |
| 994 |
|
| 995 |
<div class="form-control"> |
| 996 |
<div></div> |
| 997 |
<div class="form-control-toolbar"> |
| 998 |
<label> |
| 999 |
<input type="checkbox" name="sftp_enabled[]" ${isChecked ? 'checked' : ''} /> |
| 1000 |
Activate |
| 1001 |
</label> |
| 1002 |
|
| 1003 |
<div> |
| 1004 |
<a href="javascript:void(0)" |
| 1005 |
onclick="ftpOnClick(event)" |
| 1006 |
style="text-decoration:none;${isNew ? 'display:none;' : ''}" |
| 1007 |
class="wpda_tooltip form-control-icons" |
| 1008 |
title="Show FTP Server details"> |
| 1009 |
<span class="dashicons dashicons-visibility" style="font-size:18px;"></span> |
| 1010 |
</a> |
| 1011 |
|
| 1012 |
<a href="javascript:void(0)" |
| 1013 |
onclick="if (confirm('Are you sure you want to delete this SFTP Server? This action cannot be undone!')) { jQuery(this).closest('fieldset').remove(); deleteDrive('${driveName}'); }" |
| 1014 |
style="text-decoration:none;" |
| 1015 |
class="wpda_tooltip" |
| 1016 |
title="Delete SFTP Server"> |
| 1017 |
<span class="dashicons dashicons-trash" style="font-size:18px;"></span> |
| 1018 |
</a> |
| 1019 |
</div> |
| 1020 |
</div> |
| 1021 |
</div> |
| 1022 |
|
| 1023 |
<div class="form-control form-control-details"> |
| 1024 |
<label>Host</label> |
| 1025 |
<input type="text" name="sftp_host[]" value="${host}" /> |
| 1026 |
</div> |
| 1027 |
|
| 1028 |
<div class="form-control form-control-details"> |
| 1029 |
<label>Username</label> |
| 1030 |
<input type="text" name="sftp_username[]" value="${username}" /> |
| 1031 |
</div> |
| 1032 |
|
| 1033 |
<div class="form-control form-control-details"> |
| 1034 |
<label>Password</label> |
| 1035 |
<input type="password" name="sftp_password[]" value="${password}" /> |
| 1036 |
</div> |
| 1037 |
|
| 1038 |
<div class="form-control form-control-details"> |
| 1039 |
<label>Port</label> |
| 1040 |
<input type="number" name="sftp_port[]" value="${port}" /> |
| 1041 |
</div> |
| 1042 |
|
| 1043 |
<div class="form-control form-control-details"> |
| 1044 |
<label>Timeout</label> |
| 1045 |
<input type="number" name="sftp_timeout[]" value="${timeout}" /> |
| 1046 |
</div> |
| 1047 |
|
| 1048 |
<div class="form-control form-control-details"> |
| 1049 |
<label>Directory</label> |
| 1050 |
<input type="text" name="sftp_directory[]" value="${directory}" /> |
| 1051 |
</div> |
| 1052 |
|
| 1053 |
</fieldset> |
| 1054 |
`); |
| 1055 |
} |
| 1056 |
</script> |
| 1057 |
|
| 1058 |
<?php |
| 1059 |
} |
| 1060 |
|
| 1061 |
} |
| 1062 |
|
| 1063 |
}// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |