Пример #1
0
/**
 * Display the row of actions for a schedule
 *
 * @access public
 * @param HMBKP_Scheduled_Backup $schedule
 * @return void
 */
function hmbkp_schedule_actions(HMBKP_Scheduled_Backup $schedule)
{
    // Start output buffering
    ob_start();
    ?>

	<span class="hmbkp-status"><?php 
    echo $schedule->get_status() ? wp_kses_data($schedule->get_status()) : __('Starting Backup', 'hmbkp');
    ?>
 <a href="<?php 
    echo esc_url(add_query_arg(array('action' => 'hmbkp_cancel', 'hmbkp_schedule_id' => $schedule->get_id()), HMBKP_ADMIN_URL));
    ?>
"><?php 
    _e('cancel', 'hmbkp');
    ?>
</a></span>

	<div class="hmbkp-schedule-actions row-actions">

		<a class="colorbox" href="<?php 
    echo esc_url(add_query_arg(array('action' => 'hmbkp_edit_schedule_load', 'hmbkp_schedule_id' => $schedule->get_id()), admin_url('admin-ajax.php')));
    ?>
"><?php 
    _e('Settings', 'hmbkp');
    ?>
</a> |

	<?php 
    if ($schedule->get_type() !== 'database') {
        ?>
		<a class="colorbox" href="<?php 
        echo esc_url(add_query_arg(array('action' => 'hmbkp_edit_schedule_excludes_load', 'hmbkp_schedule_id' => $schedule->get_id()), admin_url('admin-ajax.php')));
        ?>
"><?php 
        _e('Excludes', 'hmbkp');
        ?>
</a>  |
	<?php 
    }
    ?>

		<?php 
    // capture output
    $output = ob_get_clean();
    echo apply_filters('hmbkp_schedule_actions_menu', $output, $schedule);
    ?>

		<a class="hmbkp-run" href="<?php 
    echo esc_url(add_query_arg(array('action' => 'hmbkp_run_schedule', 'hmbkp_schedule_id' => $schedule->get_id()), admin_url('admin-ajax.php')));
    ?>
"><?php 
    _e('Run now', 'hmbkp');
    ?>
</a>  |

		<a class="delete-action" href="<?php 
    echo wp_nonce_url(add_query_arg(array('action' => 'hmbkp_delete_schedule', 'hmbkp_schedule_id' => $schedule->get_id()), HMBKP_ADMIN_URL), 'hmbkp-delete_schedule');
    ?>
"><?php 
    _e('Delete', 'hmbkp');
    ?>
</a>

	</div>

<?php 
}
Пример #2
0
/**
 * Returns a formatted string containing the calculated total site size or a message
 * to indicate it is being calculated.
 *
 * @param HMBKP_Scheduled_Backup $schedule
 *
 * @return string
 */
function hmbkp_get_site_size_text(HMBKP_Scheduled_Backup $schedule)
{
    if (isset($_GET['hmbkp_add_schedule'])) {
        return '';
    } elseif ('database' === $schedule->get_type() || $schedule->is_site_size_cached()) {
        return sprintf('(<code title="' . __('Backups will be compressed and should be smaller than this.', 'backupwordpress') . '">%s</code>)', esc_attr($schedule->get_formatted_site_size()));
    } else {
        return sprintf('(<code class="calculating" title="' . __('this shouldn\'t take long&hellip;', 'backupwordpress') . '">' . __('calculating the size of your backup&hellip;', 'backupwordpress') . '</code>)');
    }
}