backup
Last commit date
config
11 months ago
languages
11 months ago
public
11 months ago
src
11 months ago
templates
11 months ago
README.txt
11 months ago
backup.php
11 months ago
backup.php
55 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: JetBackup |
| 4 | * Plugin URI: https://www.jetbackup.com/jetbackup-for-wordpress |
| 5 | * Description: JetBackup is the most complete WordPress site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both. |
| 6 | * Version: 3.1.11.1 |
| 7 | * Author: JetBackup |
| 8 | * Author URI: https://www.jetbackup.com/jetbackup-for-wordpress |
| 9 | * License: GPLv2 or later |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | use JetBackup\Entities\Util; |
| 14 | use JetBackup\Factory; |
| 15 | use JetBackup\JetBackup; |
| 16 | use JetBackup\Wordpress\Wordpress; |
| 17 | |
| 18 | if (!defined('WPINC')) die('Direct access is not allowed'); |
| 19 | |
| 20 | if(!defined('__JETBACKUP__')) define('__JETBACKUP__', true); |
| 21 | if(!defined('JB_ROOT')) define('JB_ROOT', dirname(__FILE__)); |
| 22 | if(!defined('WP_ROOT')) define('WP_ROOT', rtrim(ABSPATH, DIRECTORY_SEPARATOR)); |
| 23 | |
| 24 | require_once(JB_ROOT . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'JetBackup' . DIRECTORY_SEPARATOR . 'autoload.php'); |
| 25 | |
| 26 | // Cookie Env |
| 27 | add_action('wp_loaded', ['\JetBackup\Wordpress\Wordpress', 'setNonceCookie']); |
| 28 | add_action('wp_loaded', ['\JetBackup\Wordpress\Wordpress', 'setUserLanguageCookie']); |
| 29 | |
| 30 | // Installation procedures |
| 31 | register_activation_hook( __FILE__, ['\JetBackup\Wordpress\Installer', 'install']); |
| 32 | register_uninstall_hook( __FILE__, ['\JetBackup\Wordpress\Installer', 'uninstall']); |
| 33 | register_deactivation_hook( __FILE__, ['\JetBackup\Wordpress\Installer', 'deactivate']); |
| 34 | |
| 35 | add_action('init', ['\JetBackup\Wordpress\Init', 'actionInit']); |
| 36 | |
| 37 | // Anything after init will not check for user permissions ! |
| 38 | add_action('init', ['\JetBackup\Wordpress\Init', 'actionCLI']); |
| 39 | add_action('upgrader_process_complete', ['\JetBackup\Wordpress\Installer', 'update']); |
| 40 | add_filter('admin_body_class', ['\JetBackup\Wordpress\Init', 'filterAdminBodyClass']); |
| 41 | add_filter('admin_bar_menu', ['\JetBackup\Wordpress\UI', 'addTopMenuBarIntegration'], 100); |
| 42 | add_filter('plugin_action_links_backup/backup.php', ['\JetBackup\Wordpress\UI', 'addActionLinks']); |
| 43 | add_filter('plugin_row_meta', ['\JetBackup\Wordpress\UI', 'addRowMeta'], 10, 2); |
| 44 | |
| 45 | //WordPress will register the callback function in the database and will try to call it during uninstall |
| 46 | //At this point class doesn't exist anymore, so we have to use wrapper function |
| 47 | add_filter('site_transient_update_plugins', function($transient) { |
| 48 | if (!class_exists('\JetBackup\Wordpress\Update')) return $transient; |
| 49 | return \JetBackup\Wordpress\Update::check($transient); |
| 50 | }); |
| 51 | |
| 52 | if(Factory::getSettingsAutomation()->isRestAPISchedulerEnabled()) { |
| 53 | add_action('rest_api_init', ['\JetBackup\Wordpress\Init', 'actionRegisterWebhookEndpoint']); |
| 54 | add_action('wp_enqueue_scripts', ['\JetBackup\Wordpress\Init', 'actionAPIEnqueueScripts']); |
| 55 | } |