本文整理汇总了PHP中BackWPup_Option::get方法的典型用法代码示例。如果您正苦于以下问题:PHP BackWPup_Option::get方法的具体用法?PHP BackWPup_Option::get怎么用?PHP BackWPup_Option::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackWPup_Option
的用法示例。
在下文中一共展示了BackWPup_Option::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jobs
/**
* Display a List of Jobs
*
* @synopsis jobs
*/
public function jobs($args, $assoc_args)
{
$jobids = BackWPup_Option::get_job_ids();
WP_CLI::line(__('List of jobs', 'backwpup'));
WP_CLI::line('----------------------------------------------------------------------');
foreach ($jobids as $jobid) {
WP_CLI::line(sprintf(__('ID: %1$d Name: %2$s', 'backwpup'), $jobid, BackWPup_Option::get($jobid, 'name')));
}
}
示例2: jobs
/**
* Display a List of Jobs
*
*/
public function jobs($args, $assoc_args)
{
$formatter_args = array('format' => 'table', 'fields' => array('Job ID', 'Name'), 'field' => NULL);
$items = array();
$formatter = new WP_CLI\Formatter($formatter_args);
$jobids = BackWPup_Option::get_job_ids();
foreach ($jobids as $jobid) {
$items[] = array('Job ID' => $jobid, 'Name' => BackWPup_Option::get($jobid, 'name'));
}
$formatter->display_items($items);
}
示例3: edit_tab
/**
* @param $jobid
*/
public function edit_tab($jobid)
{
?>
<h3 class="title"><?php
_e('Settings for database check', 'backwpup');
?>
</h3>
<p></p>
<table class="form-table">
<tr>
<th scope="row"><?php
_e('WordPress tables only', 'backwpup');
?>
</th>
<td>
<label for="iddbcheckwponly">
<input class="checkbox" value="1" id="iddbcheckwponly"
type="checkbox" <?php
checked(BackWPup_Option::get($jobid, 'dbcheckwponly'), TRUE);
?>
name="dbcheckwponly"/> <?php
_e('Check WordPress database tables only', 'backwpup');
?>
</label>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Repair', 'backwpup');
?>
</th>
<td>
<label for="iddbcheckrepair">
<input class="checkbox" value="1" id="iddbcheckrepair"
type="checkbox" <?php
checked(BackWPup_Option::get($jobid, 'dbcheckrepair'), TRUE);
?>
name="dbcheckrepair" /> <?php
_e('Try to repair defect table', 'backwpup');
?>
</label>
</td>
</tr>
</table>
<?php
}
示例4: edit_tab
/**
* @param $jobid
* @return void
*/
public function edit_tab($jobid)
{
?>
<table class="form-table">
<tr>
<th scope="row"><label for="idpluginlistfile"><?php
_e('Plugin list file name', 'backwpup');
?>
</label></th>
<td>
<input name="pluginlistfile" type="text" id="idpluginlistfile"
value="<?php
echo BackWPup_Option::get($jobid, 'pluginlistfile');
?>
"
class="medium-text code"/>.txt
</td>
</tr>
<tr>
<th scope="row"><?php
_e('File compression', 'backwpup');
?>
</th>
<td>
<fieldset>
<?php
echo '<label for="idpluginlistfilecompression"><input class="radio" type="radio"' . checked('', BackWPup_Option::get($jobid, 'pluginlistfilecompression'), FALSE) . ' name="pluginlistfilecompression" id="idpluginlistfilecompression" value="" /> ' . __('none', 'backwpup') . '</label><br />';
if (function_exists('gzopen')) {
echo '<label for="idpluginlistfilecompression-gz"><input class="radio" type="radio"' . checked('.gz', BackWPup_Option::get($jobid, 'pluginlistfilecompression'), FALSE) . ' name="pluginlistfilecompression" id="idpluginlistfilecompression-gz" value=".gz" /> ' . __('GZip', 'backwpup') . '</label><br />';
} else {
echo '<label for="idpluginlistfilecompression-gz"><input class="radio" type="radio"' . checked('.gz', BackWPup_Option::get($jobid, 'pluginlistfilecompression'), FALSE) . ' name="pluginlistfilecompression" id="idpluginlistfilecompression-gz" value=".gz" disabled="disabled" /> ' . __('GZip', 'backwpup') . '</label><br />';
}
if (function_exists('bzopen')) {
echo '<label for="idpluginlistfilecompression-bz2"><input class="radio" type="radio"' . checked('.bz2', BackWPup_Option::get($jobid, 'pluginlistfilecompression'), FALSE) . ' name="pluginlistfilecompression" id="idpluginlistfilecompression-bz2" value=".bz2" /> ' . __('BZip2', 'backwpup') . '</label><br />';
} else {
echo '<label for="idpluginlistfilecompression-bz2"><input class="radio" type="radio"' . checked('.bz2', BackWPup_Option::get($jobid, 'pluginlistfilecompression'), FALSE) . ' name="pluginlistfilecompression" id="idpluginlistfilecompression-bz2" value=".bz2" disabled="disabled" /> ' . __('BZip2', 'backwpup') . '</label><br />';
}
?>
</fieldset>
</td>
</tr>
</table>
<?php
}
示例5: adminbar
/**
* @global $wp_admin_bar WP_Admin_Bar
*/
public function adminbar()
{
global $wp_admin_bar;
/* @var WP_Admin_Bar $wp_admin_bar */
$menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data('name') . '</span>';
$menu_herf = network_admin_url('admin.php') . '?page=backwpup';
if (file_exists(BackWPup::get_plugin_data('running_file')) && current_user_can('backwpup_jobs_start')) {
$menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data('name') . ' <span id="backwpup-adminbar-running">' . __('running', 'backwpup') . '</span></span>';
$menu_herf = network_admin_url('admin.php') . '?page=backwpupjobs';
}
if (current_user_can('backwpup')) {
$wp_admin_bar->add_menu(array('id' => 'backwpup', 'title' => $menu_title, 'href' => $menu_herf, 'meta' => array('title' => BackWPup::get_plugin_data('name'))));
}
if (file_exists(BackWPup::get_plugin_data('running_file')) && current_user_can('backwpup_jobs_start')) {
$wp_admin_bar->add_menu(array('id' => 'backwpup_working', 'parent' => 'backwpup_jobs', 'title' => __('Now Running', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupjobs'));
$wp_admin_bar->add_menu(array('id' => 'backwpup_working_abort', 'parent' => 'backwpup_working', 'title' => __('Abort!', 'backwpup'), 'href' => wp_nonce_url(network_admin_url('admin.php') . '?page=backwpup&action=abort', 'abort-job')));
}
if (current_user_can('backwpup_jobs')) {
$wp_admin_bar->add_menu(array('id' => 'backwpup_jobs', 'parent' => 'backwpup', 'title' => __('Jobs', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupjobs'));
}
if (current_user_can('backwpup_jobs_edit')) {
$wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_new', 'parent' => 'backwpup_jobs', 'title' => __('Add new', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupeditjob&tab=job'));
}
if (current_user_can('backwpup_logs')) {
$wp_admin_bar->add_menu(array('id' => 'backwpup_logs', 'parent' => 'backwpup', 'title' => __('Logs', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpuplogs'));
}
if (current_user_can('backwpup_backups')) {
$wp_admin_bar->add_menu(array('id' => 'backwpup_backups', 'parent' => 'backwpup', 'title' => __('Backups', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupbackups'));
}
//add jobs
$jobs = (array) BackWPup_Option::get_job_ids();
foreach ($jobs as $jobid) {
if (current_user_can('backwpup_jobs_edit')) {
$name = BackWPup_Option::get($jobid, 'name');
$wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_' . $jobid, 'parent' => 'backwpup_jobs', 'title' => $name, 'href' => wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&tab=job&jobid=' . $jobid, 'edit-job')));
}
if (current_user_can('backwpup_jobs_start')) {
$url = BackWPup_Job::get_jobrun_url('runnowlink', $jobid);
$wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_runnow_' . $jobid, 'parent' => 'backwpup_jobs_' . $jobid, 'title' => __('Run Now', 'backwpup'), 'href' => $url['url']));
}
}
}
示例6: edit_tab
public function edit_tab($jobid)
{
?>
<table class="form-table">
<tr>
<th scope="row"><label for="idwidgetlistfile"><?php
_e('Widget list file name', 'backwpup');
?>
</label></th>
<td>
<input name="widgetlistfile" type="text" id="idwidgetlistfile"
value="<?php
echo BackWPup_Option::get($jobid, 'widgetlistfile');
?>
"
class="medium-text code"/>.sql
</td>
</tr>
</table>
<?php
}
示例7: edit_tab
/**
* @param $jobid
* @internal param $main
*/
public function edit_tab($jobid)
{
?>
<table class="form-table">
<tr>
<th scope="row"><?php
_e('Items to export', 'backwpup');
?>
</th>
<td>
<fieldset>
<label for="idwpexportcontent-all"><input type="radio" name="wpexportcontent" id="idwpexportcontent-all" value="all" <?php
checked(BackWPup_Option::get($jobid, 'wpexportcontent'), 'all');
?>
/> <?php
_e('All content', 'backwpup');
?>
</label><br />
<label for="idwpexportcontent-post"><input type="radio" name="wpexportcontent" id="idwpexportcontent-post" value="post" <?php
checked(BackWPup_Option::get($jobid, 'wpexportcontent'), 'post');
?>
/> <?php
_e('Posts', 'backwpup');
?>
</label><br />
<label for="idwpexportcontent-page"><input type="radio" name="wpexportcontent" id="idwpexportcontent-page" value="page" <?php
checked(BackWPup_Option::get($jobid, 'wpexportcontent'), 'page');
?>
/> <?php
_e('Pages', 'backwpup');
?>
</label><br />
<?php
foreach (get_post_types(array('_builtin' => FALSE, 'can_export' => TRUE), 'objects') as $post_type) {
?>
<label for="idwpexportcontent-<?php
echo esc_attr($post_type->name);
?>
"><input type="radio" name="wpexportcontent" id="idwpexportcontent-<?php
echo esc_attr($post_type->name);
?>
" value="<?php
echo esc_attr($post_type->name);
?>
" <?php
checked(BackWPup_Option::get($jobid, 'wpexportcontent'), esc_attr($post_type->name));
?>
/> <?php
echo esc_html($post_type->label);
?>
</label><br />
<?php
}
?>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><label for="idwpexportfile"><?php
_e('XML Export file name', 'backwpup');
?>
</label></th>
<td>
<input name="wpexportfile" type="text" id="idwpexportfile"
value="<?php
echo BackWPup_Option::get($jobid, 'wpexportfile');
?>
"
class="medium-text code"/>.xml
</td>
</tr>
<tr>
<th scope="row"><?php
_e('File compression', 'backwpup');
?>
</th>
<td>
<fieldset>
<?php
echo '<label for="idwpexportfilecompression"><input class="radio" type="radio"' . checked('', BackWPup_Option::get($jobid, 'wpexportfilecompression'), FALSE) . ' name="wpexportfilecompression" id="idwpexportfilecompression" value="" /> ' . __('none', 'backwpup') . '</label><br />';
if (function_exists('gzopen')) {
echo '<label for="idwpexportfilecompression-gz"><input class="radio" type="radio"' . checked('.gz', BackWPup_Option::get($jobid, 'wpexportfilecompression'), FALSE) . ' name="wpexportfilecompression" id="idwpexportfilecompression-gz" value=".gz" /> ' . __('GZip', 'backwpup') . '</label><br />';
} else {
echo '<label for="idwpexportfilecompression-gz"><input class="radio" type="radio"' . checked('.gz', BackWPup_Option::get($jobid, 'wpexportfilecompression'), FALSE) . ' name="wpexportfilecompression" id="idwpexportfilecompression-gz" value=".gz" disabled="disabled" /> ' . __('GZip', 'backwpup') . '</label><br />';
}
if (function_exists('bzopen')) {
echo '<label for="idwpexportfilecompression-bz2"><input class="radio" type="radio"' . checked('.bz2', BackWPup_Option::get($jobid, 'wpexportfilecompression'), FALSE) . ' name="wpexportfilecompression" id="idwpexportfilecompression-bz2" value=".bz2" /> ' . __('BZip2', 'backwpup') . '</label><br />';
} else {
echo '<label for="idwpexportfilecompression-bz2"><input class="radio" type="radio"' . checked('.bz2', BackWPup_Option::get($jobid, 'wpexportfilecompression'), FALSE) . ' name="wpexportfilecompression" id="idwpexportfilecompression-bz2" value=".bz2" disabled="disabled" /> ' . __('BZip2', 'backwpup') . '</label><br />';
}
?>
</fieldset>
</td>
</tr>
</table>
<?php
//.........这里部分代码省略.........
示例8: file_delete
/**
* @param $jobdest
* @param $backupfile
*/
public function file_delete($jobdest, $backupfile)
{
$files = get_site_transient('backwpup_' . strtolower($jobdest));
list($jobid, $dest) = explode('_', $jobdest);
if (BackWPup_Option::get($jobid, 'ftphost') && BackWPup_Option::get($jobid, 'ftpuser') && BackWPup_Option::get($jobid, 'ftppass') && function_exists('ftp_connect')) {
$ftp_conn_id = FALSE;
if (function_exists('ftp_ssl_connect') && BackWPup_Option::get($jobid, 'ftpssl')) {
//make SSL FTP connection
$ftp_conn_id = ftp_ssl_connect(BackWPup_Option::get($jobid, 'ftphost'), BackWPup_Option::get($jobid, 'ftphostport'), BackWPup_Option::get($jobid, 'ftptimeout'));
} elseif (!BackWPup_Option::get($jobid, 'ftpssl')) {
//make normal FTP conection if SSL not work
$ftp_conn_id = ftp_connect(BackWPup_Option::get($jobid, 'ftphost'), BackWPup_Option::get($jobid, 'ftphostport'), BackWPup_Option::get($jobid, 'ftptimeout'));
}
$loginok = FALSE;
if ($ftp_conn_id) {
//FTP Login
if (@ftp_login($ftp_conn_id, BackWPup_Option::get($jobid, 'ftpuser'), BackWPup_Encryption::decrypt(BackWPup_Option::get($jobid, 'ftppass')))) {
$loginok = TRUE;
} else {
//if PHP ftp login don't work use raw login
ftp_raw($ftp_conn_id, 'USER ' . BackWPup_Option::get($jobid, 'ftpuser'));
$return = ftp_raw($ftp_conn_id, 'PASS ' . BackWPup_Encryption::decrypt(BackWPup_Option::get($jobid, 'ftppass')));
if (substr(trim($return[0]), 0, 3) <= 400) {
$loginok = TRUE;
}
}
}
if ($loginok) {
ftp_pasv($ftp_conn_id, BackWPup_Option::get($jobid, 'ftppasv'));
ftp_delete($ftp_conn_id, $backupfile);
//update file list
foreach ($files as $key => $file) {
if (is_array($file) && $file['file'] == $backupfile) {
unset($files[$key]);
}
}
} else {
BackWPup_Admin::message(__('FTP: Login failure!', 'backwpup'), TRUE);
}
}
set_site_transient('backwpup_' . strtolower($jobdest), $files, YEAR_IN_SECONDS);
}
示例9: status
public static function status($backwpup_jobid)
{
if (empty($backwpup_jobid)) {
$id = get_site_option('backwpup_cfg_easycronjobid');
} else {
$id = BackWPup_Option::get($backwpup_jobid, 'easycronjobid');
}
if (empty($id)) {
return array();
}
$cron_job = get_site_transient('backwpup_easycron_' . $id);
if (!empty($cron_job)) {
return $cron_job;
}
$message = self::query_api('detail', array('id' => $id));
if ($message['status'] == 'success' && !empty($message['cron_job'])) {
set_site_transient('backwpup_easycron_' . $id, $message['cron_job'], 3600 - 30);
return $message['cron_job'];
} else {
if ($message['error']['code'] == 25) {
if (empty($backwpup_jobid)) {
delete_site_option('backwpup_cfg_easycronjobid');
} else {
BackWPup_Option::delete($backwpup_jobid, 'easycronjobid');
}
}
}
return array();
}
示例10: get_destinations_list
/**
* @return array
*/
function get_destinations_list()
{
$jobdest = array();
$jobids = BackWPup_Option::get_job_ids();
if (!empty($jobids)) {
foreach ($jobids as $jobid) {
if (BackWPup_Option::get($jobid, 'backuptype') == 'sync') {
// jump over sync
continue;
}
$dests = BackWPup_Option::get($jobid, 'destinations');
foreach ($dests as $dest) {
if (empty($this->destinations[$dest]['class'])) {
continue;
}
$dest_class = BackWPup::get_destination($dest);
$can_do_dest = $dest_class->file_get_list($jobid . '_' . $dest);
if (!empty($can_do_dest)) {
$jobdest[] = $jobid . '_' . $dest;
}
}
}
}
return $jobdest;
}
示例11: file_download
/**
* @param $jobid
* @param $get_file
*/
public function file_download($jobid, $get_file)
{
try {
$s3 = new AmazonS3(array('key' => BackWPup_Option::get($jobid, 's3accesskey'), 'secret' => BackWPup_Encryption::decrypt(BackWPup_Option::get($jobid, 's3secretkey')), 'certificate_authority' => TRUE));
$base_url = $this->get_s3_base_url(BackWPup_Option::get($jobid, 's3region'), BackWPup_Option::get($jobid, 's3base_url'));
if (stristr($base_url, 'amazonaws.com')) {
$s3->set_region(str_replace(array('http://', 'https://'), '', $base_url));
} else {
$s3->set_hostname(str_replace(array('http://', 'https://'), '', $base_url));
$s3->allow_hostname_override(FALSE);
if (substr($base_url, -1) == '/') {
$s3->enable_path_style(TRUE);
}
}
if (stristr($base_url, 'http://')) {
$s3->disable_ssl();
}
$s3file = $s3->get_object(BackWPup_Option::get($jobid, 's3bucket'), $get_file);
} catch (Exception $e) {
die($e->getMessage());
}
if ($s3file->status == 200) {
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . basename($get_file) . ";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $s3file->header->_info->size_download);
@set_time_limit(0);
echo $s3file->body;
die;
}
}
示例12: mb_next_jobs
/**
* Displaying next jobs
*/
private static function mb_next_jobs()
{
if (!current_user_can('backwpup_jobs')) {
return;
}
?>
<table class="wp-list-table widefat" cellspacing="0">
<caption><?php
_e('Next scheduled jobs', 'backwpup');
?>
</caption>
<thead>
<tr>
<th style="width: 30%"><?php
_e('Time', 'backwpup');
?>
</th>
<th style="width: 70%"><?php
_e('Job', 'backwpup');
?>
</th>
</tr>
</thead>
<?php
//get next jobs
$mainsactive = BackWPup_Option::get_job_ids('activetype', 'wpcron');
sort($mainsactive);
$alternate = TRUE;
// add working job if it not in active jobs
$job_object = BackWPup_Job::get_working_data();
if (!empty($job_object) && !empty($job_object->job['jobid']) && !in_array($job_object->job['jobid'], $mainsactive)) {
$mainsactive[] = $job_object->job['jobid'];
}
foreach ($mainsactive as $jobid) {
$name = BackWPup_Option::get($jobid, 'name');
if (!empty($job_object) && $job_object->job['jobid'] == $jobid) {
$runtime = current_time('timestamp') - $job_object->job['lastrun'];
if (!$alternate) {
echo '<tr>';
$alternate = TRUE;
} else {
echo '<tr class="alternate">';
$alternate = FALSE;
}
echo '<td>' . sprintf('<span style="color:#e66f00;">' . __('working since %d seconds', 'backwpup') . '</span>', $runtime) . '</td>';
echo '<td><span style="font-weight:bold;">' . esc_html($job_object->job['name']) . '</span><br />';
echo "<a style=\"color:red;\" href=\"" . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupjobs&action=abort', 'abort-job') . "\">" . __('Abort', 'backwpup') . "</a>";
echo "</td></tr>";
} else {
if (!$alternate) {
echo '<tr>';
$alternate = TRUE;
} else {
echo '<tr class="alternate">';
$alternate = FALSE;
}
if ($nextrun = wp_next_scheduled('backwpup_cron', array('id' => $jobid)) + get_option('gmt_offset') * 3600) {
echo '<td>' . sprintf(__('%1$s at %2$s', 'backwpup'), date_i18n(get_option('date_format'), $nextrun, TRUE), date_i18n(get_option('time_format'), $nextrun, TRUE)) . '</td>';
} else {
echo '<td><em>' . __('Not scheduled!', 'backwpup') . '</em></td>';
}
echo '<td><a href="' . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&jobid=' . $jobid, 'edit-job') . '" title="' . esc_attr(__('Edit Job', 'backwpup')) . '">' . $name . '</a></td></tr>';
}
}
if (empty($mainsactive) and !empty($job_object)) {
echo '<tr><td colspan="2"><i>' . __('none', 'backwpup') . '</i></td></tr>';
}
?>
</table>
<?php
}
示例13: file_get_list
/**
* @param $jobdest
* @return mixed
*/
public function file_get_list($jobdest)
{
list($jobid, $dest) = explode('_', $jobdest, 2);
$filecounter = 0;
$files = array();
$backup_folder = BackWPup_Option::get($jobid, 'backupdir');
$backup_folder = BackWPup_File::get_absolute_path($backup_folder);
if (is_dir($backup_folder) && ($dir = opendir($backup_folder))) {
//make file list
while (FALSE !== ($file = readdir($dir))) {
if (in_array($file, array('.', '..', 'index.php', '.htaccess', '.donotbackup')) || is_dir($backup_folder . $file) || is_link($backup_folder . $file)) {
continue;
}
if (is_readable($backup_folder . $file)) {
//file list for backups
$files[$filecounter]['folder'] = $backup_folder;
$files[$filecounter]['file'] = $backup_folder . $file;
$files[$filecounter]['filename'] = $file;
$files[$filecounter]['downloadurl'] = add_query_arg(array('page' => 'backwpupbackups', 'action' => 'downloadfolder', 'file' => $file, 'jobid' => $jobid), network_admin_url('admin.php'));
$files[$filecounter]['filesize'] = filesize($backup_folder . $file);
$files[$filecounter]['time'] = filemtime($backup_folder . $file);
$filecounter++;
}
}
closedir($dir);
}
return $files;
}
示例14: file_download
/**
* @param $jobid
* @param $get_file
*/
public function file_download($jobid, $get_file)
{
try {
$conn = new OpenCloud\Rackspace(self::get_auth_url_by_region(BackWPup_Option::get($jobid, 'rscregion')), array('username' => BackWPup_Option::get($jobid, 'rscusername'), 'apiKey' => BackWPup_Encryption::decrypt(BackWPup_Option::get($jobid, 'rscapikey'))));
$ostore = $conn->objectStoreService('cloudFiles', BackWPup_Option::get($jobid, 'rscregion'), 'publicURL');
$container = $ostore->getContainer(BackWPup_Option::get($jobid, 'rsccontainer'));
$backupfile = $container->getObject($get_file);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . basename($get_file) . ";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $backupfile->getContentLength());
@set_time_limit(300);
echo $backupfile->getContent();
die;
} catch (Exception $e) {
die($e->getMessage());
}
}
示例15: edit_tab
/**
* @param $jobid
*/
public function edit_tab($jobid)
{
global $wpdb;
/* @var wpdb $wpdb */
?>
<input name="dbdumpwpony" type="hidden" value="1" />
<h3 class="title"><?php
_e('Settings for database backup', 'backwpup');
?>
</h3>
<p></p>
<table class="form-table">
<tr>
<th scope="row"><?php
_e('Tables to backup', 'backwpup');
?>
</th>
<td>
<input type="button" class="button-secondary" id="dball" value="<?php
_e('all', 'backwpup');
?>
">
<input type="button" class="button-secondary" id="dbnone" value="<?php
_e('none', 'backwpup');
?>
">
<input type="button" class="button-secondary" id="dbwp" value="<?php
echo $wpdb->prefix;
?>
">
<?php
$tables = $wpdb->get_results('SHOW FULL TABLES FROM `' . DB_NAME . '`', ARRAY_N);
echo '<fieldset id="dbtables"><div style="width: 30%; float:left; min-width: 250px; margin-right: 10px;">';
$next_row = ceil(count($tables) / 3);
$counter = 0;
foreach ($tables as $table) {
$tabletype = '';
if ($table[1] != 'BASE TABLE') {
$tabletype = ' <i>(' . strtolower($table[1]) . ')</i>';
}
echo '<label for="idtabledb-' . rawurlencode($table[0]) . '""><input class="checkbox" type="checkbox"' . checked(!in_array($table[0], BackWPup_Option::get($jobid, 'dbdumpexclude')), TRUE, FALSE) . ' name="tabledb[]" id="idtabledb-' . rawurlencode($table[0]) . '" value="' . rawurlencode($table[0]) . '"/> ' . $table[0] . $tabletype . '</label><br />';
$counter++;
if ($next_row <= $counter) {
echo '</div><div style="width: 30%; float:left; min-width: 250px; margin-right: 10px;">';
$counter = 0;
}
}
echo '</div></fieldset>';
?>
</td>
</tr>
<tr>
<th scope="row"><label for="iddbdumpfile"><?php
_e('Backup file name', 'backwpup');
?>
</label></th>
<td>
<input id="iddbdumpfile" name="dbdumpfile" type="text"
value="<?php
echo BackWPup_Option::get($jobid, 'dbdumpfile');
?>
"
class="medium-text code"/>.sql
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Backup file compression', 'backwpup');
?>
</th>
<td>
<fieldset>
//.........这里部分代码省略.........