function column_name($item) { //echo "item[blog-id][". $item['blog-id']."]<br />"; //echo "item<pre>"; print_r($item); echo "</pre>"; ?> <a href="?page=snapshots_edit_panel&snapshot-action=edit&item=<?php echo $item['timestamp']; ?> "><?php echo stripslashes($item['name']); ?> </a> <div class="row-actions" style="margin:0; padding:0;"><?php $row_actions = ''; if (Snapshot_Helper_Utility::current_user_can('manage_snapshots_items')) { $row_actions .= '<span class="edit"><a href="?page=snapshots_edit_panel&snapshot-action=edit&item=' . $item['timestamp'] . '">' . __('edit', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; $show_run_now = false; if (is_multisite()) { if ($item['blog-id'] != 0) { $show_run_now = true; } } else { $show_run_now = true; } if ($show_run_now == true) { $row_actions .= ' | '; $row_actions .= '<span class="runonce"><a href="?page=snapshots_edit_panel&snapshot-action=runonce&item=' . $item['timestamp'] . '&snapshot-noonce-field=' . wp_create_nonce('snapshot-runonce') . '">' . __('run now', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; } } if (Snapshot_Helper_Utility::current_user_can('manage_snapshots_items')) { if (strlen($row_actions)) { $row_actions .= ' | '; } $row_actions .= '<span class="restore"><a href="?page=snapshots_edit_panel&snapshot-action=item-archives&snapshot-action-sub=restore&item=' . $item['timestamp'] . '">' . __('restore', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; } if (Snapshot_Helper_Utility::current_user_can('manage_snapshots_items')) { if (strlen($row_actions)) { $row_actions .= ' | '; } $row_actions .= '<span class="delete"><a href="?page=snapshots_edit_panel&snapshot-action=delete-item&item=' . $item['timestamp'] . '&snapshot-noonce-field=' . wp_create_nonce('snapshot-delete-item') . '">' . __('delete', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; } if (!empty($row_actions)) { echo $row_actions; } ?> </div> <?php }
function column_file($data_item) { $_HAS_FILE_RESTORE = false; $this->file_kb = ' '; //echo "data_item<pre>"; print_r($data_item); echo "</pre>"; //echo "item<pre>"; print_r($this->item); echo "</pre>"; if (empty($data_item['destination']) || $data_item['destination'] == "local") { if (isset($data_item['filename'])) { $current_backupFolder = WPMUDEVSnapshot::instance()->snapshot_get_item_destination_path($this->item, $data_item); if (empty($current_backupFolder)) { $current_backupFolder = WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'); } $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename']; // If we don't find file is the alternate directory then try the default if (!file_exists($backupFile)) { if (isset($data_item['destination-directory']) || !empty($data_item['destination-directory'])) { $current_backupFolder = WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'); $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename']; } } if (file_exists($backupFile)) { $_HAS_FILE_RESTORE = true; if (isset($_GET['snapshot-action-sub']) && sanitize_text_field($_GET['snapshot-action-sub']) == "restore" && Snapshot_Helper_Utility::current_user_can('manage_snapshots_items')) { echo '<a href="?page=snapshots_edit_panel&snapshot-action=restore-panel&item=' . $this->item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '">' . $data_item['filename'] . '</a>'; } else { echo '<a href="?page=snapshots_edit_panel&snapshot-item=' . $this->item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '&snapshot-action=download-archive">' . $data_item['filename'] . '</a>'; } } else { echo $data_item['filename']; } } } else { if (isset($data_item['filename'])) { $current_backupFolder = WPMUDEVSnapshot::instance()->get_setting('backupBaseFolderFull'); $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename']; if (file_exists($backupFile)) { $_HAS_FILE_RESTORE = true; ?> <a href="?page=snapshots_edit_panel&snapshot-item=<?php echo $this->item['timestamp']; ?> &snapshot-data-item=<?php echo $data_item['timestamp']; ?> &snapshot-action=download-archive"><?php echo $data_item['filename']; ?> </a><?php } else { echo $data_item['filename']; } } if ($data_item['destination-sync'] == "mirror") { if ($_HAS_FILE_RESTORE == true) { echo "<br />"; } echo Snapshot_Helper_Utility::data_item_file_processed_count($data_item) . " " . __('files synced to destination', SNAPSHOT_I18N_DOMAIN) . "<br />"; } } ?> <div class="row-actions" style="margin:0; padding:0;"> <span class="restore"> <?php $row_actions = ''; if (isset($_GET['snapshot-action-sub']) && sanitize_text_field($_GET['snapshot-action-sub']) == "restore") { if ($_HAS_FILE_RESTORE == true) { if (Snapshot_Helper_Utility::current_user_can('manage_snapshots_items')) { if (strlen($row_actions)) { $row_actions .= ' | '; } $row_actions .= '<a href="?page=snapshots_edit_panel&snapshot-action=restore-panel&item=' . $this->item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '">' . __('restore', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; } } if ($data_item['destination-sync'] == "mirror") { echo '<span style="color:#FF0000">' . __("File sync has no restore at this time", SNAPSHOT_I18N_DOMAIN) . '</span>'; } } else { if ($_HAS_FILE_RESTORE == true) { $row_actions .= '<a href="?page=snapshots_edit_panel&snapshot-item=' . $this->item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '&snapshot-action=download-archive">' . __('download', SNAPSHOT_I18N_DOMAIN) . '</a>'; } if ($_HAS_FILE_RESTORE == true) { if (Snapshot_Helper_Utility::current_user_can('manage_snapshots_items')) { if (strlen($row_actions)) { $row_actions .= ' | '; } $row_actions .= '<a href="?page=snapshots_edit_panel&snapshot-action=restore-panel&item=' . $this->item['timestamp'] . '&snapshot-data-item=' . $data_item['timestamp'] . '">' . __('restore', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; } } if (Snapshot_Helper_Utility::current_user_can('manage_snapshots_items')) { if (strlen($row_actions)) { $row_actions .= ' | '; } $row_actions .= '<span class="delete"><a href="?page=snapshots_edit_panel&snapshot-action=item-archives&item=' . $this->item['timestamp'] . '&action=delete&data-item=' . $data_item['timestamp'] . '&snapshot-noonce-field=' . wp_create_nonce('snapshot-delete-item') . '">' . __('delete', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; } if (isset($this->item['destination']) && !empty($this->item['destination']) && $this->item['destination'] !== "local") { if (strlen($row_actions)) { $row_actions .= ' | '; } $row_actions .= '<span class="resend"><a href="?page=snapshots_edit_panel&snapshot-action=item-archives&item=' . $this->item['timestamp'] . '&action=resend&data-item=' . $data_item['timestamp'] . '&snapshot-noonce-field=' . wp_create_nonce('snapshot-delete-item') . '">' . __('resend', SNAPSHOT_I18N_DOMAIN) . '</a></span>'; } } if (!empty($row_actions)) { echo $row_actions; } ?> </div> <?php }