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 ( 67f878...5fe6bb )
by Liuta
07:51
created
xcloner.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
  */
26 26
 
27 27
 // If this file is called directly, abort.
28
-if ( ! defined( 'WPINC' ) ) {
28
+if (!defined('WPINC')) {
29 29
 	die;
30 30
 }
31 31
 
32 32
 //i will not load the plugin outside admin or cron
33
-if ( ! is_admin() and ! defined( 'DOING_CRON' ) ) {
33
+if (!is_admin() and !defined('DOING_CRON')) {
34 34
 	return;
35 35
 }
36 36
 
37
-if ( ! defined( "DS" ) ) {
38
-	define( "DS", DIRECTORY_SEPARATOR );
37
+if (!defined("DS")) {
38
+	define("DS", DIRECTORY_SEPARATOR);
39 39
 }
40 40
 
41 41
 /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * This action is documented in includes/class-xcloner-activator.php
44 44
  */
45 45
 function activate_xcloner() {
46
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php';
46
+	require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php';
47 47
 	Xcloner_Activator::activate();
48 48
 }
49 49
 
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
  * This action is documented in includes/class-xcloner-deactivator.php
53 53
  */
54 54
 function deactivate_xcloner() {
55
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-deactivator.php';
55
+	require_once plugin_dir_path(__FILE__).'includes/class-xcloner-deactivator.php';
56 56
 	Xcloner_Deactivator::deactivate();
57 57
 }
58 58
 
59
-register_activation_hook( __FILE__, 'activate_xcloner' );
60
-register_deactivation_hook( __FILE__, 'deactivate_xcloner' );
59
+register_activation_hook(__FILE__, 'activate_xcloner');
60
+register_deactivation_hook(__FILE__, 'deactivate_xcloner');
61 61
 
62
-require_once plugin_dir_path( __FILE__ ) . 'includes/class-xcloner-activator.php';
62
+require_once plugin_dir_path(__FILE__).'includes/class-xcloner-activator.php';
63 63
 
64
-if ( version_compare( phpversion(), Xcloner_Activator::xcloner_minimum_version, '<' ) ) {
64
+if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) {
65 65
 	?>
66 66
     <div class="error notice">
67
-        <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>
67
+        <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>
68 68
     </div>
69 69
 	<?php
70
-	require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
71
-	deactivate_plugins( plugin_basename( __FILE__ ) );
70
+	require_once(ABSPATH.'wp-admin/includes/plugin.php');
71
+	deactivate_plugins(plugin_basename(__FILE__));
72 72
 
73 73
 	return;
74 74
 }
75 75
 
76
-$db_installed_ver   = get_option( "xcloner_db_version" );
76
+$db_installed_ver   = get_option("xcloner_db_version");
77 77
 $xcloner_db_version = Xcloner_Activator::xcloner_db_version;
78 78
 
79
-if ( $db_installed_ver != $xcloner_db_version ) {
79
+if ($db_installed_ver != $xcloner_db_version) {
80 80
 	Xcloner_Activator::activate();
81 81
 }
82 82
 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
  */
88 88
 
89 89
 function xcloner_stop_heartbeat() {
90
-	wp_deregister_script( 'heartbeat' );
90
+	wp_deregister_script('heartbeat');
91 91
 }
92 92
 
93
-if ( isset( $_GET['page'] ) and stristr( $_GET['page'], "xcloner_" ) ) {
94
-	add_action( 'init', 'xcloner_stop_heartbeat', 1 );
93
+if (isset($_GET['page']) and stristr($_GET['page'], "xcloner_")) {
94
+	add_action('init', 'xcloner_stop_heartbeat', 1);
95 95
 }
96 96
 
97 97
 /**
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 	return $plugin;
113 113
 }
114 114
 
115
-require_once( plugin_dir_path( __FILE__ ) . '/vendor/autoload.php' );
116
-require plugin_dir_path( __FILE__ ) . 'includes/class-xcloner.php';
115
+require_once(plugin_dir_path(__FILE__).'/vendor/autoload.php');
116
+require plugin_dir_path(__FILE__).'includes/class-xcloner.php';
117 117
 
118 118
 try {
119 119
 	$xcloner_plugin = run_xcloner();
120
-} catch ( Exception $e ) {
120
+}catch (Exception $e) {
121 121
 	echo $e->getMessage();
122 122
 }
123 123
 
Please login to merge, or discard this patch.
includes/class-xcloner-sanitization.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@  discard block
 block discarded – undo
7 7
 	public function __construct() {
8 8
 	}
9 9
 
10
-	public function sanitize_input_as_int( $option ) {
11
-		return filter_var( $option, FILTER_SANITIZE_NUMBER_INT );
10
+	public function sanitize_input_as_int($option) {
11
+		return filter_var($option, FILTER_SANITIZE_NUMBER_INT);
12 12
 	}
13 13
 
14
-	public function sanitize_input_as_float( $option ) {
15
-		return filter_var( $option, FILTER_VALIDATE_FLOAT );
14
+	public function sanitize_input_as_float($option) {
15
+		return filter_var($option, FILTER_VALIDATE_FLOAT);
16 16
 	}
17 17
 
18
-	public function sanitize_input_as_string( $option ) {
19
-		return filter_var( $option, FILTER_SANITIZE_STRING );
18
+	public function sanitize_input_as_string($option) {
19
+		return filter_var($option, FILTER_SANITIZE_STRING);
20 20
 	}
21 21
 
22
-	public function sanitize_input_as_absolute_path( $option ) {
23
-		$path = filter_var( $option, FILTER_SANITIZE_URL );
22
+	public function sanitize_input_as_absolute_path($option) {
23
+		$path = filter_var($option, FILTER_SANITIZE_URL);
24 24
 
25 25
 		try {
26
-			$option = Util::normalizePath( $path );
27
-		} catch ( Exception $e ) {
28
-			add_settings_error( 'xcloner_error_message', '', __( $e->getMessage() ), 'error' );
26
+			$option = Util::normalizePath($path);
27
+		}catch (Exception $e) {
28
+			add_settings_error('xcloner_error_message', '', __($e->getMessage()), 'error');
29 29
 		}
30 30
 
31
-		if ( $path and ! is_dir( $path ) ) {
32
-			add_settings_error( 'xcloner_error_message', '', __( sprintf( 'Invalid Server Path %s', $option ) ), 'error' );
31
+		if ($path and !is_dir($path)) {
32
+			add_settings_error('xcloner_error_message', '', __(sprintf('Invalid Server Path %s', $option)), 'error');
33 33
 
34 34
 			return false;
35 35
 		}
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 		return $path;
38 38
 	}
39 39
 
40
-	public function sanitize_input_as_path( $option ) {
41
-		return filter_var( $option, FILTER_SANITIZE_URL );
40
+	public function sanitize_input_as_path($option) {
41
+		return filter_var($option, FILTER_SANITIZE_URL);
42 42
 	}
43 43
 
44
-	public function sanitize_input_as_relative_path( $option ) {
45
-		$option = filter_var( $option, FILTER_SANITIZE_URL );
46
-		$option = str_replace( "..", "", $option );
44
+	public function sanitize_input_as_relative_path($option) {
45
+		$option = filter_var($option, FILTER_SANITIZE_URL);
46
+		$option = str_replace("..", "", $option);
47 47
 
48 48
 		return $option;
49 49
 	}
50 50
 
51
-	public function sanitize_input_as_email( $option ) {
52
-		return filter_var( $option, FILTER_SANITIZE_EMAIL );
51
+	public function sanitize_input_as_email($option) {
52
+		return filter_var($option, FILTER_SANITIZE_EMAIL);
53 53
 	}
54 54
 
55
-	public function sanitize_input_as_raw( $option ) {
56
-		return filter_var( $option, FILTER_UNSAFE_RAW );
55
+	public function sanitize_input_as_raw($option) {
56
+		return filter_var($option, FILTER_UNSAFE_RAW);
57 57
 	}
58 58
 
59 59
 }
Please login to merge, or discard this patch.
includes/class-xcloner-requirements.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 	private $xcloner_settings;
9 9
 	private $xcloner_container;
10 10
 
11
-	public function __construct( Xcloner $xcloner_container ) {
11
+	public function __construct(Xcloner $xcloner_container) {
12 12
 		$this->xcloner_container = $xcloner_container;
13 13
 		$this->xcloner_settings  = $xcloner_container->get_xcloner_settings();
14 14
 	}
@@ -18,37 +18,37 @@  discard block
 block discarded – undo
18 18
 	}
19 19
 
20 20
 	public function check_backup_ready_status() {
21
-		if ( ! $this->check_min_php_version( 1 ) ) {
21
+		if (!$this->check_min_php_version(1)) {
22 22
 			return false;
23 23
 		}
24 24
 
25
-		if ( ! $this->check_safe_mode( 1 ) ) {
25
+		if (!$this->check_safe_mode(1)) {
26 26
 			return false;
27 27
 		}
28 28
 
29
-		if ( ! $this->check_xcloner_start_path( 1 ) ) {
29
+		if (!$this->check_xcloner_start_path(1)) {
30 30
 			return false;
31 31
 		}
32 32
 
33
-		if ( ! $this->check_xcloner_store_path( 1 ) ) {
33
+		if (!$this->check_xcloner_store_path(1)) {
34 34
 			return false;
35 35
 		}
36 36
 
37
-		if ( ! $this->check_xcloner_tmp_path( 1 ) ) {
37
+		if (!$this->check_xcloner_tmp_path(1)) {
38 38
 			return false;
39 39
 		}
40 40
 
41 41
 		return true;
42 42
 	}
43 43
 
44
-	public function get_constant( $var ) {
44
+	public function get_constant($var) {
45 45
 		return $this->$var;
46 46
 	}
47 47
 
48
-	public function check_min_php_version( $return_bool = 0 ) {
48
+	public function check_min_php_version($return_bool = 0) {
49 49
 
50
-		if ( $return_bool == 1 ) {
51
-			if ( version_compare( phpversion(), $this->min_php_version, '<' ) ) {
50
+		if ($return_bool == 1) {
51
+			if (version_compare(phpversion(), $this->min_php_version, '<')) {
52 52
 				return false;
53 53
 			} else {
54 54
 				return true;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		return phpversion();
59 59
 	}
60 60
 
61
-	public function check_safe_mode( $return_bool = 0 ) {
61
+	public function check_safe_mode($return_bool = 0) {
62 62
 		/*no longer needed for PHP 7*/
63 63
 		$safe_mode = "Off";
64 64
 
@@ -77,68 +77,68 @@  discard block
 block discarded – undo
77 77
 		return $safe_mode;
78 78
 	}
79 79
 
80
-	public function check_xcloner_start_path( $return_bool = 0 ) {
80
+	public function check_xcloner_start_path($return_bool = 0) {
81 81
 		$path = $this->xcloner_settings->get_xcloner_start_path();
82 82
 
83
-		if ( $return_bool ) {
84
-			if ( ! file_exists( $path ) ) {
83
+		if ($return_bool) {
84
+			if (!file_exists($path)) {
85 85
 				return false;
86 86
 			}
87 87
 
88
-			return is_readable( $path );
88
+			return is_readable($path);
89 89
 		}
90 90
 
91 91
 		return $path;
92 92
 	}
93 93
 
94
-	public function check_xcloner_tmp_path( $return_bool = 0 ) {
94
+	public function check_xcloner_tmp_path($return_bool = 0) {
95 95
 		$path = $this->xcloner_settings->get_xcloner_tmp_path();
96 96
 
97
-		if ( $return_bool ) {
98
-			if ( ! file_exists( $path ) ) {
97
+		if ($return_bool) {
98
+			if (!file_exists($path)) {
99 99
 				return false;
100 100
 			}
101 101
 
102
-			if ( ! is_writeable( $path ) ) {
103
-				@chmod( $path, 0777 );
102
+			if (!is_writeable($path)) {
103
+				@chmod($path, 0777);
104 104
 			}
105 105
 
106
-			return is_writeable( $path );
106
+			return is_writeable($path);
107 107
 		}
108 108
 
109 109
 		return $path;
110 110
 	}
111 111
 
112
-	public function check_xcloner_store_path( $return_bool = 0 ) {
112
+	public function check_xcloner_store_path($return_bool = 0) {
113 113
 		$path = $this->xcloner_settings->get_xcloner_store_path();
114 114
 
115
-		if ( $return_bool ) {
116
-			if ( ! file_exists( $path ) ) {
115
+		if ($return_bool) {
116
+			if (!file_exists($path)) {
117 117
 				return false;
118 118
 			}
119 119
 
120
-			if ( ! is_writeable( $path ) ) {
121
-				@chmod( $path, 0777 );
120
+			if (!is_writeable($path)) {
121
+				@chmod($path, 0777);
122 122
 			}
123 123
 
124
-			return is_writeable( $path );
124
+			return is_writeable($path);
125 125
 		}
126 126
 
127 127
 		return $path;
128 128
 	}
129 129
 
130 130
 	public function get_max_execution_time() {
131
-		return ini_get( 'max_execution_time' );
131
+		return ini_get('max_execution_time');
132 132
 	}
133 133
 
134 134
 	public function get_memory_limit() {
135
-		return ini_get( 'memory_limit' );
135
+		return ini_get('memory_limit');
136 136
 	}
137 137
 
138 138
 	public function get_open_basedir() {
139
-		$open_basedir = ini_get( 'open_basedir' );
139
+		$open_basedir = ini_get('open_basedir');
140 140
 
141
-		if ( ! $open_basedir ) {
141
+		if (!$open_basedir) {
142 142
 			$open_basedir = "none";
143 143
 		}
144 144
 
@@ -146,21 +146,21 @@  discard block
 block discarded – undo
146 146
 	}
147 147
 
148 148
 	public function get_free_disk_space() {
149
-		return $this->file_format_size( disk_free_space( $this->xcloner_settings->get_xcloner_store_path() ) );
149
+		return $this->file_format_size(disk_free_space($this->xcloner_settings->get_xcloner_store_path()));
150 150
 	}
151 151
 
152
-	public function file_format_size( $bytes, $decimals = 2 ) {
153
-		$unit_list = array( 'B', 'KB', 'MB', 'GB', 'PB' );
152
+	public function file_format_size($bytes, $decimals = 2) {
153
+		$unit_list = array('B', 'KB', 'MB', 'GB', 'PB');
154 154
 
155
-		if ( $bytes == 0 ) {
156
-			return $bytes . ' ' . $unit_list[0];
155
+		if ($bytes == 0) {
156
+			return $bytes.' '.$unit_list[0];
157 157
 		}
158 158
 
159
-		$unit_count = count( $unit_list );
160
-		for ( $i = $unit_count - 1; $i >= 0; $i -- ) {
159
+		$unit_count = count($unit_list);
160
+		for ($i = $unit_count - 1; $i >= 0; $i--) {
161 161
 			$power = $i * 10;
162
-			if ( ( $bytes >> $power ) >= 1 ) {
163
-				return round( $bytes / ( 1 << $power ), $decimals ) . ' ' . $unit_list[ $i ];
162
+			if (($bytes >> $power) >= 1) {
163
+				return round($bytes / (1 << $power), $decimals).' '.$unit_list[$i];
164 164
 			}
165 165
 		}
166 166
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-i18n.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@
 block discarded – undo
41 41
 class Xcloner_i18n
42 42
 {
43 43
 
44
-    /**
45
-     * Load the plugin text domain for translation.
46
-     *
47
-     * @since    1.0.0
48
-     */
49
-    public function load_plugin_textdomain()
50
-    {
44
+	/**
45
+	 * Load the plugin text domain for translation.
46
+	 *
47
+	 * @since    1.0.0
48
+	 */
49
+	public function load_plugin_textdomain()
50
+	{
51 51
 
52
-        load_plugin_textdomain(
53
-            'xcloner-backup-and-restore',
54
-            false,
55
-            dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
56
-        );
52
+		load_plugin_textdomain(
53
+			'xcloner-backup-and-restore',
54
+			false,
55
+			dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
56
+		);
57 57
 
58
-    }
58
+	}
59 59
 
60 60
 
61 61
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         load_plugin_textdomain(
53 53
             'xcloner-backup-and-restore',
54 54
             false,
55
-            dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
55
+            dirname(dirname(plugin_basename(__FILE__))).'/languages/'
56 56
         );
57 57
 
58 58
     }
Please login to merge, or discard this patch.
includes/class-xcloner-loader.php 1 patch
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -41,154 +41,154 @@
 block discarded – undo
41 41
 class Xcloner_Loader
42 42
 {
43 43
 
44
-    /**
45
-     * The array of actions registered with WordPress.
46
-     *
47
-     * @since    1.0.0
48
-     * @access   protected
49
-     * @var      array $actions The actions registered with WordPress to fire when the plugin loads.
50
-     */
51
-    protected $actions;
52
-
53
-    /**
54
-     * The array of filters registered with WordPress.
55
-     *
56
-     * @since    1.0.0
57
-     * @access   protected
58
-     * @var      array $filters The filters registered with WordPress to fire when the plugin loads.
59
-     */
60
-    protected $filters;
61
-
62
-    private $xcloner_plugin;
63
-
64
-    /**
65
-     * Initialize the collections used to maintain the actions and filters.
66
-     *
67
-     * @since    1.0.0
68
-     */
69
-    public function __construct(Xcloner $xcloner_container)
70
-    {
71
-
72
-        $this->actions = array();
73
-        $this->filters = array();
74
-
75
-        $this->xcloner_container = $xcloner_container;
76
-
77
-    }
78
-
79
-    public function xcloner_backup_add_admin_menu()
80
-    {
81
-        if (function_exists('add_menu_page')) {
82
-            add_menu_page(__('Site Backup', 'xcloner-backup-and-restore'),
83
-                __('Site Backup', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page',
84
-                array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup');
85
-        }
86
-
87
-        if (function_exists('add_submenu_page')) {
88
-
89
-            add_submenu_page('xcloner_init_page', __('XCloner Dashboard', 'xcloner-backup-and-restore'),
90
-                __('Dashboard', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page',
91
-                array($this->xcloner_container, 'xcloner_display'));
92
-            add_submenu_page('xcloner_init_page', __('XCloner Backup Settings', 'xcloner-backup-and-restore'),
93
-                __('Settings', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_settings_page',
94
-                array($this->xcloner_container, 'xcloner_display'));
95
-            add_submenu_page('xcloner_init_page', __('Remote Storage Settings', 'xcloner-backup-and-restore'),
96
-                __('Remote Storage', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_remote_storage_page',
97
-                array($this->xcloner_container, 'xcloner_display'));
98
-            add_submenu_page('xcloner_init_page', __('Manage Backups', 'xcloner-backup-and-restore'),
99
-                __('Manage Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_manage_backups_page',
100
-                array($this->xcloner_container, 'xcloner_display'));
101
-            add_submenu_page('xcloner_init_page', __('Scheduled Backups', 'xcloner-backup-and-restore'),
102
-                __('Scheduled Backups', 'xcloner-backup-and-restore'), 'manage_options',
103
-                'xcloner_scheduled_backups_page', array($this->xcloner_container, 'xcloner_display'));
104
-            add_submenu_page('xcloner_init_page', __('Generate Backups', 'xcloner-backup-and-restore'),
105
-                __('Generate Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_generate_backups_page',
106
-                array($this->xcloner_container, 'xcloner_display'));
107
-            add_submenu_page('xcloner_init_page', __('Restore Backups', 'xcloner-backup-and-restore'),
108
-                __('Restore Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_restore_page',
109
-                array($this->xcloner_container, 'xcloner_display'));
110
-        }
111
-
112
-    }
113
-
114
-
115
-    /**
116
-     * Add a new action to the collection to be registered with WordPress.
117
-     *
118
-     * @since    1.0.0
119
-     * @param    string $hook The name of the WordPress action that is being registered.
120
-     * @param    object $component A reference to the instance of the object on which the action is defined.
121
-     * @param    string $callback The name of the function definition on the $component.
122
-     * @param    int $priority Optional. he priority at which the function should be fired. Default is 10.
123
-     * @param    int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
124
-     */
125
-    public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1)
126
-    {
127
-        $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
128
-    }
129
-
130
-    /**
131
-     * Add a new filter to the collection to be registered with WordPress.
132
-     *
133
-     * @since    1.0.0
134
-     * @param    string $hook The name of the WordPress filter that is being registered.
135
-     * @param    object $component A reference to the instance of the object on which the filter is defined.
136
-     * @param    string $callback The name of the function definition on the $component.
137
-     * @param    int $priority Optional. he priority at which the function should be fired. Default is 10.
138
-     * @param    int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
139
-     */
140
-    public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
141
-    {
142
-        $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
143
-    }
144
-
145
-    /**
146
-     * A utility function that is used to register the actions and hooks into a single
147
-     * collection.
148
-     *
149
-     * @since    1.0.0
150
-     * @access   private
151
-     * @param    array $hooks The collection of hooks that is being registered (that is, actions or filters).
152
-     * @param    string $hook The name of the WordPress filter that is being registered.
153
-     * @param    object $component A reference to the instance of the object on which the filter is defined.
154
-     * @param    string $callback The name of the function definition on the $component.
155
-     * @param    int $priority The priority at which the function should be fired.
156
-     * @param    int $accepted_args The number of arguments that should be passed to the $callback.
157
-     * @return   array                                  The collection of actions and filters registered with WordPress.
158
-     */
159
-    private function add($hooks, $hook, $component, $callback, $priority, $accepted_args)
160
-    {
161
-
162
-        $hooks[] = array(
163
-            'hook' => $hook,
164
-            'component' => $component,
165
-            'callback' => $callback,
166
-            'priority' => $priority,
167
-            'accepted_args' => $accepted_args
168
-        );
169
-
170
-        return $hooks;
171
-
172
-    }
173
-
174
-    /**
175
-     * Register the filters and actions with WordPress.
176
-     *
177
-     * @since    1.0.0
178
-     */
179
-    public function run()
180
-    {
181
-
182
-        foreach ($this->filters as $hook) {
183
-            add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'],
184
-                $hook['accepted_args']);
185
-        }
186
-
187
-        foreach ($this->actions as $hook) {
188
-            add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'],
189
-                $hook['accepted_args']);
190
-        }
191
-
192
-    }
44
+	/**
45
+	 * The array of actions registered with WordPress.
46
+	 *
47
+	 * @since    1.0.0
48
+	 * @access   protected
49
+	 * @var      array $actions The actions registered with WordPress to fire when the plugin loads.
50
+	 */
51
+	protected $actions;
52
+
53
+	/**
54
+	 * The array of filters registered with WordPress.
55
+	 *
56
+	 * @since    1.0.0
57
+	 * @access   protected
58
+	 * @var      array $filters The filters registered with WordPress to fire when the plugin loads.
59
+	 */
60
+	protected $filters;
61
+
62
+	private $xcloner_plugin;
63
+
64
+	/**
65
+	 * Initialize the collections used to maintain the actions and filters.
66
+	 *
67
+	 * @since    1.0.0
68
+	 */
69
+	public function __construct(Xcloner $xcloner_container)
70
+	{
71
+
72
+		$this->actions = array();
73
+		$this->filters = array();
74
+
75
+		$this->xcloner_container = $xcloner_container;
76
+
77
+	}
78
+
79
+	public function xcloner_backup_add_admin_menu()
80
+	{
81
+		if (function_exists('add_menu_page')) {
82
+			add_menu_page(__('Site Backup', 'xcloner-backup-and-restore'),
83
+				__('Site Backup', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page',
84
+				array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup');
85
+		}
86
+
87
+		if (function_exists('add_submenu_page')) {
88
+
89
+			add_submenu_page('xcloner_init_page', __('XCloner Dashboard', 'xcloner-backup-and-restore'),
90
+				__('Dashboard', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page',
91
+				array($this->xcloner_container, 'xcloner_display'));
92
+			add_submenu_page('xcloner_init_page', __('XCloner Backup Settings', 'xcloner-backup-and-restore'),
93
+				__('Settings', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_settings_page',
94
+				array($this->xcloner_container, 'xcloner_display'));
95
+			add_submenu_page('xcloner_init_page', __('Remote Storage Settings', 'xcloner-backup-and-restore'),
96
+				__('Remote Storage', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_remote_storage_page',
97
+				array($this->xcloner_container, 'xcloner_display'));
98
+			add_submenu_page('xcloner_init_page', __('Manage Backups', 'xcloner-backup-and-restore'),
99
+				__('Manage Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_manage_backups_page',
100
+				array($this->xcloner_container, 'xcloner_display'));
101
+			add_submenu_page('xcloner_init_page', __('Scheduled Backups', 'xcloner-backup-and-restore'),
102
+				__('Scheduled Backups', 'xcloner-backup-and-restore'), 'manage_options',
103
+				'xcloner_scheduled_backups_page', array($this->xcloner_container, 'xcloner_display'));
104
+			add_submenu_page('xcloner_init_page', __('Generate Backups', 'xcloner-backup-and-restore'),
105
+				__('Generate Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_generate_backups_page',
106
+				array($this->xcloner_container, 'xcloner_display'));
107
+			add_submenu_page('xcloner_init_page', __('Restore Backups', 'xcloner-backup-and-restore'),
108
+				__('Restore Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_restore_page',
109
+				array($this->xcloner_container, 'xcloner_display'));
110
+		}
111
+
112
+	}
113
+
114
+
115
+	/**
116
+	 * Add a new action to the collection to be registered with WordPress.
117
+	 *
118
+	 * @since    1.0.0
119
+	 * @param    string $hook The name of the WordPress action that is being registered.
120
+	 * @param    object $component A reference to the instance of the object on which the action is defined.
121
+	 * @param    string $callback The name of the function definition on the $component.
122
+	 * @param    int $priority Optional. he priority at which the function should be fired. Default is 10.
123
+	 * @param    int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
124
+	 */
125
+	public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1)
126
+	{
127
+		$this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
128
+	}
129
+
130
+	/**
131
+	 * Add a new filter to the collection to be registered with WordPress.
132
+	 *
133
+	 * @since    1.0.0
134
+	 * @param    string $hook The name of the WordPress filter that is being registered.
135
+	 * @param    object $component A reference to the instance of the object on which the filter is defined.
136
+	 * @param    string $callback The name of the function definition on the $component.
137
+	 * @param    int $priority Optional. he priority at which the function should be fired. Default is 10.
138
+	 * @param    int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
139
+	 */
140
+	public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
141
+	{
142
+		$this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
143
+	}
144
+
145
+	/**
146
+	 * A utility function that is used to register the actions and hooks into a single
147
+	 * collection.
148
+	 *
149
+	 * @since    1.0.0
150
+	 * @access   private
151
+	 * @param    array $hooks The collection of hooks that is being registered (that is, actions or filters).
152
+	 * @param    string $hook The name of the WordPress filter that is being registered.
153
+	 * @param    object $component A reference to the instance of the object on which the filter is defined.
154
+	 * @param    string $callback The name of the function definition on the $component.
155
+	 * @param    int $priority The priority at which the function should be fired.
156
+	 * @param    int $accepted_args The number of arguments that should be passed to the $callback.
157
+	 * @return   array                                  The collection of actions and filters registered with WordPress.
158
+	 */
159
+	private function add($hooks, $hook, $component, $callback, $priority, $accepted_args)
160
+	{
161
+
162
+		$hooks[] = array(
163
+			'hook' => $hook,
164
+			'component' => $component,
165
+			'callback' => $callback,
166
+			'priority' => $priority,
167
+			'accepted_args' => $accepted_args
168
+		);
169
+
170
+		return $hooks;
171
+
172
+	}
173
+
174
+	/**
175
+	 * Register the filters and actions with WordPress.
176
+	 *
177
+	 * @since    1.0.0
178
+	 */
179
+	public function run()
180
+	{
181
+
182
+		foreach ($this->filters as $hook) {
183
+			add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'],
184
+				$hook['accepted_args']);
185
+		}
186
+
187
+		foreach ($this->actions as $hook) {
188
+			add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'],
189
+				$hook['accepted_args']);
190
+		}
191
+
192
+	}
193 193
 
194 194
 }
Please login to merge, or discard this patch.
includes/class-xcloner-logger.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
 	private $max_logger_files = 7;
11 11
 	private $main_logger_url;
12 12
 
13
-	public function __construct( Xcloner $xcloner_container, $logger_name = "xcloner_logger" ) {
14
-		if ( ! $xcloner_container->get_xcloner_settings() ) {
15
-			$xcloner_settings = new Xcloner_Settings( $xcloner_container );
13
+	public function __construct(Xcloner $xcloner_container, $logger_name = "xcloner_logger") {
14
+		if (!$xcloner_container->get_xcloner_settings()) {
15
+			$xcloner_settings = new Xcloner_Settings($xcloner_container);
16 16
 		} else {
17 17
 			$xcloner_settings = $xcloner_container->get_xcloner_settings();
18 18
 		}
19 19
 
20 20
 		$hash = $xcloner_settings->get_hash();
21
-		if ( $hash == "-" . $xcloner_settings->get_server_unique_hash( 5 ) ) {
21
+		if ($hash == "-".$xcloner_settings->get_server_unique_hash(5)) {
22 22
 			$hash = "";
23 23
 		}
24 24
 
25
-		$logger_path     = $xcloner_settings->get_xcloner_store_path() . DS . $xcloner_settings->get_logger_filename();
25
+		$logger_path     = $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename();
26 26
 		$logger_path_tmp = "";
27 27
 
28
-		if ( $hash ) {
29
-			$logger_path_tmp = $xcloner_settings->get_xcloner_tmp_path() . DS . $xcloner_settings->get_logger_filename( 1 );
28
+		if ($hash) {
29
+			$logger_path_tmp = $xcloner_settings->get_xcloner_tmp_path().DS.$xcloner_settings->get_logger_filename(1);
30 30
 		}
31 31
 
32 32
 		$this->logger_path = $logger_path;
33 33
 
34
-		if ( ! is_dir( $xcloner_settings->get_xcloner_store_path() ) or ! is_writable( $xcloner_settings->get_xcloner_store_path() ) ) {
34
+		if (!is_dir($xcloner_settings->get_xcloner_store_path()) or !is_writable($xcloner_settings->get_xcloner_store_path())) {
35 35
 			$logger_path     = 'php://stderr';
36 36
 			$logger_path_tmp = "";
37 37
 		}
38 38
 
39
-		if ( ! $xcloner_settings->get_xcloner_option( 'xcloner_enable_log' ) ) {
39
+		if (!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) {
40 40
 			$logger_path     = 'php://stderr';
41 41
 			$logger_path_tmp = "";
42 42
 		}
43 43
 
44 44
 		// create a log channel
45
-		parent::__construct( $logger_name );
45
+		parent::__construct($logger_name);
46 46
 
47 47
 		$debug_level = Logger::INFO;
48 48
 
49
-		if ( WP_DEBUG ) {
49
+		if (WP_DEBUG) {
50 50
 			$debug_level = Logger::DEBUG;
51 51
 		}
52 52
 
53 53
 
54
-		if ( $logger_path ) {
55
-			if ( ! $xcloner_settings->get_xcloner_option( 'xcloner_enable_log' ) ) {
56
-				$stream = new StreamHandler( $logger_path, $debug_level );
54
+		if ($logger_path) {
55
+			if (!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) {
56
+				$stream = new StreamHandler($logger_path, $debug_level);
57 57
 			} else {
58
-				$stream = new RotatingFileHandler( $logger_path, $this->max_logger_files, $debug_level );
58
+				$stream = new RotatingFileHandler($logger_path, $this->max_logger_files, $debug_level);
59 59
 			}
60 60
 
61
-			$this->pushHandler( $stream );
61
+			$this->pushHandler($stream);
62 62
 
63 63
 			$this->main_logger_url = $stream->getUrl();
64 64
 		}
65 65
 
66
-		if ( $hash and $logger_path_tmp ) {
67
-			$this->pushHandler( new StreamHandler( $logger_path_tmp, $debug_level ) );
66
+		if ($hash and $logger_path_tmp) {
67
+			$this->pushHandler(new StreamHandler($logger_path_tmp, $debug_level));
68 68
 		}
69 69
 
70 70
 		//return $this;
@@ -74,35 +74,35 @@  discard block
 block discarded – undo
74 74
 		return $this->main_logger_url;
75 75
 	}
76 76
 
77
-	function getLastDebugLines( $totalLines = 200 ) {
77
+	function getLastDebugLines($totalLines = 200) {
78 78
 		$lines = array();
79 79
 
80
-		if ( ! file_exists( $this->main_logger_url ) or ! is_readable( $this->main_logger_url ) ) {
80
+		if (!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) {
81 81
 			return false;
82 82
 		}
83 83
 
84
-		$fp = fopen( $this->main_logger_url, 'r' );
85
-		fseek( $fp, - 1, SEEK_END );
86
-		$pos      = ftell( $fp );
84
+		$fp = fopen($this->main_logger_url, 'r');
85
+		fseek($fp, - 1, SEEK_END);
86
+		$pos      = ftell($fp);
87 87
 		$lastLine = "";
88 88
 
89 89
 		// Loop backword until we have our lines or we reach the start
90
-		while ( $pos > 0 && count( $lines ) < $totalLines ) {
90
+		while ($pos > 0 && count($lines) < $totalLines) {
91 91
 
92
-			$C = fgetc( $fp );
93
-			if ( $C == "\n" ) {
92
+			$C = fgetc($fp);
93
+			if ($C == "\n") {
94 94
 				// skip empty lines
95
-				if ( trim( $lastLine ) != "" ) {
95
+				if (trim($lastLine) != "") {
96 96
 					$lines[] = $lastLine;
97 97
 				}
98 98
 				$lastLine = '';
99 99
 			} else {
100
-				$lastLine = $C . $lastLine;
100
+				$lastLine = $C.$lastLine;
101 101
 			}
102
-			fseek( $fp, $pos -- );
102
+			fseek($fp, $pos--);
103 103
 		}
104 104
 
105
-		$lines = array_reverse( $lines );
105
+		$lines = array_reverse($lines);
106 106
 
107 107
 		return $lines;
108 108
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-activator.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 
64 64
 		if ( version_compare( phpversion(), Xcloner_Activator::xcloner_minimum_version, '<' ) ) {
65 65
 			wp_die( '<p>' . sprintf( __( "XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s" ), Xcloner_Activator::xcloner_minimum_version, phpversion() ) . '</p>', __( "XCloner Activation Error" ), array( 'response'  => 500,
66
-			                                                                                                                                                                                                                                                       'back_link' => true
66
+																																																																   'back_link' => true
67 67
 			) );
68 68
 		}
69 69
 
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -61,22 +61,22 @@  discard block
 block discarded – undo
61 61
 
62 62
 		global $wpdb;
63 63
 
64
-		if ( version_compare( phpversion(), Xcloner_Activator::xcloner_minimum_version, '<' ) ) {
65
-			wp_die( '<p>' . sprintf( __( "XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s" ), Xcloner_Activator::xcloner_minimum_version, phpversion() ) . '</p>', __( "XCloner Activation Error" ), array( 'response'  => 500,
64
+		if (version_compare(phpversion(), Xcloner_Activator::xcloner_minimum_version, '<')) {
65
+			wp_die('<p>'.sprintf(__("XCloner requires minimum PHP version %s in order to run correctly. We have detected your version as %s"), Xcloner_Activator::xcloner_minimum_version, phpversion()).'</p>', __("XCloner Activation Error"), array('response'  => 500,
66 66
 			                                                                                                                                                                                                                                                       'back_link' => true
67
-			) );
67
+			));
68 68
 		}
69 69
 
70 70
 		$charset_collate = $wpdb->get_charset_collate();
71 71
 
72
-		$installed_ver = get_option( "xcloner_db_version" );
72
+		$installed_ver = get_option("xcloner_db_version");
73 73
 
74 74
 		$xcloner_db_version = Xcloner_Activator::xcloner_db_version;
75 75
 
76
-		$xcloner_scheduler_table = $wpdb->prefix . "xcloner_scheduler";
76
+		$xcloner_scheduler_table = $wpdb->prefix."xcloner_scheduler";
77 77
 
78
-		if ( $installed_ver != $xcloner_db_version ) {
79
-			$xcloner_schedule_sql = "CREATE TABLE `" . $xcloner_scheduler_table . "` (
78
+		if ($installed_ver != $xcloner_db_version) {
79
+			$xcloner_schedule_sql = "CREATE TABLE `".$xcloner_scheduler_table."` (
80 80
 				  `id` int(11) NOT NULL AUTO_INCREMENT,
81 81
 				  `name` varchar(255) NOT NULL,
82 82
 				  `recurrence` varchar(25) NOT NULL,
@@ -87,69 +87,69 @@  discard block
 block discarded – undo
87 87
 				  `status` int(1) NOT NULL,
88 88
 				  `last_backup` varchar(100) DEFAULT NULL,
89 89
 				  PRIMARY KEY  (`id`)
90
-				) " . $charset_collate . ";
90
+				) " . $charset_collate.";
91 91
 				";
92 92
 
93
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
94
-			dbDelta( $xcloner_schedule_sql );
93
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
94
+			dbDelta($xcloner_schedule_sql);
95 95
 
96
-			update_option( "xcloner_db_version", $xcloner_db_version );
96
+			update_option("xcloner_db_version", $xcloner_db_version);
97 97
 		}
98 98
 
99
-		if ( get_option( 'xcloner_backup_compression_level' ) === false ) {
100
-			update_option( 'xcloner_backup_compression_level', 0 );
99
+		if (get_option('xcloner_backup_compression_level') === false) {
100
+			update_option('xcloner_backup_compression_level', 0);
101 101
 		}
102 102
 
103
-		if ( get_option( 'xcloner_enable_log' ) === false ) {
104
-			update_option( 'xcloner_enable_log', 1 );
103
+		if (get_option('xcloner_enable_log') === false) {
104
+			update_option('xcloner_enable_log', 1);
105 105
 		}
106 106
 
107
-		if ( get_option( 'xcloner_enable_mysql_backup' ) === false ) {
108
-			update_option( 'xcloner_enable_mysql_backup', 1 );
107
+		if (get_option('xcloner_enable_mysql_backup') === false) {
108
+			update_option('xcloner_enable_mysql_backup', 1);
109 109
 		}
110 110
 
111
-		if ( get_option( 'xcloner_system_settings_page' ) === false ) {
112
-			update_option( 'xcloner_system_settings_page', 100 );
111
+		if (get_option('xcloner_system_settings_page') === false) {
112
+			update_option('xcloner_system_settings_page', 100);
113 113
 		}
114 114
 
115
-		if ( get_option( 'xcloner_files_to_process_per_request' ) === false ) {
116
-			update_option( 'xcloner_files_to_process_per_request', 250 );
115
+		if (get_option('xcloner_files_to_process_per_request') === false) {
116
+			update_option('xcloner_files_to_process_per_request', 250);
117 117
 		}
118 118
 
119
-		if ( get_option( 'xcloner_database_records_per_request' ) === false ) {
120
-			update_option( 'xcloner_database_records_per_request', 10000 );
119
+		if (get_option('xcloner_database_records_per_request') === false) {
120
+			update_option('xcloner_database_records_per_request', 10000);
121 121
 		}
122 122
 
123
-		if ( get_option( 'xcloner_exclude_files_larger_than_mb' ) === false ) {
124
-			update_option( 'xcloner_exclude_files_larger_than_mb', 0 );
123
+		if (get_option('xcloner_exclude_files_larger_than_mb') === false) {
124
+			update_option('xcloner_exclude_files_larger_than_mb', 0);
125 125
 		}
126 126
 
127
-		if ( get_option( 'xcloner_split_backup_limit' ) === false ) {
128
-			update_option( 'xcloner_split_backup_limit', 2048 );
127
+		if (get_option('xcloner_split_backup_limit') === false) {
128
+			update_option('xcloner_split_backup_limit', 2048);
129 129
 		}
130 130
 
131
-		if ( get_option( 'xcloner_size_limit_per_request' ) === false ) {
132
-			update_option( 'xcloner_size_limit_per_request', 50 );
131
+		if (get_option('xcloner_size_limit_per_request') === false) {
132
+			update_option('xcloner_size_limit_per_request', 50);
133 133
 		}
134 134
 
135
-		if ( get_option( 'xcloner_cleanup_retention_limit_days' ) === false ) {
136
-			update_option( 'xcloner_cleanup_retention_limit_days', 60 );
135
+		if (get_option('xcloner_cleanup_retention_limit_days') === false) {
136
+			update_option('xcloner_cleanup_retention_limit_days', 60);
137 137
 		}
138 138
 
139
-		if ( get_option( 'xcloner_cleanup_retention_limit_archives' ) === false ) {
140
-			update_option( 'xcloner_cleanup_retention_limit_archives', 100 );
139
+		if (get_option('xcloner_cleanup_retention_limit_archives') === false) {
140
+			update_option('xcloner_cleanup_retention_limit_archives', 100);
141 141
 		}
142 142
 
143
-		if ( get_option( 'xcloner_directories_to_scan_per_request' ) === false ) {
144
-			update_option( 'xcloner_directories_to_scan_per_request', 25 );
143
+		if (get_option('xcloner_directories_to_scan_per_request') === false) {
144
+			update_option('xcloner_directories_to_scan_per_request', 25);
145 145
 		}
146 146
 
147 147
 		/*if(!get_option('xcloner_diff_backup_recreate_period'))
148 148
 			update_option('xcloner_diff_backup_recreate_period', 10);
149 149
 			* */
150 150
 
151
-		if ( ! get_option( 'xcloner_regex_exclude' ) ) {
152
-			update_option( 'xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$" . PHP_EOL . "(.*)\.(svn|git)(.*)$" . PHP_EOL . "wp-content\/cache(.*)$" . PHP_EOL . "(.*)error_log$" );
151
+		if (!get_option('xcloner_regex_exclude')) {
152
+			update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$".PHP_EOL."(.*)error_log$");
153 153
 		}
154 154
 
155 155
 	}
Please login to merge, or discard this patch.
includes/class-xcloner-deactivator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@
 block discarded – undo
51 51
 
52 52
 		global $xcloner_plugin;
53 53
 
54
-		if ( is_a( $xcloner_plugin, 'Xcloner' ) ) {
54
+		if (is_a($xcloner_plugin, 'Xcloner')) {
55 55
 			try {
56 56
 				$xcloner_plugin->get_xcloner_filesystem()->cleanup_tmp_directories();
57
-			} catch ( Exception $e ) {
58
-				$xcloner_plugin->trigger_message_notice( $e->getMessage() );
57
+			}catch (Exception $e) {
58
+				$xcloner_plugin->trigger_message_notice($e->getMessage());
59 59
 			}
60 60
 
61 61
 			$xcloner_scheduler = $xcloner_plugin->get_xcloner_scheduler();
Please login to merge, or discard this patch.