Initial commit: WordPress wp-content (themes, plugins, languages)
- Theme: momentry (custom theme with REST API routes) - Plugins: code-snippets (contains all API proxies) - Languages: zh_TW translations - Excludes: cache, backups, uploads, logs
This commit is contained in:
@@ -0,0 +1,444 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Backups_Controller {
|
||||
|
||||
public static function index() {
|
||||
Ai1wm_Template::render(
|
||||
'backups/index',
|
||||
array(
|
||||
'backups' => Ai1wm_Backups::get_files(),
|
||||
'labels' => Ai1wm_Backups::get_labels(),
|
||||
'downloadable' => Ai1wm_Backups::are_downloadable(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function clean( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Delete storage files
|
||||
Ai1wm_Directory::delete( ai1wm_storage_path( $params ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function delete( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set archive
|
||||
$archive = null;
|
||||
if ( isset( $params['archive'] ) ) {
|
||||
$archive = trim( $params['archive'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access delete action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
Ai1wm_Backups::delete_file( $archive );
|
||||
Ai1wm_Backups::delete_label( $archive );
|
||||
} catch ( Ai1wm_Backups_Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function add_label( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set archive
|
||||
$archive = null;
|
||||
if ( isset( $params['archive'] ) ) {
|
||||
$archive = trim( $params['archive'] );
|
||||
}
|
||||
|
||||
// Set backup label
|
||||
$label = null;
|
||||
if ( isset( $params['label'] ) ) {
|
||||
$label = trim( $params['label'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access add label action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
Ai1wm_Backups::set_label( $archive, $label );
|
||||
} catch ( Ai1wm_Backups_Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_list( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_GET );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
Ai1wm_Template::render(
|
||||
'backups/backups-list',
|
||||
array(
|
||||
'backups' => Ai1wm_Backups::get_files(),
|
||||
'labels' => Ai1wm_Backups::get_labels(),
|
||||
'downloadable' => Ai1wm_Backups::are_downloadable(),
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_get_config( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// Open the archive file for reading
|
||||
$archive = new Ai1wm_Extractor( ai1wm_backup_path( $params ) );
|
||||
$archive->extract_by_files_array( ai1wm_storage_path( $params ), array( AI1WM_PACKAGE_NAME ) );
|
||||
$archive->close();
|
||||
} catch ( Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_check_encryption( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Read package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
|
||||
|
||||
// Parse package.json file
|
||||
$package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
|
||||
$package = json_decode( $package, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// No encryption provided
|
||||
if ( empty( $package['Encrypted'] ) || empty( $package['EncryptedSignature'] ) ) {
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check decryption support
|
||||
if ( ! ai1wm_can_decrypt() ) {
|
||||
ai1wm_json_response( array( 'errors' => array( __( 'Download a file from encrypted backup is not supported on this server. The process cannot continue. <a href="https://help.servmask.com/knowledgebase/unable-to-encrypt-and-decrypt-backups/" target="_blank">Technical details</a>', 'all-in-one-wp-migration' ) ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
// Validate decryption password
|
||||
if ( ! empty( $params['decryption_password'] ) ) {
|
||||
if ( ! ai1wm_is_decryption_password_valid( $package['EncryptedSignature'], $params['decryption_password'] ) ) {
|
||||
ai1wm_json_response( array( 'errors' => array( __( 'The decryption password is not valid. The process cannot continue.', 'all-in-one-wp-migration' ) ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'check' => true, 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function backup_list_content( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$files = array();
|
||||
|
||||
try {
|
||||
$archive = new Ai1wm_Extractor( ai1wm_backup_path( $params ) );
|
||||
if ( ! $archive->is_valid() ) {
|
||||
throw new Ai1wm_Backups_Exception(
|
||||
__( 'Could not list the backup content. Please ensure the backup file is accessible and not corrupted.', 'all-in-one-wp-migration' )
|
||||
);
|
||||
}
|
||||
|
||||
$files = $archive->list_files();
|
||||
$archive->close();
|
||||
} catch ( Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => $e->getMessage() ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( $files );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function download_file( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set decryption password
|
||||
$decryption_password = null;
|
||||
if ( isset( $params['decryption_password'] ) ) {
|
||||
$decryption_password = $params['decryption_password'];
|
||||
}
|
||||
|
||||
// Set file name
|
||||
$file_name = null;
|
||||
if ( isset( $params['file_name'] ) ) {
|
||||
$file_name = trim( $params['file_name'] );
|
||||
}
|
||||
|
||||
// Set file offset
|
||||
if ( isset( $params['file_offset'] ) ) {
|
||||
$file_offset = (int) $params['file_offset'];
|
||||
} else {
|
||||
$file_offset = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Read package.json file
|
||||
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
|
||||
|
||||
// Parse package.json file
|
||||
$config = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
|
||||
$config = json_decode( $config, true );
|
||||
|
||||
// Close handle
|
||||
ai1wm_close( $handle );
|
||||
|
||||
// Get compression type
|
||||
$compression_type = null;
|
||||
if ( ! empty( $config['Compression']['Enabled'] ) ) {
|
||||
$compression_type = $config['Compression']['Type'];
|
||||
}
|
||||
|
||||
// Open the archive file for reading
|
||||
$archive = new Ai1wm_Extractor( ai1wm_backup_path( $params ), $decryption_password, $compression_type );
|
||||
$archive->set_file_pointer( $file_offset );
|
||||
$archive->extract_one_file_to( ai1wm_storage_path( $params ) );
|
||||
$archive->close();
|
||||
|
||||
try {
|
||||
// Validate file name and file path for directory traversal
|
||||
if ( path_is_absolute( $file_name ) || validate_file( $file_name ) !== 0 ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Download file
|
||||
if ( ( $file_handle = ai1wm_open( ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . $file_name, 'rb' ) ) ) {
|
||||
while ( ! feof( $file_handle ) ) {
|
||||
$file_buffer = ai1wm_read( $file_handle, 1024 * 1024 );
|
||||
echo $file_buffer;
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
ai1wm_close( $file_handle );
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function download_backup( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access backups list action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// Download file
|
||||
if ( ( $file_handle = ai1wm_open( ai1wm_backup_path( $params ), 'rb' ) ) ) {
|
||||
while ( ! feof( $file_handle ) ) {
|
||||
$file_buffer = ai1wm_read( $file_handle, 1024 * 1024 );
|
||||
echo $file_buffer;
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
ai1wm_close( $file_handle );
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Export_Controller {
|
||||
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'export/index' );
|
||||
}
|
||||
|
||||
public static function export( $params = array() ) {
|
||||
global $ai1wm_params;
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( array_merge( $_GET, $_POST ) );
|
||||
}
|
||||
|
||||
// Set priority
|
||||
if ( ! isset( $params['priority'] ) ) {
|
||||
$params['priority'] = 5;
|
||||
}
|
||||
|
||||
$ai1wm_params = $params;
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
ai1wm_setup_environment();
|
||||
ai1wm_setup_errors();
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access export action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Loop over filters
|
||||
if ( ( $filters = ai1wm_get_filters( 'ai1wm_export' ) ) ) {
|
||||
while ( $hooks = current( $filters ) ) {
|
||||
if ( intval( $params['priority'] ) === key( $filters ) ) {
|
||||
foreach ( $hooks as $hook ) {
|
||||
try {
|
||||
|
||||
// Run function hook
|
||||
$params = call_user_func_array( $hook['function'], array( $params ) );
|
||||
|
||||
} catch ( Ai1wm_Database_Exception $e ) {
|
||||
do_action( 'ai1wm_status_export_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error code, 2: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Export failed (database error). Code: %1$s. Message: %2$s', 'all-in-one-wp-migration' ), $e->getCode(), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
status_header( $e->getCode() );
|
||||
ai1wm_json_response( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
|
||||
exit;
|
||||
} catch ( Exception $e ) {
|
||||
do_action( 'ai1wm_status_export_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Export failed: %s', 'all-in-one-wp-migration' ), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
Ai1wm_Status::error( __( 'Export failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
Ai1wm_Notification::error( __( 'Export failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Set completed
|
||||
$completed = true;
|
||||
if ( isset( $params['completed'] ) ) {
|
||||
$completed = (bool) $params['completed'];
|
||||
}
|
||||
|
||||
// Do request
|
||||
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
if ( ! defined( 'DOING_CRON' ) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $params['ai1wm_manual_export'] ) ) {
|
||||
ai1wm_json_response( $params );
|
||||
exit;
|
||||
}
|
||||
|
||||
wp_remote_request(
|
||||
apply_filters( 'ai1wm_http_export_url', add_query_arg( array( 'ai1wm_import' => 1 ), admin_url( 'admin-ajax.php?action=ai1wm_export' ) ) ),
|
||||
array(
|
||||
'method' => apply_filters( 'ai1wm_http_export_method', 'POST' ),
|
||||
'timeout' => apply_filters( 'ai1wm_http_export_timeout', 10 ),
|
||||
'blocking' => apply_filters( 'ai1wm_http_export_blocking', false ),
|
||||
'sslverify' => apply_filters( 'ai1wm_http_export_sslverify', false ),
|
||||
'headers' => apply_filters( 'ai1wm_http_export_headers', array() ),
|
||||
'body' => apply_filters( 'ai1wm_http_export_body', $params ),
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
next( $filters );
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public static function buttons() {
|
||||
$active_filters = array();
|
||||
$static_filters = array();
|
||||
|
||||
// All-in-One WP Migration
|
||||
if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_file', Ai1wm_Template::get_content( 'export/button-file' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_file', Ai1wm_Template::get_content( 'export/button-file' ) );
|
||||
}
|
||||
|
||||
// Add Google Drive Extension
|
||||
if ( defined( 'AI1WMGE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_gdrive', Ai1wm_Template::get_content( 'export/button-gdrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_gdrive', Ai1wm_Template::get_content( 'export/button-gdrive' ) );
|
||||
}
|
||||
|
||||
// Add FTP Extension
|
||||
if ( defined( 'AI1WMFE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_ftp', Ai1wm_Template::get_content( 'export/button-ftp' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_ftp', Ai1wm_Template::get_content( 'export/button-ftp' ) );
|
||||
}
|
||||
|
||||
// Add Dropbox Extension
|
||||
if ( defined( 'AI1WMDE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_dropbox', Ai1wm_Template::get_content( 'export/button-dropbox' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_dropbox', Ai1wm_Template::get_content( 'export/button-dropbox' ) );
|
||||
}
|
||||
|
||||
// Add Amazon S3 Extension
|
||||
if ( defined( 'AI1WMSE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_s3', Ai1wm_Template::get_content( 'export/button-s3' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_s3', Ai1wm_Template::get_content( 'export/button-s3' ) );
|
||||
}
|
||||
|
||||
// Add OneDrive Extension
|
||||
if ( defined( 'AI1WMOE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_onedrive', Ai1wm_Template::get_content( 'export/button-onedrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_onedrive', Ai1wm_Template::get_content( 'export/button-onedrive' ) );
|
||||
}
|
||||
|
||||
// Add pCloud Extension
|
||||
if ( defined( 'AI1WMPE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_pcloud', Ai1wm_Template::get_content( 'export/button-pcloud' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_pcloud', Ai1wm_Template::get_content( 'export/button-pcloud' ) );
|
||||
}
|
||||
|
||||
// Add S3 Client Extension
|
||||
if ( defined( 'AI1WMNE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_s3_client', Ai1wm_Template::get_content( 'export/button-s3-client' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_s3_client', Ai1wm_Template::get_content( 'export/button-s3-client' ) );
|
||||
}
|
||||
|
||||
// Add Google Cloud Storage Extension
|
||||
if ( defined( 'AI1WMCE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_gcloud_storage', Ai1wm_Template::get_content( 'export/button-gcloud-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_gcloud_storage', Ai1wm_Template::get_content( 'export/button-gcloud-storage' ) );
|
||||
}
|
||||
|
||||
// Add DigitalOcean Spaces Extension
|
||||
if ( defined( 'AI1WMIE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_digitalocean', Ai1wm_Template::get_content( 'export/button-digitalocean' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_digitalocean', Ai1wm_Template::get_content( 'export/button-digitalocean' ) );
|
||||
}
|
||||
|
||||
// Add Mega Extension
|
||||
if ( defined( 'AI1WMEE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_mega', Ai1wm_Template::get_content( 'export/button-mega' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_mega', Ai1wm_Template::get_content( 'export/button-mega' ) );
|
||||
}
|
||||
|
||||
// Add Backblaze B2 Extension
|
||||
if ( defined( 'AI1WMAE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_b2', Ai1wm_Template::get_content( 'export/button-b2' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_b2', Ai1wm_Template::get_content( 'export/button-b2' ) );
|
||||
}
|
||||
|
||||
// Add Box Extension
|
||||
if ( defined( 'AI1WMBE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_box', Ai1wm_Template::get_content( 'export/button-box' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_box', Ai1wm_Template::get_content( 'export/button-box' ) );
|
||||
}
|
||||
|
||||
// Add Microsoft Azure Extension
|
||||
if ( defined( 'AI1WMZE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_azure_storage', Ai1wm_Template::get_content( 'export/button-azure-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_azure_storage', Ai1wm_Template::get_content( 'export/button-azure-storage' ) );
|
||||
}
|
||||
|
||||
// Add WebDAV Extension
|
||||
if ( defined( 'AI1WMWE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_webdav', Ai1wm_Template::get_content( 'export/button-webdav' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_webdav', Ai1wm_Template::get_content( 'export/button-webdav' ) );
|
||||
}
|
||||
|
||||
// Add Amazon Glacier Extension
|
||||
if ( defined( 'AI1WMRE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_export_glacier', Ai1wm_Template::get_content( 'export/button-glacier' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_export_glacier', Ai1wm_Template::get_content( 'export/button-glacier' ) );
|
||||
}
|
||||
|
||||
return array_merge( $active_filters, $static_filters );
|
||||
}
|
||||
|
||||
public static function cleanup() {
|
||||
try {
|
||||
// Iterate over storage directory
|
||||
$iterator = new Ai1wm_Recursive_Directory_Iterator( AI1WM_STORAGE_PATH );
|
||||
|
||||
// Exclude index.php
|
||||
$iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, array( 'index.php', 'index.html' ) );
|
||||
|
||||
// Loop over folders and files
|
||||
foreach ( $iterator as $item ) {
|
||||
try {
|
||||
if ( $item->isFile() && $item->getExtension() === 'log' ) {
|
||||
if ( $item->getMTime() < ( time() - AI1WM_MAX_LOG_CLEANUP ) ) {
|
||||
Ai1wm_File::delete( $item->getPathname() );
|
||||
}
|
||||
} elseif ( $item->getMTime() < ( time() - AI1WM_MAX_STORAGE_CLEANUP ) ) {
|
||||
if ( $item->isDir() ) {
|
||||
Ai1wm_Directory::delete( $item->getPathname() );
|
||||
} else {
|
||||
Ai1wm_File::delete( $item->getPathname() );
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Feedback_Controller {
|
||||
|
||||
public static function feedback( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_POST );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
// Set type
|
||||
$type = null;
|
||||
if ( isset( $params['ai1wm_type'] ) ) {
|
||||
$type = trim( $params['ai1wm_type'] );
|
||||
}
|
||||
|
||||
// Set e-mail
|
||||
$email = null;
|
||||
if ( isset( $params['ai1wm_email'] ) ) {
|
||||
$email = trim( $params['ai1wm_email'] );
|
||||
}
|
||||
|
||||
// Set message
|
||||
$message = null;
|
||||
if ( isset( $params['ai1wm_message'] ) ) {
|
||||
$message = trim( $params['ai1wm_message'] );
|
||||
}
|
||||
|
||||
// Set terms
|
||||
$terms = false;
|
||||
if ( isset( $params['ai1wm_terms'] ) ) {
|
||||
$terms = (bool) $params['ai1wm_terms'];
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access feedback action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$extensions = Ai1wm_Extensions::get();
|
||||
|
||||
// Exclude File Extension
|
||||
if ( defined( 'AI1WMTE_PLUGIN_NAME' ) ) {
|
||||
unset( $extensions[ AI1WMTE_PLUGIN_NAME ] );
|
||||
}
|
||||
|
||||
$purchases = array();
|
||||
foreach ( $extensions as $extension ) {
|
||||
$purchases[] = $extension['key'];
|
||||
}
|
||||
|
||||
try {
|
||||
Ai1wm_Feedback::add( $type, $email, $message, $terms, implode( PHP_EOL, $purchases ) );
|
||||
} catch ( Ai1wm_Feedback_Exception $e ) {
|
||||
ai1wm_json_response( array( 'errors' => array( $e->getMessage() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( array( 'errors' => array() ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Import_Controller {
|
||||
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'import/index' );
|
||||
}
|
||||
|
||||
public static function import( $params = array() ) {
|
||||
global $ai1wm_params;
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( array_merge( $_GET, $_POST ) );
|
||||
}
|
||||
|
||||
// Set priority
|
||||
if ( ! isset( $params['priority'] ) ) {
|
||||
$params['priority'] = 10;
|
||||
}
|
||||
|
||||
$ai1wm_params = $params;
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
ai1wm_setup_environment();
|
||||
ai1wm_setup_errors();
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access import action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Loop over filters
|
||||
if ( ( $filters = ai1wm_get_filters( 'ai1wm_import' ) ) ) {
|
||||
while ( $hooks = current( $filters ) ) {
|
||||
if ( intval( $params['priority'] ) === key( $filters ) ) {
|
||||
foreach ( $hooks as $hook ) {
|
||||
try {
|
||||
|
||||
// Run function hook
|
||||
$params = call_user_func_array( $hook['function'], array( $params ) );
|
||||
|
||||
} catch ( Ai1wm_Upload_Exception $e ) {
|
||||
do_action( 'ai1wm_status_upload_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error code, 2: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Import failed. Code: %1$s. %2$s', 'all-in-one-wp-migration' ), $e->getCode(), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
status_header( $e->getCode() );
|
||||
ai1wm_json_response( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
|
||||
exit;
|
||||
} catch ( Ai1wm_Database_Exception $e ) {
|
||||
do_action( 'ai1wm_status_import_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: 1: Error code, 2: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Import failed (database error). Code: %1$s. %2$s', 'all-in-one-wp-migration' ), $e->getCode(), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
status_header( $e->getCode() );
|
||||
ai1wm_json_response( array( 'errors' => array( array( 'code' => $e->getCode(), 'message' => $e->getMessage() ) ) ) );
|
||||
exit;
|
||||
} catch ( Exception $e ) {
|
||||
do_action( 'ai1wm_status_import_error', $params, $e );
|
||||
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
/* translators: Error message. */
|
||||
WP_CLI::error( sprintf( __( 'Import failed: %s', 'all-in-one-wp-migration' ), $e->getMessage() ) );
|
||||
}
|
||||
|
||||
if ( $e instanceof Ai1wm_CRC_Exception ) {
|
||||
Ai1wm_Status::left_error( __( 'Import failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
} else {
|
||||
Ai1wm_Status::error( __( 'Import failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
}
|
||||
|
||||
Ai1wm_Notification::error( __( 'Import failed', 'all-in-one-wp-migration' ), $e->getMessage() );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Set completed
|
||||
$completed = true;
|
||||
if ( isset( $params['completed'] ) ) {
|
||||
$completed = (bool) $params['completed'];
|
||||
}
|
||||
|
||||
// Do request
|
||||
if ( $completed === false || ( $next = next( $filters ) ) && ( $params['priority'] = key( $filters ) ) ) {
|
||||
if ( defined( 'WP_CLI' ) ) {
|
||||
if ( ! defined( 'DOING_CRON' ) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $params['ai1wm_manual_import'] ) || isset( $params['ai1wm_manual_restore'] ) ) {
|
||||
ai1wm_json_response( $params );
|
||||
exit;
|
||||
}
|
||||
|
||||
wp_remote_request(
|
||||
apply_filters( 'ai1wm_http_import_url', add_query_arg( array( 'ai1wm_import' => 1 ), admin_url( 'admin-ajax.php?action=ai1wm_import' ) ) ),
|
||||
array(
|
||||
'method' => apply_filters( 'ai1wm_http_import_method', 'POST' ),
|
||||
'timeout' => apply_filters( 'ai1wm_http_import_timeout', 10 ),
|
||||
'blocking' => apply_filters( 'ai1wm_http_import_blocking', false ),
|
||||
'sslverify' => apply_filters( 'ai1wm_http_import_sslverify', false ),
|
||||
'headers' => apply_filters( 'ai1wm_http_import_headers', array() ),
|
||||
'body' => apply_filters( 'ai1wm_http_import_body', $params ),
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
next( $filters );
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public static function buttons() {
|
||||
$active_filters = array();
|
||||
$static_filters = array();
|
||||
|
||||
// All-in-One WP Migration
|
||||
if ( defined( 'AI1WM_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_file', Ai1wm_Template::get_content( 'import/button-file' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_file', Ai1wm_Template::get_content( 'import/button-file' ) );
|
||||
}
|
||||
|
||||
// Add Google Drive Extension
|
||||
if ( defined( 'AI1WMGE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_gdrive', Ai1wm_Template::get_content( 'import/button-gdrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_gdrive', Ai1wm_Template::get_content( 'import/button-gdrive' ) );
|
||||
}
|
||||
|
||||
// Add FTP Extension
|
||||
if ( defined( 'AI1WMFE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_ftp', Ai1wm_Template::get_content( 'import/button-ftp' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_ftp', Ai1wm_Template::get_content( 'import/button-ftp' ) );
|
||||
}
|
||||
|
||||
// Add Dropbox Extension
|
||||
if ( defined( 'AI1WMDE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_dropbox', Ai1wm_Template::get_content( 'import/button-dropbox' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_dropbox', Ai1wm_Template::get_content( 'import/button-dropbox' ) );
|
||||
}
|
||||
|
||||
// Add URL Extension
|
||||
if ( defined( 'AI1WMLE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_url', Ai1wm_Template::get_content( 'import/button-url' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_url', Ai1wm_Template::get_content( 'import/button-url' ) );
|
||||
}
|
||||
|
||||
// Add Amazon S3 Extension
|
||||
if ( defined( 'AI1WMSE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_s3', Ai1wm_Template::get_content( 'import/button-s3' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_s3', Ai1wm_Template::get_content( 'import/button-s3' ) );
|
||||
}
|
||||
|
||||
// Add OneDrive Extension
|
||||
if ( defined( 'AI1WMOE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_onedrive', Ai1wm_Template::get_content( 'import/button-onedrive' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_onedrive', Ai1wm_Template::get_content( 'import/button-onedrive' ) );
|
||||
}
|
||||
|
||||
// Add pCloud Extension
|
||||
if ( defined( 'AI1WMPE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_pcloud', Ai1wm_Template::get_content( 'import/button-pcloud' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_pcloud', Ai1wm_Template::get_content( 'import/button-pcloud' ) );
|
||||
}
|
||||
|
||||
// Add S3 Client Extension
|
||||
if ( defined( 'AI1WMNE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_s3_client', Ai1wm_Template::get_content( 'import/button-s3-client' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_s3_client', Ai1wm_Template::get_content( 'import/button-s3-client' ) );
|
||||
}
|
||||
|
||||
// Add Google Cloud Storage Extension
|
||||
if ( defined( 'AI1WMCE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_gcloud_storage', Ai1wm_Template::get_content( 'import/button-gcloud-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_gcloud_storage', Ai1wm_Template::get_content( 'import/button-gcloud-storage' ) );
|
||||
}
|
||||
|
||||
// Add DigitalOcean Spaces Extension
|
||||
if ( defined( 'AI1WMIE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_digitalocean', Ai1wm_Template::get_content( 'import/button-digitalocean' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_digitalocean', Ai1wm_Template::get_content( 'import/button-digitalocean' ) );
|
||||
}
|
||||
|
||||
// Add Mega Extension
|
||||
if ( defined( 'AI1WMEE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_mega', Ai1wm_Template::get_content( 'import/button-mega' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_mega', Ai1wm_Template::get_content( 'import/button-mega' ) );
|
||||
}
|
||||
|
||||
// Add Backblaze B2 Extension
|
||||
if ( defined( 'AI1WMAE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_b2', Ai1wm_Template::get_content( 'import/button-b2' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_b2', Ai1wm_Template::get_content( 'import/button-b2' ) );
|
||||
}
|
||||
|
||||
// Add Box Extension
|
||||
if ( defined( 'AI1WMBE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_box', Ai1wm_Template::get_content( 'import/button-box' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_box', Ai1wm_Template::get_content( 'import/button-box' ) );
|
||||
}
|
||||
|
||||
// Add Microsoft Azure Extension
|
||||
if ( defined( 'AI1WMZE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_azure_storage', Ai1wm_Template::get_content( 'import/button-azure-storage' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_azure_storage', Ai1wm_Template::get_content( 'import/button-azure-storage' ) );
|
||||
}
|
||||
|
||||
// Add WebDAV Extension
|
||||
if ( defined( 'AI1WMWE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_webdav', Ai1wm_Template::get_content( 'import/button-webdav' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_webdav', Ai1wm_Template::get_content( 'import/button-webdav' ) );
|
||||
}
|
||||
|
||||
// Add Amazon Glacier Extension
|
||||
if ( defined( 'AI1WMRE_PLUGIN_NAME' ) ) {
|
||||
$active_filters[] = apply_filters( 'ai1wm_import_glacier', Ai1wm_Template::get_content( 'import/button-glacier' ) );
|
||||
} else {
|
||||
$static_filters[] = apply_filters( 'ai1wm_import_glacier', Ai1wm_Template::get_content( 'import/button-glacier' ) );
|
||||
}
|
||||
|
||||
return array_merge( $active_filters, $static_filters );
|
||||
}
|
||||
|
||||
public static function pro() {
|
||||
return Ai1wm_Template::get_content( 'import/pro' );
|
||||
}
|
||||
|
||||
public static function max_chunk_size() {
|
||||
return min(
|
||||
ai1wm_parse_size( ini_get( 'post_max_size' ), AI1WM_MAX_CHUNK_SIZE ),
|
||||
ai1wm_parse_size( ini_get( 'upload_max_filesize' ), AI1WM_MAX_CHUNK_SIZE ),
|
||||
ai1wm_parse_size( AI1WM_MAX_CHUNK_SIZE )
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Reset_Controller {
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'reset/index' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Schedules_Controller {
|
||||
public static function index() {
|
||||
Ai1wm_Template::render( 'schedules/index' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Status_Controller {
|
||||
|
||||
public static function status( $params = array() ) {
|
||||
ai1wm_setup_environment();
|
||||
|
||||
// Set params
|
||||
if ( empty( $params ) ) {
|
||||
$params = stripslashes_deep( $_GET );
|
||||
}
|
||||
|
||||
// Set secret key
|
||||
$secret_key = null;
|
||||
if ( isset( $params['secret_key'] ) ) {
|
||||
$secret_key = trim( $params['secret_key'] );
|
||||
}
|
||||
|
||||
try {
|
||||
// Ensure that unauthorized people cannot access status action
|
||||
ai1wm_verify_secret_key( $secret_key );
|
||||
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
ai1wm_json_response( get_option( AI1WM_STATUS, array() ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Updater_Controller {
|
||||
|
||||
public static function plugins_api( $result, $action = null, $args = null ) {
|
||||
return Ai1wm_Updater::plugins_api( $result, $action, $args );
|
||||
}
|
||||
|
||||
public static function pre_update_plugins( $transient ) {
|
||||
if ( empty( $transient->checked ) ) {
|
||||
return $transient;
|
||||
}
|
||||
|
||||
// Check for updates every 11 hours
|
||||
if ( ( $last_check_for_updates = get_site_transient( AI1WM_LAST_CHECK_FOR_UPDATES ) ) ) {
|
||||
if ( ( time() - $last_check_for_updates ) < 11 * HOUR_IN_SECONDS ) {
|
||||
return $transient;
|
||||
}
|
||||
}
|
||||
|
||||
// Set last check for updates
|
||||
set_site_transient( AI1WM_LAST_CHECK_FOR_UPDATES, time() );
|
||||
|
||||
// Check for updates
|
||||
Ai1wm_Updater::check_for_updates();
|
||||
|
||||
return $transient;
|
||||
}
|
||||
|
||||
public static function update_plugins( $transient ) {
|
||||
return Ai1wm_Updater::update_plugins( $transient );
|
||||
}
|
||||
|
||||
public static function check_for_updates() {
|
||||
return Ai1wm_Updater::check_for_updates();
|
||||
}
|
||||
|
||||
public static function plugin_row_meta( $plugin_meta, $plugin_file ) {
|
||||
return Ai1wm_Updater::plugin_row_meta( $plugin_meta, $plugin_file );
|
||||
}
|
||||
|
||||
public static function in_plugin_update_message( $plugin_data, $response ) {
|
||||
$updater = get_option( AI1WM_UPDATER, array() );
|
||||
|
||||
// Get updater details
|
||||
if ( isset( $updater[ $plugin_data['slug'] ]['update_message'] ) ) {
|
||||
Ai1wm_Template::render( 'updater/update', array( 'message' => $updater[ $plugin_data['slug'] ]['update_message'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user