function column_notes($item) { // if ((isset($item['data'])) && (count($item['data']))) // $data_item = snapshot_utility_latest_data_item($item['data']); // else // return " "; $tables_sections_out = snapshot_utility_get_tables_sections_display($item); $files_sections_out = snapshot_utility_get_files_sections_display($item); if ((strlen($tables_sections_out['click'])) || (strlen($files_str))) { ?><p><?php echo $tables_sections_out['click']; if (strlen($tables_sections_out['click'])) echo "</br />"; echo $files_sections_out['click']; ?></p><?php echo $tables_sections_out['hidden']; } }
/** * Metabox to show the backup archived files * * @since 1.0.2 * * @param string $title - Title to be displayed in header of metabox * @param array $item - The current viewed item * @param bool $restore_option - If shown on the restore panel. * @return none */ function snapshot_metabox_show_archive_files($title, $item, $restore_option=false) { global $wpmudev_snapshot; //echo "item<pre>"; print_r($item); echo "</pre>"; ?> <div class="postbox"> <h3 class="hndle"><span><?php echo $title; ?></span></h3> <div class="inside"> <?php if ($restore_option == true) { /* ?><p><?php _e('Select which archive to restore', SNAPSHOT_I18N_DOMAIN); ?></p><?php */ } else { ?> <p><?php _e('Below is a listing of your archives showing at most the most recent 6 entries. If the archive is local you can click on the filename to download it. You can also view or download the load file the archive.', SNAPSHOT_I18N_DOMAIN); ?> <a href="?page=snapshots_edit_panel&snapshot-action=item-archives&item=<?php echo $item['timestamp'] ?>"><?php _e('View all archives', SNAPSHOT_I18N_DOMAIN); ?></a></p> <?php } if ((isset($item['data'])) && (count($item['data']))) { $data_items = $item['data']; krsort($data_items); if (isset($_GET['snapshot-data-item'])) { $data_item_key = intval($_GET['snapshot-data-item']); if (isset($data_items[$data_item_key])) { $data_item = $data_items[$data_item_key]; $data_items = array(); $data_items[$data_item_key] = $data_item; } } else { if (count($data_items) > 6) { $data_items = array_slice($data_items, 0, 6, true); } } ?> <table class="widefat"> <thead> <tr class="form-field"> <?php if ($restore_option == true) { ?><th class="snapshot-col-restore"><?php _e('Select', SNAPSHOT_I18N_DOMAIN); ?></th><?php } ?> <th class="snapshot-col-date"><?php _e('Date', SNAPSHOT_I18N_DOMAIN); ?></th> <th class="snapshot-col-file"><?php _e('File', SNAPSHOT_I18N_DOMAIN); ?></th> <th class="snapshot-col-notes"><?php _e('Notes', SNAPSHOT_I18N_DOMAIN); ?></th> <th class="snapshot-col-size"><?php _e('Size', SNAPSHOT_I18N_DOMAIN); ?></th> <?php if ($restore_option != true) { if ($wpmudev_snapshot->config_data['config']['absoluteFolder'] != true) { ?><th class="snapshot-col-logs"><?php _e('Logs', SNAPSHOT_I18N_DOMAIN); ?></th><?php } } ?> </tr> </thead> <tbody style="overflow: auto; max-height: 100px;"> <?php $selected_item = ""; foreach($data_items as $data_key => $data_item) { //echo "data_item<pre>"; print_r($data_item); echo "</pre>"; if (!isset($row_class)) { $row_class = ""; } $row_class = ( $row_class == '' ? 'alternate' : '' ); $backupLogFileFull = trailingslashit($wpmudev_snapshot->snapshot_get_setting('backupLogFolderFull')) . $item['timestamp'] ."_". $data_item['timestamp'] .".log"; ?><tr class="form-field <?php echo $row_class; ?>"><?php if ($restore_option == true) { ?><td><input type="radio" name="snapshot-restore-file" class="snapshot-restore-file" id="snapshot-restore-<?php echo $data_item['timestamp']; ?>" value="<?php echo $data_item['timestamp']; ?>" <?php if ((isset($_GET['snapshot-data-item'])) && (intval($_GET['snapshot-data-item']) == $data_item['timestamp'])) { echo ' checked="checked" '; } ?>/></td><?php } ?><td><?php echo snapshot_utility_show_date_time($data_item['timestamp']); ?></td><?php ?><td><?php if ((empty($data_item['destination'])) || ($data_item['destination'] == "local")) { if (isset($data_item['filename'])) { $current_backupFolder = $wpmudev_snapshot->snapshot_get_item_destination_path($item, $data_item); if (empty($current_backupFolder)) { $current_backupFolder = $wpmudev_snapshot->snapshot_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 = $wpmudev_snapshot->snapshot_get_setting('backupBaseFolderFull'); $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename']; } } if (file_exists($backupFile)) { echo '<a href="?page=snapshots_edit_panel&snapshot-item='. $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 = $wpmudev_snapshot->snapshot_get_setting('backupBaseFolderFull'); $backupFile = trailingslashit(trim($current_backupFolder)) . $data_item['filename']; if (file_exists($backupFile)) { echo '<a href="?page=snapshots_edit_panel&snapshot-item='. $item['timestamp'] .'&snapshot-data-item='. $data_item['timestamp'] .'&snapshot-action=download-archive">'. $data_item['filename'] .'</a>'; } else { echo $data_item['filename']; } } } ?></td><?php ?><td><?php $tables_sections_out = snapshot_utility_get_tables_sections_display($data_item); $files_sections_out = snapshot_utility_get_files_sections_display($data_item); if ((strlen($tables_sections_out['click'])) || (strlen($files_str))) { ?><p><?php echo $tables_sections_out['click']; if (strlen($tables_sections_out['click'])) echo "</br />"; echo $files_sections_out['click']; ?></p><?php echo $tables_sections_out['hidden']; } ?></td><?php ?><td><?php if (isset($data_item['file_size'])) { $file_kb = snapshot_utility_size_format($data_item['file_size']); echo $file_kb; } else { echo " "; } ?></td><?php if ($restore_option != true) { ?><td><?php if (file_exists($backupLogFileFull)) { echo '<a class="thickbox" href="'. admin_url() .'admin-ajax.php?action=snapshot_view_log_ajax&width=800&height=600&snapshot-item=' . $item['timestamp'] .'&snapshot-data-item='. $data_item['timestamp'] .'">'. __('view', SNAPSHOT_I18N_DOMAIN) .'</a>'; echo " "; echo '<a href="?page=snapshots_edit_panel&snapshot-action=download-log&snapshot-item=' . $item['timestamp'] .'&snapshot-data-item='. $data_item['timestamp'] .'">' . __('download', SNAPSHOT_I18N_DOMAIN) .'</a>'; } else { echo " "; } ?></td><?php } ?></tr><?php } ?></tbody></table><?php } else { _e('No Archives', SNAPSHOT_I18N_DOMAIN); } ?> </div> </div> <?php }
function column_notes($data_item) { $tables_sections_out = snapshot_utility_get_tables_sections_display($data_item); $files_sections_out = snapshot_utility_get_files_sections_display($data_item); if ((strlen($tables_sections_out['click'])) || (strlen($files_str))) { ?><p><?php echo $tables_sections_out['click']; if (strlen($tables_sections_out['click'])) echo "</br />"; echo $files_sections_out['click']; ?></p><?php echo $tables_sections_out['hidden']; } }