GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( adacc0...e65d67 )
by Liuta
02:45
created

xcloner.php ➔ xcloner_stop_heartbeat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 37 and the first side effect is on line 30.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
/**
4
 * The plugin bootstrap file
5
 *
6
 * This file is read by WordPress to generate the plugin information in the plugin
7
 * admin area. This file also includes all of the dependencies used by the plugin,
8
 * registers the activation and deactivation functions, and defines a function
9
 * that starts the plugin.
10
 *
11
 * @link              http://www.thinkovi.com
12
 * @since             1.0.0
13
 * @package           Xcloner
14
 *
15
 * @wordpress-plugin
16
 * Plugin Name:       XCloner - Site Backup and Restore
17
 * Plugin URI:        http://www.xcloner.com
18
 * 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.
19
 * Version:           4.0.2
20
 * Author:            Liuta Ovidiu
21
 * Author URI:        http://www.thinkovi.com
22
 * License:           GPL-2.0+
23
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
24
 * Text Domain:       xcloner-backup-and-restore
25
 * Domain Path:       /languages
26
 */
27
28
// If this file is called directly, abort.
29
if ( ! defined( 'WPINC' ) ) {
30
	die;
31
}
32
33
//i will not load the plugin outside admin or cron
34
if(!is_admin() and !defined('DOING_CRON'))
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as and instead of && is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
35
	return;
36
37
define("DS", DIRECTORY_SEPARATOR);
38
39
/**
40
 * The code that runs during plugin activation.
41
 * This action is documented in includes/class-xcloner-activator.php
42
 */
43
function activate_xcloner() 
44
{
45
	require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php';
46
	Xcloner_Activator::activate();
47
}
48
49
/**
50
 * The code that runs during plugin deactivation.
51
 * This action is documented in includes/class-xcloner-deactivator.php
52
 */
53
function deactivate_xcloner() 
54
{
55
	require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-deactivator.php';
56
	Xcloner_Deactivator::deactivate();
57
}
58
59
register_activation_hook( __FILE__, 'activate_xcloner' );
60
register_deactivation_hook( __FILE__, 'deactivate_xcloner' );
61
62
require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php';	
63
64
if(version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<'))
65
{
66
	?>
67
	<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>
69
	</div>
70
	<?php	
71
	require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
72
	deactivate_plugins( plugin_basename( __FILE__ ) );
73
	return;
74
}		
75
		
76
$db_installed_ver = get_option( "xcloner_db_version" );
77
$xcloner_db_version = Xcloner_Activator::xcloner_db_version;
78
79
if($db_installed_ver != $xcloner_db_version)
80
{
81
	Xcloner_Activator::activate();
82
}
83
	
84
	
85
/**
86
 * The core plugin class that is used to define internationalization,
87
 * admin-specific hooks, and public-facing site hooks.
88
 */
89
90
function xcloner_stop_heartbeat() {
91
	wp_deregister_script('heartbeat');
92
}
93
94
if(isset($_GET['page']) and stristr($_GET['page'] ,  "xcloner_"))
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as and instead of && is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
95
{
96
	add_action( 'init', 'xcloner_stop_heartbeat', 1 );
97
}	
98
99
/**
100
 * Begins execution of the plugin.
101
 *
102
 * Since everything within the plugin is registered via hooks,
103
 * then kicking off the plugin from this point in the file does
104
 * not affect the page life cycle.
105
 *
106
 * @since    1.0.0
107
 */
108
function run_xcloner() 
109
{
110
	$plugin = new Xcloner();
111
	$plugin->check_dependencies();
112
	$plugin->init();
113
	$plugin->run();
114
	
115
	return $plugin;
116
117
}
118
119
require_once(plugin_dir_path( __FILE__ )  . '/vendor/autoload.php');
120
require plugin_dir_path( __FILE__ ) . 'includes/class-xcloner.php';
121
122
try{
123
	
124
	$xcloner_plugin = run_xcloner();
125
	
126
}catch(Exception $e){
127
	
128
	echo $e->getMessage();
129
	
130
}
131
132