Plugin Directory

Changeset 3370664


Ignore:
Timestamp:
09/30/2025 06:15:36 PM (6 months ago)
Author:
watchful
Message:

v4.8.0 - main

Location:
xcloner-backup-and-restore/trunk
Files:
75 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • xcloner-backup-and-restore/trunk/xcloner.php

    r3316248 r3370664  
    11<?php
     2
     3namespace XCloner;
     4
    25/**
    36 * The plugin bootstrap file
     
    1619 * Plugin URI: https://xcloner.com/
    1720 * Description:  XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts.
    18  * Version: 4.7.9
     21 * Version: 4.8.0
    1922 * Author: watchful
    2023 * Author URI: https://watchful.net/
     
    2427 * Domain Path: /languages
    2528 */
    26 require_once(__DIR__ . '/vendor/autoload.php');
    27 
    28 use Watchfulli\XClonerCore\Xcloner_Activator;
    29 use Watchfulli\XClonerCore\Xcloner_cli;
    30 use Watchfulli\XClonerCore\Xcloner_Deactivator;
    31 use Watchfulli\XClonerCore\Xcloner;
    32 
    33 if (!defined("DS")) {
    34     define("DS", DIRECTORY_SEPARATOR);
     29require_once __DIR__ . '/vendor/autoload.php';
     30use XCloner\Watchfulli\XClonerCore\Xcloner_Activator;
     31use XCloner\Watchfulli\XClonerCore\Xcloner_cli;
     32use XCloner\Watchfulli\XClonerCore\Xcloner_Deactivator;
     33use XCloner\Watchfulli\XClonerCore\Xcloner;
     34if (!\defined("DS")) {
     35    \define("DS", \DIRECTORY_SEPARATOR);
    3536}
    36 
    37 if (!defined("XCLONER_PLUGIN_DIR")) {
    38     define("XCLONER_PLUGIN_DIR", dirname(__FILE__));
     37if (!\defined("XCLONER_PLUGIN_DIR")) {
     38    \define("XCLONER_PLUGIN_DIR", \dirname(__FILE__));
    3939}
    40 
    4140$xcloner_cli = new Xcloner_cli($argv ?? []);
    4241if ($xcloner_cli->should_run()) {
    4342    try {
    4443        $xcloner_cli->run();
    45     } catch (Exception $e) {
    46       echo $e->getMessage() . "\n";
     44    } catch (\Exception $e) {
     45        echo $e->getMessage() . "\n";
    4746    }
    4847    return;
    4948}
    50 
    5149// If this file is called directly, and we're not in CLI mode, then exit.
    52 if (!defined('WPINC')) {
     50if (!\defined('WPINC')) {
    5351    die;
    5452}
    55 
    56 
    57 if (function_exists('register_activation_hook')) {
    58     register_activation_hook(__FILE__, [new Xcloner_Activator(), 'activate']);
     53if (\function_exists('register_activation_hook')) {
     54    \register_activation_hook(__FILE__, [new Xcloner_Activator(), 'activate']);
    5955}
    60 
    61 if (function_exists('register_deactivation_hook')) {
    62     register_deactivation_hook(__FILE__, [new Xcloner_Deactivator(), 'deactivate']);
     56if (\function_exists('register_deactivation_hook')) {
     57    \register_deactivation_hook(__FILE__, [new Xcloner_Deactivator(), 'deactivate']);
    6358}
    64 
    65 if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) {
     59if (\version_compare(\phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) {
    6660    ?>
    6761    <div class="error notice">
    68         <p><?php echo sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s. Plugin is now deactivated."), Xcloner_Activator::xcloner_minimum_version, phpversion()) ?></p>
     62        <p><?php
     63    echo \sprintf(\__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s. Plugin is now deactivated."), Xcloner_Activator::xcloner_minimum_version, \phpversion());
     64    ?></p>
    6965    </div>
    70     <?php
    71     include_once(ABSPATH . 'wp-admin/includes/plugin.php');
    72 
    73     if (function_exists('deactivate_plugins')) {
    74         deactivate_plugins(plugin_basename(__FILE__));
     66    <?php
     67    include_once \ABSPATH . 'wp-admin/includes/plugin.php';
     68    if (\function_exists('deactivate_plugins')) {
     69        \deactivate_plugins(\plugin_basename(__FILE__));
    7570    }
    76 
    77 
    7871    return;
    7972}
    80 
    81 
    8273// Don't load the plugin outside admin or cron
    83 if (!is_admin() && !defined('DOING_CRON')) {
     74if (!\is_admin() && !\defined('DOING_CRON')) {
    8475    //Check if we are running tests before leaving
    85     if (!defined('XCLONER_TESTING')) {
     76    if (!\defined('XCLONER_TESTING')) {
    8677        return;
    8778    }
    8879}
    89 
    90 
    91 $db_installed_ver = get_option("xcloner_db_version");
     80$db_installed_ver = \get_option("xcloner_db_version");
    9281$xcloner_db_version = Xcloner_Activator::xcloner_db_version;
    93 
    9482if ($db_installed_ver != $xcloner_db_version) {
    9583    Xcloner_Activator::activate();
    9684}
    97 
    98 
    9985/**
    10086 * The core plugin class that is used to define internationalization,
     
    10389function xcloner_stop_heartbeat()
    10490{
    105     wp_deregister_script('heartbeat');
     91    \wp_deregister_script('heartbeat');
    10692}
    107 
    108 if (isset($_GET['page']) && stristr($_GET['page'], "xcloner_")) {
    109     add_action('init', 'xcloner_stop_heartbeat', 1);
     93if (isset($_GET['page']) && \stristr($_GET['page'], "xcloner_")) {
     94    \add_action('init', __NAMESPACE__ . '\xcloner_stop_heartbeat', 1);
    11095}
    111 
    11296/**
    11397 * Begins execution of the plugin.
     
    125109     * The class responsible for defining all actions that occur in the admin area.
    126110     */
    127     require_once plugin_dir_path((__FILE__)) . 'admin/class-xcloner-admin.php';
    128 
     111    require_once \plugin_dir_path(__FILE__) . 'admin/class-xcloner-admin.php';
    129112    $xcloner = new Xcloner();
    130113    $xcloner->check_dependencies();
    131 
    132114    $xcloner->init();
    133115    $xcloner->run();
    134116}
    135 
    136117try {
    137118    run_xcloner();
    138 } catch (Exception $e) {
     119} catch (\Exception $e) {
    139120    echo $e->getMessage();
    140121}
Note: See TracChangeset for help on using the changeset viewer.