@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 4 | -$xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
|
| 5 | -$xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 6 | -$storage_selection = ""; |
|
| 3 | +$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 4 | +$xcloner_sanitization = $this->get_xcloner_container()->get_xcloner_sanitization(); |
|
| 5 | +$xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 6 | +$storage_selection = ""; |
|
| 7 | 7 | |
| 8 | -if(isset($_GET['storage_selection']) and $_GET['storage_selection']) |
|
| 8 | +if (isset($_GET['storage_selection']) and $_GET['storage_selection']) |
|
| 9 | 9 | { |
| 10 | 10 | $storage_selection = $xcloner_sanitization->sanitize_input_as_string($_GET['storage_selection']); |
| 11 | 11 | } |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | <div class="col s12 m6 l9"> |
| 22 | 22 | <h1><?= esc_html(get_admin_page_title()); ?></h1> |
| 23 | 23 | </div> |
| 24 | - <?php if(sizeof($available_storages)):?> |
|
| 24 | + <?php if (sizeof($available_storages)):?> |
|
| 25 | 25 | <div class="col s12 m6 l3 remote-storage-selection"> |
| 26 | 26 | <select name="storage_selection" id="storage_selection" class="validate" required > |
| 27 | 27 | |
| 28 | - <?php if($storage_selection):?> |
|
| 28 | + <?php if ($storage_selection):?> |
|
| 29 | 29 | <option value="" selected><?php echo __('Change To Local Storage...', 'xcloner-backup-and-restore') ?></option> |
| 30 | 30 | <?php else: ?> |
| 31 | 31 | <option value="" selected><?php echo __('Change To Remote Storage...', 'xcloner-backup-and-restore') ?></option> |
| 32 | - <?php endif;?> |
|
| 32 | + <?php endif; ?> |
|
| 33 | 33 | |
| 34 | - <?php foreach($available_storages as $storage=>$text):?> |
|
| 35 | - <option value="<?php echo $storage?>"<?php if($storage == $storage_selection) echo "selected"?>><?php echo $text?></option> |
|
| 34 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
| 35 | + <option value="<?php echo $storage?>"<?php if ($storage == $storage_selection) echo "selected"?>><?php echo $text?></option> |
|
| 36 | 36 | <?php endforeach?> |
| 37 | 37 | </select> |
| 38 | 38 | <?php endif?> |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | <label for="select_all"> </label> |
| 48 | 48 | </p> |
| 49 | 49 | </th> |
| 50 | - <th data-field="id"><?php echo __("Backup Name",'xcloner-backup-and-restore')?></th> |
|
| 51 | - <th data-field="name"><?php echo __("Created Time",'xcloner-backup-and-restore')?></th> |
|
| 52 | - <th data-field="name"><?php echo __("Size",'xcloner-backup-and-restore')?></th> |
|
| 53 | - <th class="no-sort" data-field="price"><?php echo __("Action",'xcloner-backup-and-restore')?></th> |
|
| 50 | + <th data-field="id"><?php echo __("Backup Name", 'xcloner-backup-and-restore')?></th> |
|
| 51 | + <th data-field="name"><?php echo __("Created Time", 'xcloner-backup-and-restore')?></th> |
|
| 52 | + <th data-field="name"><?php echo __("Size", 'xcloner-backup-and-restore')?></th> |
|
| 53 | + <th class="no-sort" data-field="price"><?php echo __("Action", 'xcloner-backup-and-restore')?></th> |
|
| 54 | 54 | |
| 55 | 55 | </tr> |
| 56 | 56 | </thead> |
@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | 62 | $i = 0; |
| 63 | -foreach($backup_list as $file_info):?> |
|
| 63 | +foreach ($backup_list as $file_info):?> |
|
| 64 | 64 | <?php |
| 65 | - if($storage_selection == "gdrive") |
|
| 65 | + if ($storage_selection == "gdrive") |
|
| 66 | 66 | $file_info['path'] = $file_info['filename'].".".$file_info['extension']; |
| 67 | 67 | $file_exists_on_local_storage = true; |
| 68 | 68 | |
| 69 | - if($storage_selection) |
|
| 69 | + if ($storage_selection) |
|
| 70 | 70 | { |
| 71 | - if(!$xcloner_file_system->get_storage_filesystem()->has($file_info['path'])) |
|
| 71 | + if (!$xcloner_file_system->get_storage_filesystem()->has($file_info['path'])) |
|
| 72 | 72 | $file_exists_on_local_storage = false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | ?> |
| 76 | -<?php if(!isset($file_info['parent'])):?> |
|
| 76 | +<?php if (!isset($file_info['parent'])):?> |
|
| 77 | 77 | |
| 78 | 78 | <tr> |
| 79 | 79 | <td class="checkbox"> |
@@ -84,55 +84,55 @@ discard block |
||
| 84 | 84 | </td> |
| 85 | 85 | <td> |
| 86 | 86 | <span class=""><?php echo $file_info['path']?></span> |
| 87 | - <?php if(!$file_exists_on_local_storage): ?> |
|
| 88 | - <a href="#" title="<?php echo __("File does not exists on local storage","xcloner-backup-and-restore")?>"><i class="material-icons backup_warning">warning</i></a> |
|
| 87 | + <?php if (!$file_exists_on_local_storage): ?> |
|
| 88 | + <a href="#" title="<?php echo __("File does not exists on local storage", "xcloner-backup-and-restore")?>"><i class="material-icons backup_warning">warning</i></a> |
|
| 89 | 89 | <?php endif?> |
| 90 | 90 | <?php |
| 91 | - if(isset($file_info['childs']) and is_array($file_info['childs'])): |
|
| 91 | + if (isset($file_info['childs']) and is_array($file_info['childs'])): |
|
| 92 | 92 | ?> |
| 93 | 93 | <a href="#" title="expand" class="expand-multipart add"><i class="material-icons">add</i></a> |
| 94 | 94 | <a href="#" title="collapse" class="expand-multipart remove"><i class="material-icons">remove</i></a> |
| 95 | 95 | <ul class="multipart"> |
| 96 | - <?php foreach($file_info['childs'] as $child):?> |
|
| 96 | + <?php foreach ($file_info['childs'] as $child):?> |
|
| 97 | 97 | <li> |
| 98 | 98 | <?php echo $child[0]?> (<?php echo size_format($child[2])?>) |
| 99 | 99 | <?php |
| 100 | 100 | $child_exists_on_local_storage = true; |
| 101 | - if($storage_selection) |
|
| 101 | + if ($storage_selection) |
|
| 102 | 102 | { |
| 103 | - if(!$xcloner_file_system->get_storage_filesystem()->has($child[0])) |
|
| 103 | + if (!$xcloner_file_system->get_storage_filesystem()->has($child[0])) |
|
| 104 | 104 | $child_exists_on_local_storage = false; |
| 105 | 105 | } |
| 106 | 106 | ?> |
| 107 | - <?php if(!$child_exists_on_local_storage): ?> |
|
| 108 | - <a href="#" title="<?php echo __("File does not exists on local storage","xcloner-backup-and-restore")?>"><i class="material-icons backup_warning">warning</i></a> |
|
| 107 | + <?php if (!$child_exists_on_local_storage): ?> |
|
| 108 | + <a href="#" title="<?php echo __("File does not exists on local storage", "xcloner-backup-and-restore")?>"><i class="material-icons backup_warning">warning</i></a> |
|
| 109 | 109 | <?php endif?> |
| 110 | - <?php if(!$storage_selection) :?> |
|
| 111 | - <a href="#<?php echo $child[0];?>" class="download" title="Download Backup"><i class="material-icons">file_download</i></a> |
|
| 112 | - <a href="#<?php echo $child[0]?>" class="list-backup-content" title="<?php echo __('List Backup Content','xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 113 | - <?php elseif($storage_selection != "gdrive" && !$xcloner_file_system->get_storage_filesystem()->has($child[0])): ?> |
|
| 114 | - <a href="#<?php echo $child[0]?>" class="copy-remote-to-local" title="<?php echo __('Push Backup To Local Storage','xcloner-backup-and-restore')?>"><i class="material-icons">file_upload</i></a> |
|
| 110 | + <?php if (!$storage_selection) :?> |
|
| 111 | + <a href="#<?php echo $child[0]; ?>" class="download" title="Download Backup"><i class="material-icons">file_download</i></a> |
|
| 112 | + <a href="#<?php echo $child[0]?>" class="list-backup-content" title="<?php echo __('List Backup Content', 'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 113 | + <?php elseif ($storage_selection != "gdrive" && !$xcloner_file_system->get_storage_filesystem()->has($child[0])): ?> |
|
| 114 | + <a href="#<?php echo $child[0]?>" class="copy-remote-to-local" title="<?php echo __('Push Backup To Local Storage', 'xcloner-backup-and-restore')?>"><i class="material-icons">file_upload</i></a> |
|
| 115 | 115 | <?php endif?> |
| 116 | 116 | </li> |
| 117 | - <?php endforeach;?> |
|
| 117 | + <?php endforeach; ?> |
|
| 118 | 118 | </ul> |
| 119 | - <?php endif;?> |
|
| 119 | + <?php endif; ?> |
|
| 120 | 120 | </td> |
| 121 | 121 | <td><?php echo date("d M, Y H:i", $file_info['timestamp'])?></td> |
| 122 | 122 | <td><?php echo size_format($file_info['size'])?></td> |
| 123 | 123 | <td> |
| 124 | - <?php if(!$storage_selection):?> |
|
| 125 | - <a href="#<?php echo $file_info['basename'];?>" class="download" title="<?php echo __('Download Backup','xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
| 124 | + <?php if (!$storage_selection):?> |
|
| 125 | + <a href="#<?php echo $file_info['basename']; ?>" class="download" title="<?php echo __('Download Backup', 'xcloner-backup-and-restore')?>"><i class="material-icons">file_download</i></a> |
|
| 126 | 126 | |
| 127 | - <?php if(sizeof($available_storages)):?> |
|
| 128 | - <a href="#<?php echo $file_info['basename']?>" class="cloud-upload" title="<?php echo __('Send Backup To Remote Storage','xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
| 127 | + <?php if (sizeof($available_storages)):?> |
|
| 128 | + <a href="#<?php echo $file_info['basename']?>" class="cloud-upload" title="<?php echo __('Send Backup To Remote Storage', 'xcloner-backup-and-restore')?>"><i class="material-icons">cloud_upload</i></a> |
|
| 129 | 129 | <?php endif?> |
| 130 | - <a href="#<?php echo $file_info['basename']?>" class="list-backup-content" title="<?php echo __('List Backup Content','xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 131 | - <?php endif;?> |
|
| 130 | + <a href="#<?php echo $file_info['basename']?>" class="list-backup-content" title="<?php echo __('List Backup Content', 'xcloner-backup-and-restore')?>"><i class="material-icons">folder_open</i></a> |
|
| 131 | + <?php endif; ?> |
|
| 132 | 132 | |
| 133 | - <a href="#<?php echo $file_info['basename']?>" class="delete" title="<?php echo __('Delete Backup','xcloner-backup-and-restore')?>"><i class="material-icons">delete</i></a> |
|
| 134 | - <?php if($storage_selection and !$file_exists_on_local_storage):?> |
|
| 135 | - <a href="#<?php echo $file_info['basename'];?>" class="copy-remote-to-local" title="<?php echo __('Push Backup To Local Storage','xcloner-backup-and-restore')?>"><i class="material-icons">file_upload</i></a> |
|
| 133 | + <a href="#<?php echo $file_info['basename']?>" class="delete" title="<?php echo __('Delete Backup', 'xcloner-backup-and-restore')?>"><i class="material-icons">delete</i></a> |
|
| 134 | + <?php if ($storage_selection and !$file_exists_on_local_storage):?> |
|
| 135 | + <a href="#<?php echo $file_info['basename']; ?>" class="copy-remote-to-local" title="<?php echo __('Push Backup To Local Storage', 'xcloner-backup-and-restore')?>"><i class="material-icons">file_upload</i></a> |
|
| 136 | 136 | <?php endif?> |
| 137 | 137 | |
| 138 | 138 | </td> |
@@ -145,12 +145,12 @@ discard block |
||
| 145 | 145 | </tbody> |
| 146 | 146 | </table> |
| 147 | 147 | |
| 148 | -<a class="waves-effect waves-light btn delete-all"><i class="material-icons left">delete</i><?php echo __("Delete",'xcloner-backup-and-restore')?></a> |
|
| 148 | +<a class="waves-effect waves-light btn delete-all"><i class="material-icons left">delete</i><?php echo __("Delete", 'xcloner-backup-and-restore')?></a> |
|
| 149 | 149 | |
| 150 | 150 | <!-- List Backup Content Modal--> |
| 151 | 151 | <div id="backup_cotent_modal" class="modal"> |
| 152 | 152 | <div class="modal-content"> |
| 153 | - <h4><?php echo sprintf(__("Listing Backup Content ",'xcloner-backup-and-restore'), "")?></h4> |
|
| 153 | + <h4><?php echo sprintf(__("Listing Backup Content ", 'xcloner-backup-and-restore'), "")?></h4> |
|
| 154 | 154 | <h5 class="backup-name"></h5> |
| 155 | 155 | |
| 156 | 156 | <div class="progress"> |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | <!-- Local Transfer Modal--> |
| 164 | 164 | <div id="local_storage_upload_modal" class="modal"> |
| 165 | 165 | <div class="modal-content"> |
| 166 | - <h4><?php echo sprintf(__("Transfer Remote Backup To Local Storage",'xcloner-backup-and-restore'), "")?></h4> |
|
| 166 | + <h4><?php echo sprintf(__("Transfer Remote Backup To Local Storage", 'xcloner-backup-and-restore'), "")?></h4> |
|
| 167 | 167 | <h5 class="backup-name"></h5> |
| 168 | 168 | |
| 169 | 169 | <div class="row status"> |
| 170 | 170 | <div class="progress"> |
| 171 | 171 | <div class="indeterminate"></div> |
| 172 | 172 | </div> |
| 173 | - <?php echo __("Uploading backup to the local storage filesystem...",'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 173 | + <?php echo __("Uploading backup to the local storage filesystem...", 'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 174 | 174 | </div> |
| 175 | 175 | </div> |
| 176 | 176 | </div> |
@@ -180,17 +180,17 @@ discard block |
||
| 180 | 180 | <form method="POST" class="remote-storage-form"> |
| 181 | 181 | <input type="hidden" name="file" class="backup_name"> |
| 182 | 182 | <div class="modal-content"> |
| 183 | - <h4><?php echo __("Remote Storage Transfer",'xcloner-backup-and-restore')?></h4> |
|
| 183 | + <h4><?php echo __("Remote Storage Transfer", 'xcloner-backup-and-restore')?></h4> |
|
| 184 | 184 | <p> |
| 185 | - <?php if(sizeof($available_storages)):?> |
|
| 185 | + <?php if (sizeof($available_storages)):?> |
|
| 186 | 186 | <div class="row"> |
| 187 | 187 | <div class="col s12 label"> |
| 188 | - <label><?php echo sprintf(__('Send %s to remote storage','xcloner-backup-and-restore'), "<span class='backup_name'></span>") ?></label> |
|
| 188 | + <label><?php echo sprintf(__('Send %s to remote storage', 'xcloner-backup-and-restore'), "<span class='backup_name'></span>") ?></label> |
|
| 189 | 189 | </div> |
| 190 | 190 | <div class="input-field col s8 m10"> |
| 191 | 191 | <select name="transfer_storage" id="transfer_storage" class="validate" required > |
| 192 | 192 | <option value="" selected><?php echo __('please select...', 'xcloner-backup-and-restore') ?></option> |
| 193 | - <?php foreach($available_storages as $storage=>$text):?> |
|
| 193 | + <?php foreach ($available_storages as $storage=>$text):?> |
|
| 194 | 194 | <option value="<?php echo $storage?>"><?php echo $text?></option> |
| 195 | 195 | <?php endforeach?> |
| 196 | 196 | </select> |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | </div> |
| 202 | 202 | </div> |
| 203 | 203 | <div class="row status"> |
| 204 | - <?php echo __("Uploading backup to the selected remote storage...",'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 204 | + <?php echo __("Uploading backup to the selected remote storage...", 'xcloner-backup-and-restore')?> <span class="status-text"></span> |
|
| 205 | 205 | <div class="progress"> |
| 206 | 206 | <div class="indeterminate"></div> |
| 207 | 207 | </div> |
@@ -27,12 +27,16 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | <?php if($storage_selection):?> |
| 29 | 29 | <option value="" selected><?php echo __('Change To Local Storage...', 'xcloner-backup-and-restore') ?></option> |
| 30 | - <?php else: ?> |
|
| 30 | + <?php else { |
|
| 31 | + : ?> |
|
| 31 | 32 | <option value="" selected><?php echo __('Change To Remote Storage...', 'xcloner-backup-and-restore') ?></option> |
| 32 | - <?php endif;?> |
|
| 33 | + <?php endif; |
|
| 34 | +} |
|
| 35 | +?> |
|
| 33 | 36 | |
| 34 | 37 | <?php foreach($available_storages as $storage=>$text):?> |
| 35 | - <option value="<?php echo $storage?>"<?php if($storage == $storage_selection) echo "selected"?>><?php echo $text?></option> |
|
| 38 | + <option value="<?php echo $storage?>"<?php if($storage == $storage_selection) { |
|
| 39 | + echo "selected"?>><?php echo $text?></option> |
|
| 36 | 40 | <?php endforeach?> |
| 37 | 41 | </select> |
| 38 | 42 | <?php endif?> |
@@ -60,16 +64,19 @@ discard block |
||
| 60 | 64 | |
| 61 | 65 | <?php |
| 62 | 66 | $i = 0; |
| 67 | +} |
|
| 63 | 68 | foreach($backup_list as $file_info):?> |
| 64 | 69 | <?php |
| 65 | - if($storage_selection == "gdrive") |
|
| 66 | - $file_info['path'] = $file_info['filename'].".".$file_info['extension']; |
|
| 70 | + if($storage_selection == "gdrive") { |
|
| 71 | + $file_info['path'] = $file_info['filename'].".".$file_info['extension']; |
|
| 72 | + } |
|
| 67 | 73 | $file_exists_on_local_storage = true; |
| 68 | 74 | |
| 69 | 75 | if($storage_selection) |
| 70 | 76 | { |
| 71 | - if(!$xcloner_file_system->get_storage_filesystem()->has($file_info['path'])) |
|
| 72 | - $file_exists_on_local_storage = false; |
|
| 77 | + if(!$xcloner_file_system->get_storage_filesystem()->has($file_info['path'])) { |
|
| 78 | + $file_exists_on_local_storage = false; |
|
| 79 | + } |
|
| 73 | 80 | } |
| 74 | 81 | |
| 75 | 82 | ?> |
@@ -100,8 +107,9 @@ discard block |
||
| 100 | 107 | $child_exists_on_local_storage = true; |
| 101 | 108 | if($storage_selection) |
| 102 | 109 | { |
| 103 | - if(!$xcloner_file_system->get_storage_filesystem()->has($child[0])) |
|
| 104 | - $child_exists_on_local_storage = false; |
|
| 110 | + if(!$xcloner_file_system->get_storage_filesystem()->has($child[0])) { |
|
| 111 | + $child_exists_on_local_storage = false; |
|
| 112 | + } |
|
| 105 | 113 | } |
| 106 | 114 | ?> |
| 107 | 115 | <?php if(!$child_exists_on_local_storage): ?> |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
| 4 | -$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
| 5 | -$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 6 | -$xcloner_file_transfer = $this->get_xcloner_container()->get_xcloner_file_transfer(); |
|
| 3 | +$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings(); |
|
| 4 | +$logger = $this->get_xcloner_container()->get_xcloner_logger(); |
|
| 5 | +$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 6 | +$xcloner_file_transfer = $this->get_xcloner_container()->get_xcloner_file_transfer(); |
|
| 7 | 7 | |
| 8 | -$start = 0 ; |
|
| 8 | +$start = 0; |
|
| 9 | 9 | |
| 10 | 10 | $backup_list = $xcloner_file_system->get_latest_backups(); |
| 11 | 11 | |
@@ -21,22 +21,22 @@ discard block |
||
| 21 | 21 | <div class="col s12"> |
| 22 | 22 | <ul class="collapsible xcloner-restore " data-collapsible="accordion"> |
| 23 | 23 | <li data-step="1" class="restore-script-upload-step steps active show"> |
| 24 | - <div class="collapsible-header active"><i class="material-icons">settings_remote</i><?php echo __("Restore Script Upload",'xcloner-backup-and-restore')?></div> |
|
| 24 | + <div class="collapsible-header active"><i class="material-icons">settings_remote</i><?php echo __("Restore Script Upload", 'xcloner-backup-and-restore')?></div> |
|
| 25 | 25 | <div class="collapsible-body row"> |
| 26 | 26 | |
| 27 | 27 | <ul class="text-steps"> |
| 28 | - <li><?php echo __("Please download the restore script from",'xcloner-backup-and-restore')?> <a href='#' onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here",'xcloner-backup-and-restore')?></strong></a> |
|
| 28 | + <li><?php echo __("Please download the restore script from", 'xcloner-backup-and-restore')?> <a href='#' onclick="window.location=ajaxurl+'?action=download_restore_script&phar=true'"><strong><?php echo __("here", 'xcloner-backup-and-restore')?></strong></a> |
|
| 29 | 29 | </li> |
| 30 | 30 | <li> |
| 31 | - <?php echo __("Extract the files on your new host",'xcloner-backup-and-restore')?> |
|
| 31 | + <?php echo __("Extract the files on your new host", 'xcloner-backup-and-restore')?> |
|
| 32 | 32 | </li> |
| 33 | 33 | <li> |
| 34 | - <?php echo __("Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php",'xcloner-backup-and-restore')?> |
|
| 34 | + <?php echo __("Provide url below to the <u>xcloner_restore.php</u> restore script, like http://my_restore_site.com/xcloner_restore.php", 'xcloner-backup-and-restore')?> |
|
| 35 | 35 | </li> |
| 36 | 36 | <li> |
| 37 | - <?php echo __("If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.",'xcloner-backup-and-restore')?> |
|
| 37 | + <?php echo __("If your server is not web accessible, like a localhost computer, you can use a DynDNS service or install a blank copy of Wordpress with XCloner in the same environment and start the restore from there.", 'xcloner-backup-and-restore')?> |
|
| 38 | 38 | </li> |
| 39 | - <?php if(is_ssl()):?> |
|
| 39 | + <?php if (is_ssl()):?> |
|
| 40 | 40 | <li> |
| 41 | 41 | <?php echo __("We have detected your connection to the site as being secure, so your restore script address must start with https://.")?> |
| 42 | 42 | </li> |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | </ul> |
| 46 | 46 | |
| 47 | 47 | <div class="input-field col l9 s12"> |
| 48 | - <input value="<?php echo (is_ssl())?"https://":"http://"?>" id="restore_script_url" type="text" class="validate" placeholder="Url to XCloner Restore Script, example http://myddns.com/xcloner/xcloner_restore.php" > |
|
| 48 | + <input value="<?php echo (is_ssl()) ? "https://" : "http://"?>" id="restore_script_url" type="text" class="validate" placeholder="Url to XCloner Restore Script, example http://myddns.com/xcloner/xcloner_restore.php" > |
|
| 49 | 49 | <label for="restore_script_url"></label> |
| 50 | 50 | <div id="url_validation_status" class="status"></div> |
| 51 | 51 | </div> |
| 52 | 52 | <div class="col l3 s12 right-align"> |
| 53 | - <button class="btn waves-effect waves-light" type="submit" id="validate_url" name="action"><?php echo __("Check",'xcloner-backup-and-restore')?> |
|
| 53 | + <button class="btn waves-effect waves-light" type="submit" id="validate_url" name="action"><?php echo __("Check", 'xcloner-backup-and-restore')?> |
|
| 54 | 54 | <i class="material-icons right">send</i> |
| 55 | 55 | </button> |
| 56 | 56 | </div> |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | </li> |
| 59 | 59 | |
| 60 | 60 | <li data-step="2" class="backup-upload-step steps"> |
| 61 | - <div class="collapsible-header active"><i class="material-icons">file_upload</i><?php echo __("Upload Local Backup Archive To Remote Host",'xcloner-backup-and-restore')?> |
|
| 61 | + <div class="collapsible-header active"><i class="material-icons">file_upload</i><?php echo __("Upload Local Backup Archive To Remote Host", 'xcloner-backup-and-restore')?> |
|
| 62 | 62 | </div> |
| 63 | 63 | <div class="collapsible-body row"> |
| 64 | - <p><?php echo __("You can skip this step if you want to transfer the archive in some other way, make sure you upload it in the same directory as the restore script from the previous step.",'xcloner-backup-and-restore')?></p> |
|
| 64 | + <p><?php echo __("You can skip this step if you want to transfer the archive in some other way, make sure you upload it in the same directory as the restore script from the previous step.", 'xcloner-backup-and-restore')?></p> |
|
| 65 | 65 | <div class="input-field col s12 l7"> |
| 66 | 66 | <select id="backup_file" name="backup_file" class="browser-default"> |
| 67 | - <option value="" disabled selected><?php echo __("Please select a local backup archive to upload to remote host",'xcloner-backup-and-restore')?></option> |
|
| 68 | - <?php if(is_array($backup_list)):?> |
|
| 69 | - <?php foreach($backup_list as $file):?> |
|
| 67 | + <option value="" disabled selected><?php echo __("Please select a local backup archive to upload to remote host", 'xcloner-backup-and-restore')?></option> |
|
| 68 | + <?php if (is_array($backup_list)):?> |
|
| 69 | + <?php foreach ($backup_list as $file):?> |
|
| 70 | 70 | <option value="<?php echo $file['basename']?>"> |
| 71 | 71 | <?php echo $file['basename']?> (<?php echo size_format($file['size'])?>) |
| 72 | 72 | </option> |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | </div> |
| 83 | 83 | <div class="col s12 l5 right-align"> |
| 84 | 84 | <div class="toggler"> |
| 85 | - <button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload",'xcloner-backup-and-restore')?> |
|
| 85 | + <button class="btn waves-effect waves-light upload-backup normal" type="submit" id="" name="action"><?php echo __("Upload", 'xcloner-backup-and-restore')?> |
|
| 86 | 86 | <i class="material-icons right">send</i> |
| 87 | 87 | </button> |
| 88 | - <button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
| 88 | + <button class="btn waves-effect waves-light red upload-backup cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
| 89 | 89 | <i class="material-icons right">close</i> |
| 90 | 90 | </button> |
| 91 | 91 | </div> |
| 92 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?> |
|
| 92 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_upload_backup" name="action"><?php echo __("Next", 'xcloner-backup-and-restore')?> |
|
| 93 | 93 | <i class="material-icons right">navigate_next</i> |
| 94 | 94 | </button> |
| 95 | 95 | </div> |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | </li> |
| 98 | 98 | |
| 99 | 99 | <li data-step="3" class="restore-remote-backup-step steps active"> |
| 100 | - <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Restore Files Backup Available On Remote Host",'xcloner-backup-and-restore')?> |
|
| 100 | + <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Restore Files Backup Available On Remote Host", 'xcloner-backup-and-restore')?> |
|
| 101 | 101 | <i class="material-icons right" title="Refresh Remote Backup Files List" id="refresh_remote_backup_file">cached</i> |
| 102 | 102 | |
| 103 | 103 | <div class="switch right"> |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | <div class=" col s12 l7"> |
| 115 | 115 | <div class="input-field row"> |
| 116 | 116 | <input type="text" name="remote_restore_path" id="remote_restore_path" class="validate" placeholder="Restore Target Path"> |
| 117 | - <label><?php echo __("Remote Restore Target Path",'xcloner-backup-and-restore')?></label> |
|
| 117 | + <label><?php echo __("Remote Restore Target Path", 'xcloner-backup-and-restore')?></label> |
|
| 118 | 118 | </div> |
| 119 | 119 | |
| 120 | 120 | <div class="input-field row"> |
| 121 | 121 | <select id="remote_backup_file" name="remote_backup_file" class="browser-default"> |
| 122 | - <option value="" disabled selected><?php echo __("Please select the remote backup file to restore",'xcloner-backup-and-restore')?></option> |
|
| 122 | + <option value="" disabled selected><?php echo __("Please select the remote backup file to restore", 'xcloner-backup-and-restore')?></option> |
|
| 123 | 123 | </select> |
| 124 | 124 | <label></label> |
| 125 | 125 | </div> |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | <div class="col s12 l5 right-align"> |
| 136 | 136 | <div class="toggler"> |
| 137 | - <button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?> |
|
| 137 | + <button class="btn waves-effect waves-light restore_remote_backup normal " type="submit" id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore')?> |
|
| 138 | 138 | <i class="material-icons right">send</i> |
| 139 | 139 | </button> |
| 140 | - <button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
| 140 | + <button class="btn waves-effect waves-light red restore_remote_backup cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
| 141 | 141 | <i class="material-icons right">close</i> |
| 142 | 142 | </button> |
| 143 | 143 | </div> |
| 144 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?> |
|
| 144 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_remote_backup_step" name="action"><?php echo __("Next", 'xcloner-backup-and-restore')?> |
|
| 145 | 145 | <i class="material-icons right">navigate_next</i> |
| 146 | 146 | </button> |
| 147 | 147 | </div> |
@@ -149,71 +149,71 @@ discard block |
||
| 149 | 149 | </li> |
| 150 | 150 | |
| 151 | 151 | <li data-step="4" class="restore-remote-database-step steps active"> |
| 152 | - <div class="collapsible-header"><i class="material-icons">list</i><?php echo __("Restore Remote Database - Search and Replace",'xcloner-backup-and-restore')?> |
|
| 152 | + <div class="collapsible-header"><i class="material-icons">list</i><?php echo __("Restore Remote Database - Search and Replace", 'xcloner-backup-and-restore')?> |
|
| 153 | 153 | <i class="material-icons right" title="Refresh Database Backup Files List" id="refresh_database_file">cached</i> |
| 154 | 154 | </div> |
| 155 | 155 | <div class="collapsible-body row"> |
| 156 | 156 | |
| 157 | 157 | <div class="col s12"> |
| 158 | - <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-tooltip="<?php echo __('Please provide below the mysql connection details for the remote host database.','xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
| 159 | - <h5><?php echo __('Remote Mysql Details','xcloner-backup-and-restore')?></h5> |
|
| 158 | + <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-tooltip="<?php echo __('Please provide below the mysql connection details for the remote host database.', 'xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
| 159 | + <h5><?php echo __('Remote Mysql Details', 'xcloner-backup-and-restore')?></h5> |
|
| 160 | 160 | </div> |
| 161 | 161 | <div class=" col s12"> |
| 162 | 162 | <div class="input-field col s12 m6"> |
| 163 | 163 | <input type="text" name="remote_mysql_host" id="remote_mysql_host" class="validate" placeholder="Remote Mysql Hostname" value="localhost"> |
| 164 | - <label><?php echo __("Remote Mysql Hostname",'xcloner-backup-and-restore')?></label> |
|
| 164 | + <label><?php echo __("Remote Mysql Hostname", 'xcloner-backup-and-restore')?></label> |
|
| 165 | 165 | </div> |
| 166 | 166 | |
| 167 | 167 | <div class="input-field col s12 m6"> |
| 168 | 168 | <input type="text" name="remote_mysql_db" id="remote_mysql_db" class="validate" placeholder="Remote Mysql Database"> |
| 169 | - <label><?php echo __("Remote Mysql Database",'xcloner-backup-and-restore')?></label> |
|
| 169 | + <label><?php echo __("Remote Mysql Database", 'xcloner-backup-and-restore')?></label> |
|
| 170 | 170 | </div> |
| 171 | 171 | |
| 172 | 172 | <div class="input-field col s12 m6"> |
| 173 | 173 | <input type="text" name="remote_mysql_user" id="remote_mysql_user" class="validate" placeholder="Remote Mysql Username"> |
| 174 | - <label><?php echo __("Remote Mysql Username",'xcloner-backup-and-restore')?></label> |
|
| 174 | + <label><?php echo __("Remote Mysql Username", 'xcloner-backup-and-restore')?></label> |
|
| 175 | 175 | </div> |
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | <div class="input-field col s12 m6"> |
| 179 | 179 | <input type="text" name="remote_mysql_pass" id="remote_mysql_pass" class="validate" placeholder="Remote Mysql Password"> |
| 180 | - <label><?php echo __("Remote Mysql Password",'xcloner-backup-and-restore')?></label> |
|
| 180 | + <label><?php echo __("Remote Mysql Password", 'xcloner-backup-and-restore')?></label> |
|
| 181 | 181 | </div> |
| 182 | 182 | |
| 183 | 183 | </div> |
| 184 | 184 | <div class="col s12"> |
| 185 | - <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" data-tooltip="<?php echo __('I will attempt to replace all mysql backup records matching the provided Source Url with the provided Target Url. <br />Leave blank the Target Url if you would like to skip this option. <br />As a bonus, I will also replace all matching serialized data and fix it\'s parsing.','xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
| 186 | - <h5><?php echo __('Remote Mysql Search and Replace','xcloner-backup-and-restore')?></h5> |
|
| 185 | + <a class="btn-floating tooltipped btn-small right" data-position="left" data-delay="50" data-html="true" data-tooltip="<?php echo __('I will attempt to replace all mysql backup records matching the provided Source Url with the provided Target Url. <br />Leave blank the Target Url if you would like to skip this option. <br />As a bonus, I will also replace all matching serialized data and fix it\'s parsing.', 'xcloner-backup-and-restore')?>" data-tooltip-id="92c95730-94e9-7b59-bd52-14adc30d5e3e"><i class="material-icons">help_outline</i></a> |
|
| 186 | + <h5><?php echo __('Remote Mysql Search and Replace', 'xcloner-backup-and-restore')?></h5> |
|
| 187 | 187 | </div> |
| 188 | 188 | <div class="col s12"> |
| 189 | 189 | <div class="input-field col s12 m6 "> |
| 190 | - <input type="text" name="wp_home_url" id="wp_home_url" class="validate" placeholder="WP Home Url" value="<?php echo home_url();?>"> |
|
| 191 | - <label><?php echo __("Source Home Url",'xcloner-backup-and-restore')?></label> |
|
| 190 | + <input type="text" name="wp_home_url" id="wp_home_url" class="validate" placeholder="WP Home Url" value="<?php echo home_url(); ?>"> |
|
| 191 | + <label><?php echo __("Source Home Url", 'xcloner-backup-and-restore')?></label> |
|
| 192 | 192 | </div> |
| 193 | 193 | |
| 194 | 194 | <div class="input-field col s12 m6 "> |
| 195 | 195 | <input type="text" name="remote_restore_url" id="remote_restore_url" class="validate" placeholder="Restore Target Url"> |
| 196 | - <label><?php echo __("With Target Home Url",'xcloner-backup-and-restore')?></label> |
|
| 196 | + <label><?php echo __("With Target Home Url", 'xcloner-backup-and-restore')?></label> |
|
| 197 | 197 | </div> |
| 198 | 198 | |
| 199 | - <?php if( site_url() != home_url()) : ?> |
|
| 199 | + <?php if (site_url() != home_url()) : ?> |
|
| 200 | 200 | <div class="input-field col s12 m6 "> |
| 201 | - <input type="text" name="wp_site_url" id="wp_site_url" class="validate" placeholder="WP Site Url" value="<?php echo site_url();?>"> |
|
| 202 | - <label><?php echo __("Source Site Url",'xcloner-backup-and-restore')?></label> |
|
| 201 | + <input type="text" name="wp_site_url" id="wp_site_url" class="validate" placeholder="WP Site Url" value="<?php echo site_url(); ?>"> |
|
| 202 | + <label><?php echo __("Source Site Url", 'xcloner-backup-and-restore')?></label> |
|
| 203 | 203 | </div> |
| 204 | 204 | |
| 205 | 205 | <div class="input-field col s12 m6 "> |
| 206 | 206 | <input type="text" name="remote_restore_site_url" id="remote_restore_site_url" class="validate" placeholder="Restore Target Url"> |
| 207 | - <label><?php echo __("With Target Site Url",'xcloner-backup-and-restore')?></label> |
|
| 207 | + <label><?php echo __("With Target Site Url", 'xcloner-backup-and-restore')?></label> |
|
| 208 | 208 | </div> |
| 209 | 209 | |
| 210 | - <?php endif;?> |
|
| 210 | + <?php endif; ?> |
|
| 211 | 211 | </div> |
| 212 | 212 | |
| 213 | 213 | <div class=" col s12 l7"> |
| 214 | 214 | <div class="input-field row"> |
| 215 | 215 | <select id="remote_database_file" name="remote_database_file" class="browser-default"> |
| 216 | - <option value="" disabled selected><?php echo __("Please select the remote database backup file to restore",'xcloner-backup-and-restore')?></option> |
|
| 216 | + <option value="" disabled selected><?php echo __("Please select the remote database backup file to restore", 'xcloner-backup-and-restore')?></option> |
|
| 217 | 217 | </select> |
| 218 | 218 | |
| 219 | 219 | <label></label> |
@@ -232,15 +232,15 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | <div class="col s12 l5 right-align"> |
| 234 | 234 | <div class="toggler"> |
| 235 | - <button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore",'xcloner-backup-and-restore')?> |
|
| 235 | + <button class="btn waves-effect waves-light restore_remote_mysqldump normal " type="submit" id="" name="action"><?php echo __("Restore", 'xcloner-backup-and-restore')?> |
|
| 236 | 236 | <i class="material-icons right">send</i> |
| 237 | 237 | </button> |
| 238 | - <button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel",'xcloner-backup-and-restore')?> |
|
| 238 | + <button class="btn waves-effect waves-light red restore_remote_mysqldump cancel" type="submit" id="" name="action"><?php echo __("Cancel", 'xcloner-backup-and-restore')?> |
|
| 239 | 239 | <i class="material-icons right">close</i> |
| 240 | 240 | </button> |
| 241 | 241 | </div> |
| 242 | 242 | |
| 243 | - <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next",'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Next",'xcloner-backup-and-restore')?> |
|
| 243 | + <button class="btn waves-effect waves-light grey" type="submit" title="<?php echo __("Skip Next", 'xcloner-backup-and-restore')?>" id="skip_restore_remote_database_step" name="action"><?php echo __("Next", 'xcloner-backup-and-restore')?> |
|
| 244 | 244 | <i class="material-icons right">navigate_next</i> |
| 245 | 245 | </button> |
| 246 | 246 | |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | </li> |
| 251 | 251 | |
| 252 | 252 | <li data-step="5" class="restore-finish-step steps active"> |
| 253 | - <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Finishing up...",'xcloner-backup-and-restore')?> |
|
| 253 | + <div class="collapsible-header"><i class="material-icons">folder_open</i><?php echo __("Finishing up...", 'xcloner-backup-and-restore')?> |
|
| 254 | 254 | </div> |
| 255 | 255 | <div class="collapsible-body row"> |
| 256 | 256 | |
| 257 | 257 | <div class="row"> |
| 258 | 258 | <div class="col s4"> |
| 259 | - <label><?php echo __("Update wp-config.php mysql details and update the restored site Url",'xcloner-backup-and-restore')?></label> |
|
| 259 | + <label><?php echo __("Update wp-config.php mysql details and update the restored site Url", 'xcloner-backup-and-restore')?></label> |
|
| 260 | 260 | </div> |
| 261 | 261 | |
| 262 | 262 | <div class="col s8"> |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | <div class="row"> |
| 275 | 275 | <div class="col s4"> |
| 276 | - <label><?php echo __("Delete Restored Backup Temporary Folder",'xcloner-backup-and-restore')?></label> |
|
| 276 | + <label><?php echo __("Delete Restored Backup Temporary Folder", 'xcloner-backup-and-restore')?></label> |
|
| 277 | 277 | </div> |
| 278 | 278 | <div class="col s8"> |
| 279 | 279 | <div class="switch"> |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | <div class="row"> |
| 291 | 291 | <div class="col s4"> |
| 292 | - <label><?php echo __("Delete Restore Script",'xcloner-backup-and-restore')?></label> |
|
| 292 | + <label><?php echo __("Delete Restore Script", 'xcloner-backup-and-restore')?></label> |
|
| 293 | 293 | </div> |
| 294 | 294 | <div class="col s8"> |
| 295 | 295 | <div class="switch"> |
@@ -308,15 +308,15 @@ discard block |
||
| 308 | 308 | </div> |
| 309 | 309 | |
| 310 | 310 | <div class=" row col s12 center-align" id="xcloner_restore_finish"> |
| 311 | - <h5><?php echo __("Thank you for using XCloner.",'xcloner-backup-and-restore')?></h5> |
|
| 312 | - <h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'),'<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore" target="_blank">Wordpress XCloner forums</a>') ?></h6> |
|
| 311 | + <h5><?php echo __("Thank you for using XCloner.", 'xcloner-backup-and-restore')?></h5> |
|
| 312 | + <h6><?php echo sprintf(__("We would love to hear about your experience in the %s.", 'xcloner-backup-and-restore'), '<a href="https://wordpress.org/support/plugin/xcloner-backup-and-restore" target="_blank">Wordpress XCloner forums</a>') ?></h6> |
|
| 313 | 313 | <a class="twitter-follow-button" href="https://twitter.com/thinkovi" data-show-count="false">Follow @thinkovi</a> |
| 314 | 314 | <script src="//platform.twitter.com/widgets.js" async="" charset="utf-8"></script> |
| 315 | 315 | </div> |
| 316 | 316 | |
| 317 | 317 | <div class="col s12 center-align"> |
| 318 | 318 | |
| 319 | - <button class="btn waves-effect waves-light teal" type="submit" id="restore_finish" name="action"><?php echo __("Finish",'xcloner-backup-and-restore')?> |
|
| 319 | + <button class="btn waves-effect waves-light teal" type="submit" id="restore_finish" name="action"><?php echo __("Finish", 'xcloner-backup-and-restore')?> |
|
| 320 | 320 | <i class="material-icons right">navigate_next</i> |
| 321 | 321 | </button> |
| 322 | 322 | </div> |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
| 308 | 308 | |
| 309 | 309 | //wp_localize_script( 'ajax-script', 'my_ajax_object', |
| 310 | - // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
| 310 | + // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
|
| 311 | 311 | |
| 312 | 312 | } |
| 313 | 313 | |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | private function define_plugin_settings(){ |
| 343 | 343 | /** |
| 344 | - * register wporg_settings_init to the admin_init action hook |
|
| 345 | - */ |
|
| 344 | + * register wporg_settings_init to the admin_init action hook |
|
| 345 | + */ |
|
| 346 | 346 | |
| 347 | 347 | $this->xcloner_settings = new XCloner_Settings($this); |
| 348 | 348 | |
@@ -393,15 +393,15 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | function friendly_error_type($type) { |
| 396 | - static $levels=null; |
|
| 397 | - if ($levels===null) { |
|
| 398 | - $levels=[]; |
|
| 399 | - foreach (get_defined_constants() as $key=>$value) { |
|
| 400 | - if (strpos($key,'E_')!==0) {continue;} |
|
| 396 | + static $levels=null; |
|
| 397 | + if ($levels===null) { |
|
| 398 | + $levels=[]; |
|
| 399 | + foreach (get_defined_constants() as $key=>$value) { |
|
| 400 | + if (strpos($key,'E_')!==0) {continue;} |
|
| 401 | 401 | $levels[$value]= $key; //substr($key,2); |
| 402 | - } |
|
| 403 | - } |
|
| 404 | - return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
| 402 | + } |
|
| 403 | + } |
|
| 404 | + return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | private function define_ajax_hooks() |
@@ -437,19 +437,19 @@ discard block |
||
| 437 | 437 | add_action( 'wp_ajax_copy_backup_remote_to_local', array($xcloner_api,'copy_backup_remote_to_local') ); |
| 438 | 438 | add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
| 439 | 439 | |
| 440 | - } |
|
| 440 | + } |
|
| 441 | 441 | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | function add_plugin_action_links($links, $file) { |
| 445 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
| 445 | + if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
| 446 | 446 | { |
| 447 | 447 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
| 448 | 448 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - return $links; |
|
| 452 | - } |
|
| 451 | + return $links; |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | 454 | public function xcloner_error_admin_notices() { |
| 455 | 455 | settings_errors( 'xcloner_error_message' ); |
@@ -526,9 +526,9 @@ discard block |
||
| 526 | 526 | function xcloner_display() |
| 527 | 527 | { |
| 528 | 528 | // check user capabilities |
| 529 | - if (!current_user_can('manage_options')) { |
|
| 530 | - return; |
|
| 531 | - } |
|
| 529 | + if (!current_user_can('manage_options')) { |
|
| 530 | + return; |
|
| 531 | + } |
|
| 532 | 532 | |
| 533 | 533 | $page = sanitize_key($_GET['page']); |
| 534 | 534 | |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | return $this->xcloner_file_transfer; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - public function check_dependencies(){ |
|
| 151 | + public function check_dependencies() { |
|
| 152 | 152 | |
| 153 | 153 | $backup_storage_path = realpath(__DIR__.DS."..".DS."..".DS."..").DS."backups".DS; |
| 154 | 154 | |
| 155 | 155 | define("XCLONER_STORAGE_PATH", realpath($backup_storage_path)); |
| 156 | 156 | |
| 157 | - if(!is_dir($backup_storage_path)) |
|
| 157 | + if (!is_dir($backup_storage_path)) |
|
| 158 | 158 | { |
| 159 | - if(!@mkdir($backup_storage_path)) |
|
| 159 | + if (!@mkdir($backup_storage_path)) |
|
| 160 | 160 | { |
| 161 | 161 | $status = "error"; |
| 162 | 162 | $message = sprintf(__("Unable to create the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | - if(!is_writable($backup_storage_path)) |
|
| 167 | + if (!is_writable($backup_storage_path)) |
|
| 168 | 168 | { |
| 169 | 169 | $status = "error"; |
| 170 | 170 | $message = sprintf(__("Unable to write to the Backup Storage Location Folder %s . Please fix this before starting the backup process."), $backup_storage_path); |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | public function trigger_message($message, $status = "error", $message_param1 = "", $message_param2 = "", $message_param3 = "") |
| 179 | 179 | { |
| 180 | 180 | $message = sprintf(__($message), $message_param1, $message_param2, $message_param3); |
| 181 | - add_action( 'xcloner_admin_notices', array($this,"trigger_message_notice"), 10, 2); |
|
| 182 | - do_action( 'xcloner_admin_notices', $message, $status); |
|
| 181 | + add_action('xcloner_admin_notices', array($this, "trigger_message_notice"), 10, 2); |
|
| 182 | + do_action('xcloner_admin_notices', $message, $status); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | public function trigger_message_notice($message, $status = "success") |
| 186 | 186 | { |
| 187 | 187 | ?> |
| 188 | 188 | <div class="notice notice-<?php echo $status?> is-dismissible"> |
| 189 | - <p><?php _e( $message, 'xcloner-backup-and-restore' ); ?></p> |
|
| 189 | + <p><?php _e($message, 'xcloner-backup-and-restore'); ?></p> |
|
| 190 | 190 | </div> |
| 191 | 191 | <?php |
| 192 | 192 | } |
@@ -213,79 +213,79 @@ discard block |
||
| 213 | 213 | * The class responsible for orchestrating the actions and filters of the |
| 214 | 214 | * core plugin. |
| 215 | 215 | */ |
| 216 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-loader.php'; |
|
| 216 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-loader.php'; |
|
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | 219 | * The class responsible for defining internationalization functionality |
| 220 | 220 | * of the plugin. |
| 221 | 221 | */ |
| 222 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-i18n.php'; |
|
| 222 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-i18n.php'; |
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * The class responsible for defining all actions that occur in the admin area. |
| 226 | 226 | */ |
| 227 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-xcloner-admin.php'; |
|
| 227 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-xcloner-admin.php'; |
|
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | 230 | * The class responsible for debugging XCloner. |
| 231 | 231 | */ |
| 232 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-logger.php'; |
|
| 232 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-logger.php'; |
|
| 233 | 233 | |
| 234 | 234 | /** |
| 235 | 235 | * The class responsible for defining the admin settings area. |
| 236 | 236 | */ |
| 237 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-settings.php'; |
|
| 237 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-settings.php'; |
|
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * The class responsible for defining the Remote Storage settings area. |
| 241 | 241 | */ |
| 242 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-remote-storage.php'; |
|
| 242 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-remote-storage.php'; |
|
| 243 | 243 | |
| 244 | 244 | /** |
| 245 | 245 | * The class responsible for implementing the database backup methods. |
| 246 | 246 | */ |
| 247 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-database.php'; |
|
| 247 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-database.php'; |
|
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * The class responsible for sanitization of users input. |
| 251 | 251 | */ |
| 252 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-sanitization.php'; |
|
| 252 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-sanitization.php'; |
|
| 253 | 253 | |
| 254 | 254 | /** |
| 255 | 255 | * The class responsible for XCloner system requirements validation. |
| 256 | 256 | */ |
| 257 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-requirements.php'; |
|
| 257 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-requirements.php'; |
|
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * The class responsible for XCloner backup archive creation. |
| 261 | 261 | */ |
| 262 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-archive.php'; |
|
| 262 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-archive.php'; |
|
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | 265 | * The class responsible for XCloner API requests. |
| 266 | 266 | */ |
| 267 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-api.php'; |
|
| 267 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-api.php'; |
|
| 268 | 268 | |
| 269 | 269 | /** |
| 270 | 270 | * The class responsible for the XCloner File System methods. |
| 271 | 271 | */ |
| 272 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-system.php'; |
|
| 272 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-system.php'; |
|
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | 275 | * The class responsible for the XCloner File Transfer methods. |
| 276 | 276 | */ |
| 277 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-file-transfer.php'; |
|
| 277 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-file-transfer.php'; |
|
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | 280 | * The class responsible for the XCloner Scheduler methods. |
| 281 | 281 | */ |
| 282 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-xcloner-scheduler.php'; |
|
| 282 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-xcloner-scheduler.php'; |
|
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | 285 | * The class responsible for defining all actions that occur in the public-facing |
| 286 | 286 | * side of the site. |
| 287 | 287 | */ |
| 288 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-xcloner-public.php'; |
|
| 288 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-xcloner-public.php'; |
|
| 289 | 289 | |
| 290 | 290 | $this->loader = new Xcloner_Loader($this); |
| 291 | 291 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | $plugin_i18n = new Xcloner_i18n(); |
| 306 | 306 | |
| 307 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 307 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 308 | 308 | |
| 309 | 309 | //wp_localize_script( 'ajax-script', 'my_ajax_object', |
| 310 | 310 | // array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | private function define_admin_hooks() { |
| 322 | 322 | |
| 323 | - $plugin_admin = new Xcloner_Admin( $this ); |
|
| 323 | + $plugin_admin = new Xcloner_Admin($this); |
|
| 324 | 324 | $this->plugin_admin = $plugin_admin; |
| 325 | 325 | |
| 326 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 327 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 326 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 327 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 328 | 328 | |
| 329 | 329 | } |
| 330 | 330 | |
@@ -333,24 +333,24 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | * @access private |
| 335 | 335 | */ |
| 336 | - private function define_admin_menu(){ |
|
| 336 | + private function define_admin_menu() { |
|
| 337 | 337 | |
| 338 | 338 | add_action('admin_menu', array($this->loader, 'xcloner_backup_add_admin_menu')); |
| 339 | 339 | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - private function define_plugin_settings(){ |
|
| 342 | + private function define_plugin_settings() { |
|
| 343 | 343 | /** |
| 344 | 344 | * register wporg_settings_init to the admin_init action hook |
| 345 | 345 | */ |
| 346 | 346 | |
| 347 | 347 | $this->xcloner_settings = new XCloner_Settings($this); |
| 348 | 348 | |
| 349 | - if(defined('DOING_CRON') || isset($_POST['hash'])){ |
|
| 349 | + if (defined('DOING_CRON') || isset($_POST['hash'])) { |
|
| 350 | 350 | |
| 351 | - if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){ |
|
| 351 | + if (defined('DOING_CRON') || $_POST['hash'] == "generate_hash") { |
|
| 352 | 352 | $this->xcloner_settings->generate_new_hash(); |
| 353 | - }else{ |
|
| 353 | + } else { |
|
| 354 | 354 | $this->xcloner_settings->set_hash($_POST['hash']); |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -373,10 +373,10 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | private function define_public_hooks() { |
| 375 | 375 | |
| 376 | - $plugin_public = new Xcloner_Public( $this ); |
|
| 376 | + $plugin_public = new Xcloner_Public($this); |
|
| 377 | 377 | |
| 378 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 379 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 378 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 379 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 380 | 380 | |
| 381 | 381 | } |
| 382 | 382 | |
@@ -385,20 +385,20 @@ discard block |
||
| 385 | 385 | $logger = new XCloner_Logger($this, "php_system"); |
| 386 | 386 | $error = error_get_last(); |
| 387 | 387 | |
| 388 | - if($error['type'] and $logger) |
|
| 388 | + if ($error['type'] and $logger) |
|
| 389 | 389 | { |
| 390 | - $logger->info($this->friendly_error_type ($error['type']).": ".var_export($error, true)); |
|
| 390 | + $logger->info($this->friendly_error_type($error['type']).": ".var_export($error, true)); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | function friendly_error_type($type) { |
| 396 | - static $levels=null; |
|
| 397 | - if ($levels===null) { |
|
| 398 | - $levels=[]; |
|
| 396 | + static $levels = null; |
|
| 397 | + if ($levels === null) { |
|
| 398 | + $levels = []; |
|
| 399 | 399 | foreach (get_defined_constants() as $key=>$value) { |
| 400 | - if (strpos($key,'E_')!==0) {continue;} |
|
| 401 | - $levels[$value]= $key; //substr($key,2); |
|
| 400 | + if (strpos($key, 'E_') !== 0) {continue; } |
|
| 401 | + $levels[$value] = $key; //substr($key,2); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | return (isset($levels[$type]) ? $levels[$type] : "Error #{$type}"); |
@@ -406,43 +406,43 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | private function define_ajax_hooks() |
| 408 | 408 | { |
| 409 | - if(is_admin() || defined('DOING_CRON')) |
|
| 409 | + if (is_admin() || defined('DOING_CRON')) |
|
| 410 | 410 | { |
| 411 | 411 | $this->xcloner_logger = new XCloner_Logger($this, "xcloner_api"); |
| 412 | - $this->xcloner_filesystem = new Xcloner_File_System($this); |
|
| 412 | + $this->xcloner_filesystem = new Xcloner_File_System($this); |
|
| 413 | 413 | $this->archive_system = new Xcloner_Archive($this); |
| 414 | - $this->xcloner_database = new Xcloner_Database($this); |
|
| 415 | - $this->xcloner_scheduler = new Xcloner_Scheduler($this); |
|
| 416 | - $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this); |
|
| 417 | - $this->xcloner_file_transfer = new Xcloner_File_Transfer($this); |
|
| 414 | + $this->xcloner_database = new Xcloner_Database($this); |
|
| 415 | + $this->xcloner_scheduler = new Xcloner_Scheduler($this); |
|
| 416 | + $this->xcloner_remote_storage = new Xcloner_Remote_Storage($this); |
|
| 417 | + $this->xcloner_file_transfer = new Xcloner_File_Transfer($this); |
|
| 418 | 418 | |
| 419 | - $xcloner_api = new Xcloner_Api($this); |
|
| 419 | + $xcloner_api = new Xcloner_Api($this); |
|
| 420 | 420 | |
| 421 | - add_action( 'wp_ajax_get_database_tables_action', array($xcloner_api,'get_database_tables_action') ); |
|
| 422 | - add_action( 'wp_ajax_get_file_system_action', array($xcloner_api,'get_file_system_action') ); |
|
| 423 | - add_action( 'wp_ajax_scan_filesystem', array($xcloner_api,'scan_filesystem') ); |
|
| 424 | - add_action( 'wp_ajax_backup_database', array($xcloner_api,'backup_database') ); |
|
| 425 | - add_action( 'wp_ajax_backup_files' , array($xcloner_api,'backup_files') ); |
|
| 426 | - add_action( 'wp_ajax_save_schedule' , array($xcloner_api,'save_schedule') ); |
|
| 427 | - add_action( 'wp_ajax_get_schedule_by_id', array($xcloner_api,'get_schedule_by_id') ); |
|
| 428 | - add_action( 'wp_ajax_get_scheduler_list', array($xcloner_api,'get_scheduler_list') ); |
|
| 429 | - add_action( 'wp_ajax_delete_schedule_by_id' , array($xcloner_api,'delete_schedule_by_id') ); |
|
| 430 | - add_action( 'wp_ajax_delete_backup_by_name' , array($xcloner_api,'delete_backup_by_name') ); |
|
| 431 | - add_action( 'wp_ajax_download_backup_by_name', array($xcloner_api,'download_backup_by_name') ); |
|
| 432 | - add_action( 'wp_ajax_remote_storage_save_status', array($xcloner_api,'remote_storage_save_status') ); |
|
| 433 | - add_action( 'wp_ajax_upload_backup_to_remote', array($xcloner_api,'upload_backup_to_remote') ); |
|
| 434 | - add_action( 'wp_ajax_list_backup_files' , array($xcloner_api,'list_backup_files') ); |
|
| 435 | - add_action( 'wp_ajax_restore_upload_backup' , array($xcloner_api,'restore_upload_backup') ); |
|
| 436 | - add_action( 'wp_ajax_download_restore_script', array($xcloner_api,'download_restore_script') ); |
|
| 437 | - add_action( 'wp_ajax_copy_backup_remote_to_local', array($xcloner_api,'copy_backup_remote_to_local') ); |
|
| 438 | - add_action( 'admin_notices', array($this, 'xcloner_error_admin_notices' )); |
|
| 421 | + add_action('wp_ajax_get_database_tables_action', array($xcloner_api, 'get_database_tables_action')); |
|
| 422 | + add_action('wp_ajax_get_file_system_action', array($xcloner_api, 'get_file_system_action')); |
|
| 423 | + add_action('wp_ajax_scan_filesystem', array($xcloner_api, 'scan_filesystem')); |
|
| 424 | + add_action('wp_ajax_backup_database', array($xcloner_api, 'backup_database')); |
|
| 425 | + add_action('wp_ajax_backup_files', array($xcloner_api, 'backup_files')); |
|
| 426 | + add_action('wp_ajax_save_schedule', array($xcloner_api, 'save_schedule')); |
|
| 427 | + add_action('wp_ajax_get_schedule_by_id', array($xcloner_api, 'get_schedule_by_id')); |
|
| 428 | + add_action('wp_ajax_get_scheduler_list', array($xcloner_api, 'get_scheduler_list')); |
|
| 429 | + add_action('wp_ajax_delete_schedule_by_id', array($xcloner_api, 'delete_schedule_by_id')); |
|
| 430 | + add_action('wp_ajax_delete_backup_by_name', array($xcloner_api, 'delete_backup_by_name')); |
|
| 431 | + add_action('wp_ajax_download_backup_by_name', array($xcloner_api, 'download_backup_by_name')); |
|
| 432 | + add_action('wp_ajax_remote_storage_save_status', array($xcloner_api, 'remote_storage_save_status')); |
|
| 433 | + add_action('wp_ajax_upload_backup_to_remote', array($xcloner_api, 'upload_backup_to_remote')); |
|
| 434 | + add_action('wp_ajax_list_backup_files', array($xcloner_api, 'list_backup_files')); |
|
| 435 | + add_action('wp_ajax_restore_upload_backup', array($xcloner_api, 'restore_upload_backup')); |
|
| 436 | + add_action('wp_ajax_download_restore_script', array($xcloner_api, 'download_restore_script')); |
|
| 437 | + add_action('wp_ajax_copy_backup_remote_to_local', array($xcloner_api, 'copy_backup_remote_to_local')); |
|
| 438 | + add_action('admin_notices', array($this, 'xcloner_error_admin_notices')); |
|
| 439 | 439 | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | function add_plugin_action_links($links, $file) { |
| 445 | - if ($file == plugin_basename(dirname(dirname(__FILE__)) . '/xcloner.php')) |
|
| 445 | + if ($file == plugin_basename(dirname(dirname(__FILE__)).'/xcloner.php')) |
|
| 446 | 446 | { |
| 447 | 447 | $links[] = '<a href="admin.php?page=xcloner_settings_page">'.__('Settings', 'xcloner-backup-and-restore').'</a>'; |
| 448 | 448 | $links[] = '<a href="admin.php?page=xcloner_generate_backups_page">'.__('Generate Backup', 'xcloner-backup-and-restore').'</a>'; |
@@ -452,13 +452,13 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | public function xcloner_error_admin_notices() { |
| 455 | - settings_errors( 'xcloner_error_message' ); |
|
| 455 | + settings_errors('xcloner_error_message'); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | public function define_cron_hooks() |
| 459 | 459 | { |
| 460 | 460 | //registering new schedule intervals |
| 461 | - add_filter( 'cron_schedules', array($this, 'add_new_intervals')); |
|
| 461 | + add_filter('cron_schedules', array($this, 'add_new_intervals')); |
|
| 462 | 462 | |
| 463 | 463 | |
| 464 | 464 | $xcloner_scheduler = $this->get_xcloner_scheduler(); |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | |
| 533 | 533 | $page = sanitize_key($_GET['page']); |
| 534 | 534 | |
| 535 | - if($page) |
|
| 535 | + if ($page) |
|
| 536 | 536 | { |
| 537 | 537 | $this->display($page); |
| 538 | 538 | } |
@@ -350,7 +350,7 @@ |
||
| 350 | 350 | |
| 351 | 351 | if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){ |
| 352 | 352 | $this->xcloner_settings->generate_new_hash(); |
| 353 | - }else{ |
|
| 353 | + } else{ |
|
| 354 | 354 | $this->xcloner_settings->set_hash($_POST['hash']); |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -58,19 +58,19 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function xcloner_backup_add_admin_menu() |
| 60 | 60 | { |
| 61 | - if ( function_exists('add_menu_page') ) |
|
| 62 | - add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup'); |
|
| 61 | + if (function_exists('add_menu_page')) |
|
| 62 | + add_menu_page(__('Site Backup', 'xcloner-backup-and-restore'), __('Site Backup', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup'); |
|
| 63 | 63 | |
| 64 | - if ( function_exists('add_submenu_page') ) |
|
| 64 | + if (function_exists('add_submenu_page')) |
|
| 65 | 65 | { |
| 66 | 66 | |
| 67 | - add_submenu_page( 'xcloner_init_page', __('XCloner Dashboard','xcloner-backup-and-restore'), __('Dashboard','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 68 | - add_submenu_page( 'xcloner_init_page', __('XCloner Backup Settings','xcloner-backup-and-restore'), __('Settings','xcloner-backup-and-restore'), 'manage_options', 'xcloner_settings_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 69 | - add_submenu_page( 'xcloner_init_page', __('Remote Storage Settings','xcloner-backup-and-restore'), __('Remote Storage','xcloner-backup-and-restore'), 'manage_options', 'xcloner_remote_storage_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 70 | - add_submenu_page( 'xcloner_init_page', __('Manage Backups','xcloner-backup-and-restore'), __('Manage Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_manage_backups_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 71 | - add_submenu_page( 'xcloner_init_page', __('Scheduled Backups','xcloner-backup-and-restore'), __('Scheduled Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_scheduled_backups_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 72 | - add_submenu_page( 'xcloner_init_page', __('Generate Backups','xcloner-backup-and-restore'), __('Generate Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_generate_backups_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 73 | - add_submenu_page( 'xcloner_init_page', __('Restore Backups','xcloner-backup-and-restore'), __('Restore Backups','xcloner-backup-and-restore'), 'manage_options', 'xcloner_restore_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 67 | + add_submenu_page('xcloner_init_page', __('XCloner Dashboard', 'xcloner-backup-and-restore'), __('Dashboard', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 68 | + add_submenu_page('xcloner_init_page', __('XCloner Backup Settings', 'xcloner-backup-and-restore'), __('Settings', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_settings_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 69 | + add_submenu_page('xcloner_init_page', __('Remote Storage Settings', 'xcloner-backup-and-restore'), __('Remote Storage', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_remote_storage_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 70 | + add_submenu_page('xcloner_init_page', __('Manage Backups', 'xcloner-backup-and-restore'), __('Manage Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_manage_backups_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 71 | + add_submenu_page('xcloner_init_page', __('Scheduled Backups', 'xcloner-backup-and-restore'), __('Scheduled Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_scheduled_backups_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 72 | + add_submenu_page('xcloner_init_page', __('Generate Backups', 'xcloner-backup-and-restore'), __('Generate Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_generate_backups_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 73 | + add_submenu_page('xcloner_init_page', __('Restore Backups', 'xcloner-backup-and-restore'), __('Restore Backups', 'xcloner-backup-and-restore'), 'manage_options', 'xcloner_restore_page', array($this->xcloner_container, 'xcloner_display')); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
| 87 | 87 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
| 88 | 88 | */ |
| 89 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 90 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 89 | + public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 90 | + $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
| 101 | 101 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
| 102 | 102 | */ |
| 103 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 104 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 103 | + public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 104 | + $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param int $accepted_args The number of arguments that should be passed to the $callback. |
| 119 | 119 | * @return array The collection of actions and filters registered with WordPress. |
| 120 | 120 | */ |
| 121 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
| 121 | + private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) { |
|
| 122 | 122 | |
| 123 | 123 | $hooks[] = array( |
| 124 | 124 | 'hook' => $hook, |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function run() { |
| 141 | 141 | |
| 142 | - foreach ( $this->filters as $hook ) { |
|
| 143 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 142 | + foreach ($this->filters as $hook) { |
|
| 143 | + add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - foreach ( $this->actions as $hook ) { |
|
| 147 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 146 | + foreach ($this->actions as $hook) { |
|
| 147 | + add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | } |
@@ -58,8 +58,9 @@ |
||
| 58 | 58 | |
| 59 | 59 | public function xcloner_backup_add_admin_menu() |
| 60 | 60 | { |
| 61 | - if ( function_exists('add_menu_page') ) |
|
| 62 | - add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup'); |
|
| 61 | + if ( function_exists('add_menu_page') ) { |
|
| 62 | + add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup'); |
|
| 63 | + } |
|
| 63 | 64 | |
| 64 | 65 | if ( function_exists('add_submenu_page') ) |
| 65 | 66 | { |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class Xcloner_Scheduler{ |
|
| 3 | +class Xcloner_Scheduler { |
|
| 4 | 4 | |
| 5 | 5 | private $db; |
| 6 | 6 | private $scheduler_table = "xcloner_scheduler"; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | global $wpdb; |
| 22 | 22 | |
| 23 | - $this->db = $wpdb; |
|
| 24 | - $wpdb->show_errors = false; |
|
| 23 | + $this->db = $wpdb; |
|
| 24 | + $wpdb->show_errors = false; |
|
| 25 | 25 | |
| 26 | 26 | $this->xcloner_container = $xcloner_container; |
| 27 | 27 | $this->xcloner_settings = $xcloner_container->get_xcloner_settings(); |
@@ -34,18 +34,18 @@ discard block |
||
| 34 | 34 | return $this->xcloner_container; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function get_scheduler_list($return_only_enabled = 0 ) |
|
| 37 | + public function get_scheduler_list($return_only_enabled = 0) |
|
| 38 | 38 | { |
| 39 | 39 | $list = $this->db->get_results("SELECT * FROM ".$this->scheduler_table); |
| 40 | 40 | |
| 41 | - if($return_only_enabled) |
|
| 41 | + if ($return_only_enabled) |
|
| 42 | 42 | { |
| 43 | - $new_list= array(); |
|
| 43 | + $new_list = array(); |
|
| 44 | 44 | |
| 45 | - foreach($list as $res) |
|
| 46 | - if($res->status) |
|
| 45 | + foreach ($list as $res) |
|
| 46 | + if ($res->status) |
|
| 47 | 47 | { |
| 48 | - $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
|
| 48 | + $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id)) + (get_option('gmt_offset') * HOUR_IN_SECONDS); |
|
| 49 | 49 | $new_list[] = $res; |
| 50 | 50 | } |
| 51 | 51 | $list = $new_list; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 73 | 73 | |
| 74 | - if(!$data) |
|
| 74 | + if (!$data) |
|
| 75 | 75 | return false; |
| 76 | 76 | |
| 77 | 77 | $params = json_decode($data['params']); |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | public function delete_schedule_by_id($id) |
| 90 | 90 | { |
| 91 | - $hook = 'xcloner_scheduler_'.$id; |
|
| 92 | - wp_clear_scheduled_hook( $hook, array($id) ); |
|
| 91 | + $hook = 'xcloner_scheduler_'.$id; |
|
| 92 | + wp_clear_scheduled_hook($hook, array($id)); |
|
| 93 | 93 | |
| 94 | - $data = $this->db->delete( $this->scheduler_table , array( 'id' => $id ) ); |
|
| 94 | + $data = $this->db->delete($this->scheduler_table, array('id' => $id)); |
|
| 95 | 95 | |
| 96 | 96 | return $data; |
| 97 | 97 | } |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $list = $this->get_scheduler_list(); |
| 102 | 102 | |
| 103 | - foreach($list as $schedule) |
|
| 103 | + foreach ($list as $schedule) |
|
| 104 | 104 | { |
| 105 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 105 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 106 | 106 | |
| 107 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 108 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 107 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 108 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
@@ -113,24 +113,24 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $list = $this->get_scheduler_list(); |
| 115 | 115 | |
| 116 | - foreach($list as $schedule) |
|
| 116 | + foreach ($list as $schedule) |
|
| 117 | 117 | { |
| 118 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 118 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 119 | 119 | |
| 120 | 120 | //adding the xcloner_scheduler hook with xcloner_scheduler_callback callback |
| 121 | - add_action( $hook, array($this, 'xcloner_scheduler_callback'), 10, 1 ); |
|
| 121 | + add_action($hook, array($this, 'xcloner_scheduler_callback'), 10, 1); |
|
| 122 | 122 | |
| 123 | - if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
|
| 123 | + if (!wp_next_scheduled($hook, array($schedule->id)) and $schedule->status) { |
|
| 124 | 124 | |
| 125 | - if($schedule->recurrence == "single") |
|
| 126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 125 | + if ($schedule->recurrence == "single") |
|
| 126 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 127 | 127 | else |
| 128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 128 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 129 | 129 | |
| 130 | - }elseif(!$schedule->status) |
|
| 130 | + }elseif (!$schedule->status) |
|
| 131 | 131 | { |
| 132 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 133 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 132 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 133 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -139,17 +139,17 @@ discard block |
||
| 139 | 139 | public function update_cron_hook($id) |
| 140 | 140 | { |
| 141 | 141 | $schedule = $this->get_schedule_by_id_object($id); |
| 142 | - $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 142 | + $hook = 'xcloner_scheduler_'.$schedule->id; |
|
| 143 | 143 | |
| 144 | - $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
|
| 145 | - wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
|
| 144 | + $timestamp = wp_next_scheduled($hook, array($schedule->id)); |
|
| 145 | + wp_unschedule_event($timestamp, $hook, array($schedule->id)); |
|
| 146 | 146 | |
| 147 | 147 | if ($schedule->status) { |
| 148 | 148 | |
| 149 | - if($schedule->recurrence == "single") |
|
| 150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 151 | - else{ |
|
| 152 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 149 | + if ($schedule->recurrence == "single") |
|
| 150 | + wp_schedule_single_event(strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 151 | + else { |
|
| 152 | + wp_schedule_event(strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | } |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | public function disable_single_cron($schedule_id) |
| 159 | 159 | { |
| 160 | - $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 161 | - $timestamp = wp_next_scheduled( $hook , array($schedule_id) ); |
|
| 162 | - wp_unschedule_event( $timestamp, $hook, array($schedule_id) ); |
|
| 160 | + $hook = 'xcloner_scheduler_'.$schedule_id; |
|
| 161 | + $timestamp = wp_next_scheduled($hook, array($schedule_id)); |
|
| 162 | + wp_unschedule_event($timestamp, $hook, array($schedule_id)); |
|
| 163 | 163 | |
| 164 | 164 | $schedule['status'] = 0; |
| 165 | 165 | |
| 166 | 166 | $update = $this->db->update( |
| 167 | 167 | $this->scheduler_table, |
| 168 | 168 | $schedule, |
| 169 | - array( 'id' => $schedule_id ), |
|
| 169 | + array('id' => $schedule_id), |
|
| 170 | 170 | array( |
| 171 | 171 | '%s', |
| 172 | 172 | '%s' |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $update = $this->db->update( |
| 183 | 183 | $this->scheduler_table, |
| 184 | 184 | $schedule, |
| 185 | - array( 'id' => $schedule_id ), |
|
| 185 | + array('id' => $schedule_id), |
|
| 186 | 186 | array( |
| 187 | 187 | '%s', |
| 188 | 188 | '%s' |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $update = $this->db->update( |
| 199 | 199 | $this->scheduler_table, |
| 200 | 200 | $schedule, |
| 201 | - array( 'id' => $schedule_id ), |
|
| 201 | + array('id' => $schedule_id), |
|
| 202 | 202 | array( |
| 203 | 203 | '%s', |
| 204 | 204 | '%s' |
@@ -211,18 +211,18 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | set_time_limit(0); |
| 213 | 213 | |
| 214 | - $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 215 | - $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
| 216 | - $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
| 217 | - $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
| 218 | - $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 214 | + $this->xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem(); |
|
| 215 | + $this->xcloner_database = $this->get_xcloner_container()->get_xcloner_database(); |
|
| 216 | + $this->archive_system = $this->get_xcloner_container()->get_archive_system(); |
|
| 217 | + $this->logger = $this->get_xcloner_container()->get_xcloner_logger()->withName("xcloner_scheduler"); |
|
| 218 | + $this->xcloner_remote_storage = $this->get_xcloner_container()->get_xcloner_remote_storage(); |
|
| 219 | 219 | |
| 220 | - if($schedule['recurrence'] == "single") |
|
| 220 | + if ($schedule['recurrence'] == "single") |
|
| 221 | 221 | { |
| 222 | 222 | $this->disable_single_cron($schedule['id']); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if(!$schedule) |
|
| 225 | + if (!$schedule) |
|
| 226 | 226 | { |
| 227 | 227 | $this->logger->info(sprintf("Could not load schedule with id'%s'", $id), array("CRON")); |
| 228 | 228 | return; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $init = 1; |
| 238 | 238 | $continue = 1; |
| 239 | 239 | |
| 240 | - while($continue) |
|
| 240 | + while ($continue) |
|
| 241 | 241 | { |
| 242 | 242 | $continue = $this->xcloner_file_system->start_file_recursion($init); |
| 243 | 243 | |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | $init = 1; |
| 252 | 252 | $return['finished'] = 0; |
| 253 | 253 | |
| 254 | - while(!$return['finished']) |
|
| 254 | + while (!$return['finished']) |
|
| 255 | 255 | { |
| 256 | - $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 256 | + $return = $this->xcloner_database->start_database_recursion((array)json_decode($schedule['table_params']), $return, $init); |
|
| 257 | 257 | $init = 0; |
| 258 | 258 | } |
| 259 | 259 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $return['finished'] = 0; |
| 266 | 266 | $return['extra'] = array(); |
| 267 | 267 | |
| 268 | - while(!$return['finished']) |
|
| 268 | + while (!$return['finished']) |
|
| 269 | 269 | { |
| 270 | 270 | $return = $this->archive_system->start_incremental_backup((array)$schedule['backup_params'], $return['extra'], $init); |
| 271 | 271 | $init = 0; |
@@ -274,29 +274,29 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | //getting the last backup archive file |
| 276 | 276 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 277 | + if ($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 278 | 278 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
| 279 | 279 | |
| 280 | 280 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 281 | 281 | |
| 282 | - if($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 282 | + if ($schedule['remote_storage'] and array_key_exists($schedule['remote_storage'], $this->xcloner_remote_storage->get_available_storages())) |
|
| 283 | 283 | { |
| 284 | 284 | $backup_file = $return['extra']['backup_parent']; |
| 285 | 285 | |
| 286 | 286 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 287 | 287 | |
| 288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 288 | + if (method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 289 | 289 | call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
| 293 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
| 293 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
| 294 | 294 | { |
| 295 | - try{ |
|
| 295 | + try { |
|
| 296 | 296 | $from = "XCloner Schedule - ".$schedule['name']; |
| 297 | 297 | $additional['lines_total'] = $return['extra']['lines_total']; |
| 298 | 298 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
| 299 | - }catch(Exception $e) |
|
| 299 | + }catch (Exception $e) |
|
| 300 | 300 | { |
| 301 | 301 | $this->logger->error($e->getMessage()); |
| 302 | 302 | } |
@@ -311,16 +311,16 @@ discard block |
||
| 311 | 311 | { |
| 312 | 312 | $schedule = $this->get_schedule_by_id($id); |
| 313 | 313 | |
| 314 | - try{ |
|
| 314 | + try { |
|
| 315 | 315 | |
| 316 | 316 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 317 | 317 | |
| 318 | - }catch(Exception $e){ |
|
| 318 | + }catch (Exception $e) { |
|
| 319 | 319 | |
| 320 | - if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
|
| 320 | + if (isset($schedule['backup_params']->email_notification) and $to = $schedule['backup_params']->email_notification) |
|
| 321 | 321 | { |
| 322 | 322 | $from = "XCloner Schedule - ".$schedule['name']; |
| 323 | - $this->archive_system->send_notification($to, $from, "Scheduled backup error","", "", $e->getMessage()); |
|
| 323 | + $this->archive_system->send_notification($to, $from, "Scheduled backup error", "", "", $e->getMessage()); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | } |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $new_list= array(); |
| 44 | 44 | |
| 45 | - foreach($list as $res) |
|
| 46 | - if($res->status) |
|
| 45 | + foreach($list as $res) { |
|
| 46 | + if($res->status) |
|
| 47 | 47 | { |
| 48 | 48 | $res->next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id))+(get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); |
| 49 | + } |
|
| 49 | 50 | $new_list[] = $res; |
| 50 | 51 | } |
| 51 | 52 | $list = $new_list; |
@@ -71,8 +72,9 @@ discard block |
||
| 71 | 72 | { |
| 72 | 73 | $data = $this->db->get_row("SELECT * FROM ".$this->scheduler_table." WHERE id=".$id, ARRAY_A); |
| 73 | 74 | |
| 74 | - if(!$data) |
|
| 75 | - return false; |
|
| 75 | + if(!$data) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | $params = json_decode($data['params']); |
| 78 | 80 | |
@@ -122,12 +124,13 @@ discard block |
||
| 122 | 124 | |
| 123 | 125 | if ( ! wp_next_scheduled( $hook, array($schedule->id) ) and $schedule->status) { |
| 124 | 126 | |
| 125 | - if($schedule->recurrence == "single") |
|
| 126 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 127 | - else |
|
| 128 | - wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 127 | + if($schedule->recurrence == "single") { |
|
| 128 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 129 | + } else { |
|
| 130 | + wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
|
| 131 | + } |
|
| 129 | 132 | |
| 130 | - }elseif(!$schedule->status) |
|
| 133 | + } elseif(!$schedule->status) |
|
| 131 | 134 | { |
| 132 | 135 | $timestamp = wp_next_scheduled( $hook , array($schedule->id) ); |
| 133 | 136 | wp_unschedule_event( $timestamp, $hook, array($schedule->id) ); |
@@ -146,9 +149,9 @@ discard block |
||
| 146 | 149 | |
| 147 | 150 | if ($schedule->status) { |
| 148 | 151 | |
| 149 | - if($schedule->recurrence == "single") |
|
| 150 | - wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 151 | - else{ |
|
| 152 | + if($schedule->recurrence == "single") { |
|
| 153 | + wp_schedule_single_event( strtotime($schedule->start_at), $hook, array($schedule->id)); |
|
| 154 | + } else{ |
|
| 152 | 155 | wp_schedule_event( strtotime($schedule->start_at), $schedule->recurrence, $hook, array($schedule->id) ); |
| 153 | 156 | } |
| 154 | 157 | |
@@ -274,8 +277,9 @@ discard block |
||
| 274 | 277 | |
| 275 | 278 | //getting the last backup archive file |
| 276 | 279 | $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_with_extension(); |
| 277 | - if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) |
|
| 278 | - $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 280 | + if($this->xcloner_file_system->is_part($this->archive_system->get_archive_name_with_extension())) { |
|
| 281 | + $return['extra']['backup_parent'] = $this->archive_system->get_archive_name_multipart(); |
|
| 282 | + } |
|
| 279 | 283 | |
| 280 | 284 | $this->update_last_backup($schedule['id'], $return['extra']['backup_parent']); |
| 281 | 285 | |
@@ -285,8 +289,9 @@ discard block |
||
| 285 | 289 | |
| 286 | 290 | $this->logger->info(sprintf("Transferring backup to remote storage %s", strtoupper($schedule['remote_storage'])), array("CRON")); |
| 287 | 291 | |
| 288 | - if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) |
|
| 289 | - call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 292 | + if(method_exists($this->xcloner_remote_storage, "upload_backup_to_storage")) { |
|
| 293 | + call_user_func_array(array($this->xcloner_remote_storage, "upload_backup_to_storage"), array($backup_file, $schedule['remote_storage'])); |
|
| 294 | + } |
|
| 290 | 295 | } |
| 291 | 296 | |
| 292 | 297 | |
@@ -296,7 +301,7 @@ discard block |
||
| 296 | 301 | $from = "XCloner Schedule - ".$schedule['name']; |
| 297 | 302 | $additional['lines_total'] = $return['extra']['lines_total']; |
| 298 | 303 | $this->archive_system->send_notification($to, $from, "", $return['extra']['backup_parent'], $schedule, "", $additional); |
| 299 | - }catch(Exception $e) |
|
| 304 | + } catch(Exception $e) |
|
| 300 | 305 | { |
| 301 | 306 | $this->logger->error($e->getMessage()); |
| 302 | 307 | } |
@@ -315,7 +320,7 @@ discard block |
||
| 315 | 320 | |
| 316 | 321 | $this->__xcloner_scheduler_callback($id, $schedule); |
| 317 | 322 | |
| 318 | - }catch(Exception $e){ |
|
| 323 | + } catch(Exception $e){ |
|
| 319 | 324 | |
| 320 | 325 | if(isset($schedule['backup_params']->email_notification) and $to=$schedule['backup_params']->email_notification) |
| 321 | 326 | { |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | global $xcloner_plugin; |
| 35 | 35 | |
| 36 | - if(is_a($xcloner_plugin, 'Xcloner')) |
|
| 36 | + if (is_a($xcloner_plugin, 'Xcloner')) |
|
| 37 | 37 | { |
| 38 | 38 | $xcloner_scheduler = $xcloner_plugin->get_xcloner_scheduler(); |
| 39 | 39 | $xcloner_scheduler->deactivate_wp_cron_hooks(); |
@@ -4,44 +4,44 @@ discard block |
||
| 4 | 4 | use Monolog\Handler\StreamHandler; |
| 5 | 5 | use Monolog\Handler\RotatingFileHandler; |
| 6 | 6 | |
| 7 | -class Xcloner_Logger extends Logger{ |
|
| 7 | +class Xcloner_Logger extends Logger { |
|
| 8 | 8 | |
| 9 | - private $logger_path ; |
|
| 9 | + private $logger_path; |
|
| 10 | 10 | private $max_logger_files = 7; |
| 11 | 11 | private $main_logger_url; |
| 12 | 12 | |
| 13 | 13 | public function __construct(Xcloner $xcloner_container, $logger_name = "xcloner_logger") |
| 14 | 14 | { |
| 15 | - if(!$xcloner_container->get_xcloner_settings()) |
|
| 15 | + if (!$xcloner_container->get_xcloner_settings()) |
|
| 16 | 16 | { |
| 17 | 17 | $xcloner_settings = new Xcloner_Settings($xcloner_container); |
| 18 | - }else{ |
|
| 18 | + } else { |
|
| 19 | 19 | $xcloner_settings = $xcloner_container->get_xcloner_settings(); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $hash = $xcloner_settings->get_hash(); |
| 23 | - if($hash == "-".$xcloner_settings->get_server_unique_hash(5)) |
|
| 23 | + if ($hash == "-".$xcloner_settings->get_server_unique_hash(5)) |
|
| 24 | 24 | { |
| 25 | 25 | $hash = ""; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $logger_path = $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename(); |
|
| 29 | - $logger_path_tmp = ""; |
|
| 28 | + $logger_path = $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename(); |
|
| 29 | + $logger_path_tmp = ""; |
|
| 30 | 30 | |
| 31 | - if($hash) |
|
| 31 | + if ($hash) |
|
| 32 | 32 | { |
| 33 | 33 | $logger_path_tmp = $xcloner_settings->get_xcloner_tmp_path().DS.$xcloner_settings->get_logger_filename(1); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $this->logger_path = $logger_path; |
| 37 | 37 | |
| 38 | - if(!is_dir($xcloner_settings->get_xcloner_store_path()) or !is_writable($xcloner_settings->get_xcloner_store_path())) |
|
| 38 | + if (!is_dir($xcloner_settings->get_xcloner_store_path()) or !is_writable($xcloner_settings->get_xcloner_store_path())) |
|
| 39 | 39 | { |
| 40 | 40 | $logger_path = "php://stderr"; |
| 41 | 41 | $logger_path_tmp = ""; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if(!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
| 44 | + if (!$xcloner_settings->get_xcloner_option('xcloner_enable_log')) |
|
| 45 | 45 | { |
| 46 | 46 | $logger_path = "php://stderr"; |
| 47 | 47 | $logger_path_tmp = ""; |
@@ -52,21 +52,21 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $debug_level = Logger::INFO; |
| 54 | 54 | |
| 55 | - if(WP_DEBUG) |
|
| 55 | + if (WP_DEBUG) |
|
| 56 | 56 | { |
| 57 | 57 | $debug_level = Logger::DEBUG; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - if($logger_path) |
|
| 61 | + if ($logger_path) |
|
| 62 | 62 | { |
| 63 | 63 | $stream = new RotatingFileHandler($logger_path, $this->max_logger_files, $debug_level); |
| 64 | 64 | $this->pushHandler($stream); |
| 65 | 65 | |
| 66 | - $this->main_logger_url = $stream->getUrl(); |
|
| 66 | + $this->main_logger_url = $stream->getUrl(); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if($hash and $logger_path_tmp) |
|
| 69 | + if ($hash and $logger_path_tmp) |
|
| 70 | 70 | { |
| 71 | 71 | $this->pushHandler(new StreamHandler($logger_path_tmp, $debug_level)); |
| 72 | 72 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $lines = array(); |
| 85 | 85 | |
| 86 | - if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) |
|
| 86 | + if (!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) |
|
| 87 | 87 | return false; |
| 88 | 88 | |
| 89 | 89 | $fp = fopen($this->main_logger_url, 'r'); |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | $lastLine = ""; |
| 93 | 93 | |
| 94 | 94 | // Loop backword until we have our lines or we reach the start |
| 95 | - while($pos > 0 && count($lines) < $totalLines) { |
|
| 95 | + while ($pos > 0 && count($lines) < $totalLines) { |
|
| 96 | 96 | |
| 97 | 97 | $C = fgetc($fp); |
| 98 | - if($C == "\n") { |
|
| 98 | + if ($C == "\n") { |
|
| 99 | 99 | // skip empty lines |
| 100 | - if(trim($lastLine) != "") { |
|
| 100 | + if (trim($lastLine) != "") { |
|
| 101 | 101 | $lines[] = $lastLine; |
| 102 | 102 | } |
| 103 | 103 | $lastLine = ''; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | if(!$xcloner_container->get_xcloner_settings()) |
| 16 | 16 | { |
| 17 | 17 | $xcloner_settings = new Xcloner_Settings($xcloner_container); |
| 18 | - }else{ |
|
| 18 | + } else{ |
|
| 19 | 19 | $xcloner_settings = $xcloner_container->get_xcloner_settings(); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -83,8 +83,9 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $lines = array(); |
| 85 | 85 | |
| 86 | - if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) |
|
| 87 | - return false; |
|
| 86 | + if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) { |
|
| 87 | + return false; |
|
| 88 | + } |
|
| 88 | 89 | |
| 89 | 90 | $fp = fopen($this->main_logger_url, 'r'); |
| 90 | 91 | fseek($fp, -1, SEEK_END); |