backup
Last commit date
config
1 year ago
languages
10 months ago
public
1 day ago
src
1 day ago
templates
1 year ago
README.txt
1 day ago
backup.php
1 day ago
backup.php
70 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.22.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 | // WordPress Abilities API (WP 6.9+) |
| 30 | add_action('wp_abilities_api_categories_init', ['\JetBackup\Wordpress\Abilities', 'registerCategories']); |
| 31 | add_action('wp_abilities_api_init', ['\JetBackup\Wordpress\Abilities', 'register']); |
| 32 | |
| 33 | add_action('upgrader_process_complete', ['\JetBackup\Wordpress\Installer', 'update'], 10, 2); |
| 34 | add_filter('admin_body_class', ['\JetBackup\Wordpress\Init', 'filterAdminBodyClass']); |
| 35 | |
| 36 | add_action('admin_bar_menu', function ($wp_admin_bar) { |
| 37 | return \JetBackup\Wordpress\Init::guard( |
| 38 | ['\JetBackup\Wordpress\UI', 'addTopMenuBarIntegration'], |
| 39 | [$wp_admin_bar], |
| 40 | null |
| 41 | ); |
| 42 | }, 100); |
| 43 | |
| 44 | add_filter('plugin_action_links_backup/backup.php', function ($links) { |
| 45 | return \JetBackup\Wordpress\Init::guard( |
| 46 | ['\JetBackup\Wordpress\UI', 'addActionLinks'], |
| 47 | [$links], |
| 48 | $links |
| 49 | ); |
| 50 | }); |
| 51 | |
| 52 | add_filter('plugin_row_meta', function ($links, $file) { |
| 53 | return \JetBackup\Wordpress\Init::guard( |
| 54 | ['\JetBackup\Wordpress\UI', 'addRowMeta'], |
| 55 | [$links, $file], |
| 56 | $links |
| 57 | ); |
| 58 | }, 10, 2); |
| 59 | |
| 60 | add_filter('site_transient_update_plugins', function ($transient) { |
| 61 | try { |
| 62 | if (!class_exists('\JetBackup\Wordpress\Update')) return $transient; |
| 63 | $result = \JetBackup\Wordpress\Update::check($transient); |
| 64 | return ($result instanceof stdClass) ? $result : $transient; |
| 65 | } catch (\Throwable $e) { |
| 66 | error_log('[JetBackup] Update::check failed: ' . $e->getMessage()); |
| 67 | return $transient; |
| 68 | } |
| 69 | }); |
| 70 |