backup
Last commit date
config
1 year ago
languages
10 months ago
public
2 months ago
src
2 months ago
templates
1 year ago
README.txt
2 months ago
backup.php
2 months ago
backup.php
66 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.20.3 |
| 7 | * Author: JetBackup |
| 8 | * Author URI: https://www.jetbackup.com/jetbackup-for-wordpress |
| 9 | * License: GPLv2 or later |
| 10 | */ |
| 11 | |
| 12 | if (!defined('WPINC')) die('Direct access is not allowed'); |
| 13 | |
| 14 | if (!defined('__JETBACKUP__')) define('__JETBACKUP__', true); |
| 15 | if (!defined('JB_ROOT')) define('JB_ROOT', dirname(__FILE__)); |
| 16 | if (!defined('WP_ROOT')) define('WP_ROOT', rtrim(dirname(WP_CONTENT_DIR), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR); |
| 17 | |
| 18 | require_once JB_ROOT . '/src/JetBackup/autoload.php'; |
| 19 | |
| 20 | // Installation procedures |
| 21 | register_activation_hook(__FILE__, ['\JetBackup\Wordpress\Installer', 'install']); |
| 22 | register_uninstall_hook(__FILE__, ['\JetBackup\Wordpress\Installer', 'uninstall']); |
| 23 | register_deactivation_hook(__FILE__, ['\JetBackup\Wordpress\Installer', 'deactivate']); |
| 24 | |
| 25 | // Main init |
| 26 | add_action('init', ['\JetBackup\Wordpress\Init', 'actionInit'], 1); |
| 27 | add_action('init', ['\JetBackup\Wordpress\Init', 'actionCLI'], 1); |
| 28 | |
| 29 | add_action('upgrader_process_complete', ['\JetBackup\Wordpress\Installer', 'update'], 10, 2); |
| 30 | add_filter('admin_body_class', ['\JetBackup\Wordpress\Init', 'filterAdminBodyClass']); |
| 31 | |
| 32 | add_action('admin_bar_menu', function ($wp_admin_bar) { |
| 33 | return \JetBackup\Wordpress\Init::guard( |
| 34 | ['\JetBackup\Wordpress\UI', 'addTopMenuBarIntegration'], |
| 35 | [$wp_admin_bar], |
| 36 | null |
| 37 | ); |
| 38 | }, 100); |
| 39 | |
| 40 | add_filter('plugin_action_links_backup/backup.php', function ($links) { |
| 41 | return \JetBackup\Wordpress\Init::guard( |
| 42 | ['\JetBackup\Wordpress\UI', 'addActionLinks'], |
| 43 | [$links], |
| 44 | $links |
| 45 | ); |
| 46 | }); |
| 47 | |
| 48 | add_filter('plugin_row_meta', function ($links, $file) { |
| 49 | return \JetBackup\Wordpress\Init::guard( |
| 50 | ['\JetBackup\Wordpress\UI', 'addRowMeta'], |
| 51 | [$links, $file], |
| 52 | $links |
| 53 | ); |
| 54 | }, 10, 2); |
| 55 | |
| 56 | add_filter('site_transient_update_plugins', function ($transient) { |
| 57 | try { |
| 58 | if (!class_exists('\JetBackup\Wordpress\Update')) return $transient; |
| 59 | $result = \JetBackup\Wordpress\Update::check($transient); |
| 60 | return ($result instanceof stdClass) ? $result : $transient; |
| 61 | } catch (\Throwable $e) { |
| 62 | error_log('[JetBackup] Update::check failed: ' . $e->getMessage()); |
| 63 | return $transient; |
| 64 | } |
| 65 | }); |
| 66 |