-
Notifications
You must be signed in to change notification settings - Fork 4
/
wp2static-addon-ftp.php
executable file
·61 lines (45 loc) · 1.31 KB
/
wp2static-addon-ftp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Plugin Name: WP2Static Add-on: FTP
* Plugin URI: https://wp2static.com
* Description: FTP as a deployment option for WP2Static.
* Version: 0.1
* Author: Leon Stafford
* Author URI: https://ljs.dev
* License: Unlicense
* License URI: http://unlicense.org
* Text Domain: wp2static-addon-ftp
* Domain Path: /languages
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'WP2STATIC_FTP_PATH', plugin_dir_path( __FILE__ ) );
require WP2STATIC_FTP_PATH . 'vendor/autoload.php';
// @codingStandardsIgnoreStart
$ajax_action = isset( $_POST['ajax_action'] ) ? $_POST['ajax_action'] : '';
// @codingStandardsIgnoreEnd
if ( $ajax_action == 'test_ftp' ) {
$ftp = new WP2Static\FTP();
$ftp->test_ftp();
wp_die();
return null;
} elseif ( $ajax_action == 'ftp_prepare_export' ) {
$ftp = new WP2Static\FTP();
$ftp->bootstrap();
$ftp->prepareDeploy();
wp_die();
return null;
} elseif ( $ajax_action == 'ftp_transfer_files' ) {
$ftp = new WP2Static\FTP();
$ftp->bootstrap();
$ftp->upload_files();
wp_die();
return null;
}
define( 'PLUGIN_NAME_VERSION', '0.1' );
function run_wp2static_addon_ftp() {
$plugin = new WP2Static\FTPAddon();
$plugin->run();
}
run_wp2static_addon_ftp();