本文整理汇总了PHP中BackWPup_Admin类的典型用法代码示例。如果您正苦于以下问题:PHP BackWPup_Admin类的具体用法?PHP BackWPup_Admin怎么用?PHP BackWPup_Admin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BackWPup_Admin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Set needed filters and actions and load
*/
private function __construct()
{
// Nothing else matters if we're not on the main site
if (!is_main_site()) {
return;
}
//auto loader
spl_autoload_register(array($this, 'autoloader'));
//start upgrade if needed
if (get_site_option('backwpup_version') != self::get_plugin_data('Version')) {
BackWPup_Install::activate();
}
//load pro features
if (class_exists('BackWPup_Pro')) {
BackWPup_Pro::get_instance();
}
//WP-Cron
if (defined('DOING_CRON') && DOING_CRON) {
if (!empty($_GET['backwpup_run']) && class_exists('BackWPup_Job')) {
//early disable caches
BackWPup_Job::disable_caches();
//add action for running jobs in wp-cron.php
add_action('wp_loaded', array('BackWPup_Cron', 'cron_active'), PHP_INT_MAX);
} else {
//add cron actions
add_action('backwpup_cron', array('BackWPup_Cron', 'run'));
add_action('backwpup_check_cleanup', array('BackWPup_Cron', 'check_cleanup'));
}
//if in cron the rest is not needed
return;
}
//deactivation hook
register_deactivation_hook(__FILE__, array('BackWPup_Install', 'deactivate'));
//Admin bar
if (get_site_option('backwpup_cfg_showadminbar', FALSE)) {
add_action('init', array('BackWPup_Adminbar', 'get_instance'));
}
//only in backend
if (is_admin() && class_exists('BackWPup_Admin')) {
BackWPup_Admin::get_instance();
}
//work with wp-cli
if (defined('WP_CLI') && WP_CLI && method_exists('WP_CLI', 'add_command')) {
WP_CLI::add_command('backwpup', 'BackWPup_WP_CLI');
}
}
示例2: 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);
}
示例3: query_api
private static function query_api($endpoint, array $params)
{
$message = array('status' => 'error', 'error' => array('code' => 0, 'message' => 'Please setup EasyCron auth api key in settings'));
$params['token'] = get_site_option('backwpup_cfg_easycronapikey');
if (empty($params['token'])) {
return $message;
}
$result = wp_remote_get('https://www.easycron.com/rest/' . $endpoint . '?' . http_build_query($params));
if (wp_remote_retrieve_response_code($result) != 200) {
$message['error']['code'] = wp_remote_retrieve_response_code($result);
$message['error']['message'] = wp_remote_retrieve_response_message($result);
} else {
$json = wp_remote_retrieve_body($result);
$message = json_decode($json, TRUE);
}
if ($message['status'] != 'success') {
BackWPup_Admin::message(sprintf(__('EasyCron.com API returns (%s): %s', 'backwpup'), esc_attr($message['error']['code']), esc_attr($message['error']['message'])), TRUE);
}
return $message;
}
示例4: page
/**
* Display the page content
*/
public static function page()
{
?>
<div class="wrap" id="backwpup-page">
<h1><?php
echo esc_html(sprintf(__('%s › Manage Backup Archives', 'backwpup'), BackWPup::get_plugin_data('name')));
?>
</h1>
<?php
BackWPup_Admin::display_messages();
?>
<form id="posts-filter" action="" method="get">
<input type="hidden" name="page" value="backwpupbackups" />
<?php
self::$listtable->display();
?>
<div id="ajax-response"></div>
</form>
</div>
<?php
}
示例5: file_delete
/**
* @param $jobdest
* @param $backupfile
*/
public function file_delete($jobdest, $backupfile)
{
$files = get_site_transient('backwpup_' . strtolower($jobdest), array());
list($jobid, $dest) = explode('_', $jobdest);
if (BackWPup_Option::get($jobid, 's3accesskey') && BackWPup_Option::get($jobid, 's3secretkey') && BackWPup_Option::get($jobid, 's3bucket')) {
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();
}
$s3->delete_object(BackWPup_Option::get($jobid, 's3bucket'), $backupfile);
//update file list
foreach ($files as $key => $file) {
if (is_array($file) && $file['file'] == $backupfile) {
unset($files[$key]);
}
}
unset($s3);
} catch (Exception $e) {
BackWPup_Admin::message(sprintf(__('S3 Service API: %s', 'backwpup'), $e->getMessage()), TRUE);
}
}
set_site_transient('backwpup_' . strtolower($jobdest), $files, 60 * 60 * 24 * 7);
}
示例6: page
/**
*
*/
public static function page()
{
if (!empty($_GET['jobid'])) {
$jobid = (int) $_GET['jobid'];
} else {
//generate jobid if not exists
$newjobid = BackWPup_Option::get_job_ids();
sort($newjobid);
$jobid = end($newjobid) + 1;
}
$destinations = BackWPup::get_registered_destinations();
$job_types = BackWPup::get_job_types();
?>
<div class="wrap" id="backwpup-page">
<?php
echo '<h2><span id="backwpup-page-icon"> </span>' . sprintf(__('%1$s Job: %2$s', 'backwpup'), BackWPup::get_plugin_data('name'), '<span id="h2jobtitle">' . esc_html(BackWPup_Option::get($jobid, 'name')) . '</span>') . '</h2>';
//default tabs
$tabs = array('job' => array('name' => __('General', 'backwpup'), 'display' => TRUE), 'cron' => array('name' => __('Schedule', 'backwpup'), 'display' => TRUE));
//add jobtypes to tabs
$job_job_types = BackWPup_Option::get($jobid, 'type');
foreach ($job_types as $typeid => $typeclass) {
$tabid = 'jobtype-' . strtolower($typeid);
$tabs[$tabid]['name'] = $typeclass->info['name'];
$tabs[$tabid]['display'] = TRUE;
if (!in_array($typeid, $job_job_types)) {
$tabs[$tabid]['display'] = FALSE;
}
}
//add destinations to tabs
$jobdests = BackWPup_Option::get($jobid, 'destinations');
foreach ($destinations as $destid => $dest) {
$tabid = 'dest-' . strtolower($destid);
$tabs[$tabid]['name'] = sprintf(__('To: %s', 'backwpup'), $dest['info']['name']);
$tabs[$tabid]['display'] = TRUE;
if (!in_array($destid, $jobdests)) {
$tabs[$tabid]['display'] = FALSE;
}
}
//display tabs
echo '<h2 class="nav-tab-wrapper">';
foreach ($tabs as $id => $tab) {
$addclass = '';
if ($id == $_GET['tab']) {
$addclass = ' nav-tab-active';
}
$display = '';
if (!$tab['display']) {
$display = ' style="display:none;"';
}
echo '<a href="' . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&tab=' . $id . '&jobid=' . $jobid, 'edit-job') . '" class="nav-tab' . $addclass . '" id="tab-' . $id . '" data-nexttab="' . $id . '" ' . $display . '>' . $tab['name'] . '</a>';
}
echo '</h2>';
//display messages
BackWPup_Admin::display_messages();
echo '<form name="editjob" id="editjob" method="post" action="' . admin_url('admin-post.php') . '">';
echo '<input type="hidden" id="jobid" name="jobid" value="' . $jobid . '" />';
echo '<input type="hidden" name="tab" value="' . $_GET['tab'] . '" />';
echo '<input type="hidden" name="nexttab" value="' . $_GET['tab'] . '" />';
echo '<input type="hidden" name="page" value="backwpupeditjob" />';
echo '<input type="hidden" name="action" value="backwpup" />';
echo '<input type="hidden" name="anchor" value="" />';
wp_nonce_field('backwpupeditjob_page');
wp_nonce_field('backwpup_ajax_nonce', 'backwpupajaxnonce', FALSE);
switch ($_GET['tab']) {
case 'job':
echo '<div class="table" id="info-tab-job">';
?>
<h3 class="title"><?php
_e('Job Name', 'backwpup');
?>
</h3>
<p></p>
<table class="form-table">
<tr>
<th scope="row"><label for="name"><?php
_e('Please name this job.', 'backwpup');
?>
</label></th>
<td>
<input name="name" type="text" id="name" data-empty="<?php
_e('New Job', 'backwpup');
?>
"
value="<?php
echo BackWPup_Option::get($jobid, 'name');
?>
" class="regular-text" />
</td>
</tr>
</table>
<h3 class="title"><?php
_e('Job Tasks', 'backwpup');
?>
</h3>
<p></p>
<table class="form-table">
//.........这里部分代码省略.........
示例7: page
/**
* Print the markup.
*
* @return void
*/
public static function page()
{
// get wizards
$wizards = BackWPup::get_wizards();
?>
<div class="wrap" id="backwpup-page">
<h2><span id="backwpup-page-icon"> </span><?php
echo sprintf(__('%s Dashboard', 'backwpup'), BackWPup::get_plugin_data('name'));
?>
</h2>
<?php
BackWPup_Admin::display_messages();
if (class_exists('BackWPup_Pro', FALSE)) {
?>
<div class="backwpup-welcome backwpup-max-width">
<h3><?php
_ex('Planning backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('BackWPup’s job wizards make planning and scheduling your backup jobs a breeze.', 'backwpup');
echo ' ';
_e('Use your backup archives to save your entire WordPress installation including <code>/wp-content/</code>. Push them to an external storage service if you don’t want to save the backups on the same server.', 'backwpup');
?>
</p>
<h3><?php
_ex('Restoring backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('With a single backup archive you are able to restore an installation. Use a tool like phpMyAdmin or a plugin like <a href="http://wordpress.org/plugins/adminer/" target="_blank">Adminer</a> to restore your database backup files.', 'backwpup');
?>
</p>
<h3><?php
_ex('Ready to set up a backup job?', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
printf(__('Use one of the wizards to plan a backup, or use <a href="%s">expert mode</a> for full control over all options.', 'backwpup'), network_admin_url('admin.php') . '?page=backwpupeditjob');
echo ' ';
_e('<strong>Please note: You are solely responsible for the security of your data; the authors of this plugin are not.</strong>', 'backwpup');
?>
</p>
</div>
<?php
} else {
?>
<div class="backwpup-welcome backwpup-max-width">
<h3><?php
_ex('Planning backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('Use the short links in the <strong>First steps</strong> box to plan and schedule backup jobs.', 'backwpup');
echo ' ';
_e('Use your backup archives to save your entire WordPress installation including <code>/wp-content/</code>. Push them to an external storage service if you don’t want to save the backups on the same server.', 'backwpup');
?>
</p>
<h3><?php
_ex('Restoring backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('With a single backup archive you are able to restore an installation. Use a tool like phpMyAdmin or a plugin like <a href="http://wordpress.org/plugins/adminer/" target="_blank">Adminer</a> to restore your database backup files.', 'backwpup');
?>
</p>
<h3><?php
_ex('Ready to set up a backup job?', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
printf(__('<a href="%s">Add a new backup job</a> and plan what you want to save.', 'backwpup'), network_admin_url('admin.php') . '?page=backwpupeditjob');
?>
<br /><?php
_e('<strong>Please note: You are solely responsible for the security of your data; the authors of this plugin are not.</strong>', 'backwpup');
?>
</p>
</div>
<?php
}
if (current_user_can('backwpup_jobs_edit') && current_user_can('backwpup_logs') && current_user_can('backwpup_jobs_start')) {
?>
<div id="backwpup-first-steps" class="metabox-holder postbox backwpup-floated-postbox">
<h3 class="hndle"><span><?php
_e('First Steps', 'backwpup');
?>
</span></h3>
<div class="inside">
<ul>
<?php
if (class_exists('BackWPup_Pro', FALSE)) {
?>
<li type="1"><a href="<?php
echo wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupwizard&wizard_start=SYSTEMTEST', 'wizard');
?>
//.........这里部分代码省略.........
示例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, 's3accesskey') && BackWPup_Option::get($jobid, 's3secretkey') && BackWPup_Option::get($jobid, 's3bucket')) {
try {
$s3 = Aws\S3\S3Client::factory(array('key' => BackWPup_Option::get($jobid, 's3accesskey'), 'secret' => BackWPup_Encryption::decrypt(BackWPup_Option::get($jobid, 's3secretkey')), 'region' => BackWPup_Option::get($jobid, 's3region'), 'base_url' => $this->get_s3_base_url(BackWPup_Option::get($jobid, 's3region'), BackWPup_Option::get($jobid, 's3base_url')), 'scheme' => 'https', 'ssl.certificate_authority' => BackWPup::get_plugin_data('cacert')));
$s3->deleteObject(array('Bucket' => BackWPup_Option::get($jobid, 's3bucket'), 'Key' => $backupfile));
//update file list
foreach ((array) $files as $key => $file) {
if (is_array($file) && $file['file'] == $backupfile) {
unset($files[$key]);
}
}
unset($s3);
} catch (Exception $e) {
BackWPup_Admin::message(sprintf(__('S3 Service API: %s', 'backwpup'), $e->getMessage()), TRUE);
}
}
set_site_transient('backwpup_' . strtolower($jobdest), $files, YEAR_IN_SECONDS);
}
示例9: __construct
/**
* Set needed filters and actions and load
*/
private function __construct()
{
// Nothing else matters if we're not on the main site
if (!is_main_site()) {
return;
}
//auto loader
spl_autoload_register(array($this, 'autoloader'));
//start upgrade if needed
if (get_site_option('backwpup_version') != self::get_plugin_data('Version')) {
BackWPup_Install::activate();
}
//load pro features
if (class_exists('BackWPup_Pro')) {
BackWPup_Pro::get_instance();
}
//WP-Cron
if (defined('DOING_CRON') && DOING_CRON) {
//early disable caches
if (!empty($_GET['backwpup_run']) && class_exists('BackWPup_Job')) {
BackWPup_Job::disable_caches();
}
// add normal cron actions
add_action('backwpup_cron', array('BackWPup_Cron', 'run'));
add_action('backwpup_check_cleanup', array('BackWPup_Cron', 'check_cleanup'));
// add action for doing thinks if cron active
// must done in int before wp-cron control
add_action('init', array('BackWPup_Cron', 'cron_active'), 1);
// if in cron the rest must not needed
return;
}
//deactivation hook
register_deactivation_hook(__FILE__, array('BackWPup_Install', 'deactivate'));
//Things that must do in plugin init
add_action('init', array($this, 'plugin_init'));
//only in backend
if (is_admin() && class_exists('BackWPup_Admin')) {
BackWPup_Admin::get_instance();
}
//work with wp-cli
if (defined('WP_CLI') && WP_CLI && method_exists('WP_CLI', 'add_command')) {
WP_CLI::add_command('backwpup', 'BackWPup_WP_CLI');
}
}
示例10: page
/**
* Print the markup.
*
* @return void
*/
public static function page()
{
// get wizards
$wizards = BackWPup::get_wizards();
?>
<div class="wrap" id="backwpup-page">
<h2><span id="backwpup-page-icon"> </span><?php
echo sprintf(__('%s Dashboard', 'backwpup'), BackWPup::get_plugin_data('name'));
?>
</h2>
<?php
BackWPup_Admin::display_messages();
if (class_exists('BackWPup_Pro', FALSE)) {
?>
<div class="backwpup-welcome backwpup-max-width">
<h3><?php
_ex('Planning backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('BackWPup’s job wizards make planning and scheduling your backup jobs a breeze.', 'backwpup');
echo ' ';
_e('Use your backup archives to save your entire WordPress installation including <code>/wp-content/</code>. Push them to an external storage service if you don’t want to save the backups on the same server.', 'backwpup');
?>
</p>
<h3><?php
_ex('Restoring backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('With a single backup archive you are able to restore an installation. Use a tool like phpMyAdmin or a plugin like <a href="http://wordpress.org/plugins/adminer/" target="_blank">Adminer</a> to restore your database backup files.', 'backwpup');
?>
</p>
<h3><?php
_ex('Ready to set up a backup job?', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
printf(__('Use one of the wizards to plan a backup, or use <a href="%s">expert mode</a> for full control over all options.', 'backwpup'), network_admin_url('admin.php') . '?page=backwpupeditjob');
echo ' ';
_e('<strong>Please note: You are solely responsible for the security of your data; the authors of this plugin are not.</strong>', 'backwpup');
?>
</p>
</div>
<?php
} else {
?>
<div class="backwpup-welcome backwpup-max-width">
<h3><?php
_ex('Planning backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('Use the short links in the <strong>First steps</strong> box to plan and schedule backup jobs.', 'backwpup');
echo ' ';
_e('Use your backup archives to save your entire WordPress installation including <code>/wp-content/</code>. Push them to an external storage service if you don’t want to save the backups on the same server.', 'backwpup');
?>
</p>
<h3><?php
_ex('Restoring backups', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
_e('With a single backup archive you are able to restore an installation. Use a tool like phpMyAdmin or a plugin like <a href="http://wordpress.org/plugins/adminer/" target="_blank">Adminer</a> to restore your database backup files.', 'backwpup');
?>
</p>
<h3><?php
_ex('Ready to set up a backup job?', 'Dashboard heading', 'backwpup');
?>
</h3>
<p><?php
printf(__('<a href="%s">Add a new backup job</a> and plan what you want to save.', 'backwpup'), network_admin_url('admin.php') . '?page=backwpupeditjob');
?>
<br /><?php
_e('<strong>Please note: You are solely responsible for the security of your data; the authors of this plugin are not.</strong>', 'backwpup');
?>
</p>
</div>
<?php
}
if (current_user_can('backwpup_jobs_edit') && current_user_can('backwpup_logs') && current_user_can('backwpup_jobs_start')) {
?>
<div id="backwpup-first-steps" class="metabox-holder postbox backwpup-floated-postbox">
<h3 class="hndle"><span><?php
_e('First Steps', 'backwpup');
?>
</span></h3>
<div class="inside">
<ul>
<?php
if (class_exists('BackWPup_Pro', FALSE)) {
?>
<li type="1"><a href="<?php
echo wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupwizard&wizard_start=SYSTEMTEST', 'wizard');
?>
//.........这里部分代码省略.........
示例11: page
/**
* Print the markup.
*
* @return void
*/
public static function page()
{
?>
<div class="wrap" id="backwpup-page">
<div class="inpsyde">
<a href="http://inpsyde.com/" title="Inpsyde GmbH">Inpsyde</a>
</div>
<h2><span id="backwpup-page-icon"> </span><?php
echo sprintf(__('%s Welcome', 'backwpup'), BackWPup::get_plugin_data('name'));
?>
</h2>
<?php
BackWPup_Admin::display_messages();
?>
<div class="welcome">
<div class="welcome_inner">
<div class="top">
<?php
if (get_site_transient('backwpup_upgrade_from_version_two')) {
?>
<div id="update-notice" class="backwpup-welcome updated">
<h3><?php
_e('Heads up! You have updated from version 2.x', 'backwpup');
?>
</h3>
<p><?php
echo str_replace('\\"', '"', sprintf(__('Please <a href="%s">check your settings</a> after updating from version 2.x:', 'backwpup'), network_admin_url('admin.php') . '?page=backwpupjobs'));
?>
</a></p>
<ul><li><?php
_e('Dropbox authentication must be re-entered', 'backwpup');
?>
</li>
<li><?php
_e('SugarSync authentication must be re-entered', 'backwpup');
?>
</li>
<li><?php
_e('S3 Settings', 'backwpup');
?>
</li>
<li><?php
_e('Google Storage is now a part of S3 service settings', 'backwpup');
?>
</li>
<li><?php
_e('All your passwords', 'backwpup');
?>
</li>
</ul>
</div>
<?php
}
?>
</div>
<?php
if (class_exists('BackWPup_Pro', FALSE)) {
?>
<div class="welcometxt">
<div class="backwpup-welcome">
<img class="backwpup-banner-img" src="<?php
echo BackWPup::get_plugin_data('URL');
?>
/assets/images/backwpupbanner-pro.png" />
<h3><?php
_e('Welcome to BackWPup Pro', 'backwpup');
?>
</h3>
//.........这里部分代码省略.........
示例12: page
/**
* Page Output
*/
public static function page()
{
global $wpdb;
?>
<div class="wrap" id="backwpup-page">
<h1><?php
echo sprintf(__('%s › Settings', 'backwpup'), BackWPup::get_plugin_data('name'));
?>
</h1>
<?php
$tabs = array('general' => __('General', 'backwpup'), 'job' => __('Jobs', 'backwpup'), 'log' => __('Logs', 'backwpup'), 'net' => __('Network', 'backwpup'), 'apikey' => __('API Keys', 'backwpup'), 'information' => __('Information', 'backwpup'));
$tabs = apply_filters('backwpup_page_settings_tab', $tabs);
echo '<h2 class="nav-tab-wrapper">';
foreach ($tabs as $id => $name) {
echo '<a href="#backwpup-tab-' . esc_attr($id) . '" class="nav-tab">' . esc_attr($name) . '</a>';
}
echo '</h2>';
BackWPup_Admin::display_messages();
?>
<form id="settingsform" action="<?php
echo admin_url('admin-post.php');
?>
" method="post">
<?php
wp_nonce_field('backwpupsettings_page');
?>
<input type="hidden" name="page" value="backwpupsettings" />
<input type="hidden" name="action" value="backwpup" />
<input type="hidden" name="anchor" value="#backwpup-tab-general" />
<div class="table ui-tabs-hide" id="backwpup-tab-general">
<h3 class="title"><?php
_e('Display Settings', 'backwpup');
?>
</h3>
<p><?php
_e('Do you want to see BackWPup in the WordPress admin bar?', 'backwpup');
?>
</p>
<table class="form-table">
<tr>
<th scope="row"><?php
_e('Admin bar', 'backwpup');
?>
</th>
<td>
<fieldset>
<legend class="screen-reader-text"><span><?php
_e('Admin Bar', 'backwpup');
?>
</span></legend>
<label for="showadminbarmenu">
<input name="showadminbarmenu" type="checkbox" id="showadminbarmenu" value="1" <?php
checked(get_site_option('backwpup_cfg_showadminbar'), TRUE);
?>
/>
<?php
_e('Show BackWPup links in admin bar.', 'backwpup');
?>
</label>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Folder sizes', 'backwpup');
?>
</th>
<td>
<fieldset>
<legend class="screen-reader-text"><span><?php
_e('Folder sizes', 'backwpup');
?>
</span></legend>
<label for="showfoldersize">
<input name="showfoldersize" type="checkbox" id="showfoldersize" value="1" <?php
checked(get_site_option('backwpup_cfg_showfoldersize'), TRUE);
?>
/>
<?php
_e('Display folder sizes in the files tab when editing a job. (Might increase loading time of files tab.)', 'backwpup');
?>
</label>
</fieldset>
</td>
</tr>
</table>
<h3 class="title"><?php
_e('Security', 'backwpup');
?>
</h3>
<p><?php
_e('Security option for BackWPup', 'backwpup');
?>
</p>
//.........这里部分代码省略.........
示例13: check_folder
/**
*
* Check is folder readable and exists create it if not
* add .htaccess or index.html file in folder to prevent directory listing
*
* @param string $folder the folder to check
* @param bool $donotbackup Create a file that the folder will not backuped
* @return bool ok or not
*/
public static function check_folder($folder, $donotbackup = FALSE)
{
$folder = untrailingslashit(str_replace('\\', '/', $folder));
if (empty($folder)) {
return FALSE;
}
//check that is not home of WP
if ($folder == untrailingslashit(str_replace('\\', '/', ABSPATH)) || $folder == untrailingslashit(str_replace('\\', '/', WP_PLUGIN_DIR)) || $folder == untrailingslashit(str_replace('\\', '/', WP_CONTENT_DIR))) {
BackWPup_Admin::message(sprintf(__('Folder %1$s not allowed, please use another folder.', 'backwpup'), $folder), TRUE);
return FALSE;
}
//create folder if it not exists
if (!is_dir($folder)) {
if (!wp_mkdir_p($folder)) {
BackWPup_Admin::message(sprintf(__('Cannot create folder: %1$s', 'backwpup'), $folder), TRUE);
return FALSE;
}
}
//check is writable dir
if (!is_writable($folder)) {
BackWPup_Admin::message(sprintf(__('Folder "%1$s" is not writable', 'backwpup'), $folder), TRUE);
return FALSE;
}
//create .htaccess for apache and index.php for folder security
if (get_site_option('backwpup_cfg_protectfolders') && !file_exists($folder . '/.htaccess')) {
file_put_contents($folder . '/.htaccess', "<Files \"*\">" . PHP_EOL . "<IfModule mod_access.c>" . PHP_EOL . "Deny from all" . PHP_EOL . "</IfModule>" . PHP_EOL . "<IfModule !mod_access_compat>" . PHP_EOL . "<IfModule mod_authz_host.c>" . PHP_EOL . "Deny from all" . PHP_EOL . "</IfModule>" . PHP_EOL . "</IfModule>" . PHP_EOL . "<IfModule mod_access_compat>" . PHP_EOL . "Deny from all" . PHP_EOL . "</IfModule>" . PHP_EOL . "</Files>");
}
if (get_site_option('backwpup_cfg_protectfolders') && !file_exists($folder . '/index.php')) {
file_put_contents($folder . '/index.php', "<?php" . PHP_EOL . "header( \$_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found' );" . PHP_EOL . "header( 'Status: 404 Not Found' );" . PHP_EOL);
}
//Create do not backup file for this folder
if ($donotbackup && !file_exists($folder . '/.donotbackup')) {
file_put_contents($folder . '/.donotbackup', __('BackWPup will not backup folders and subfolders when this file is inside.', 'backwpup'));
}
return TRUE;
}
示例14: page
/**
* Display the page content
*/
public static function page()
{
?>
<div class="wrap" id="backwpup-page">
<h2><span id="backwpup-page-icon"> </span><?php
echo esc_html(sprintf(__('%s Logs', 'backwpup'), BackWPup::get_plugin_data('name')));
?>
</h2>
<?php
BackWPup_Admin::display_messages();
?>
<form id="posts-filter" action="" method="get">
<input type="hidden" name="page" value="backwpuplogs" />
<?php
self::$listtable->display();
?>
<div id="ajax-response"></div>
</form>
</div>
<?php
}
示例15: page
/**
* Page Output
*/
public static function page()
{
global $wpdb;
?>
<div class="wrap" id="backwpup-page">
<h2><span id="backwpup-page-icon"> </span><?php
echo sprintf(__('%s Settings', 'backwpup'), BackWPup::get_plugin_data('name'));
?>
</h2>
<?php
$tabs = array('general' => __('General', 'backwpup'), 'job' => __('Jobs', 'backwpup'), 'log' => __('Logs', 'backwpup'), 'net' => __('Network', 'backwpup'), 'apikey' => __('API Keys', 'backwpup'), 'information' => __('Information', 'backwpup'));
$tabs = apply_filters('backwpup_page_settings_tab', $tabs);
echo '<h2 class="nav-tab-wrapper">';
foreach ($tabs as $id => $name) {
echo '<a href="#backwpup-tab-' . $id . '" class="nav-tab">' . $name . '</a>';
}
echo '</h2>';
BackWPup_Admin::display_messages();
?>
<form id="settingsform" action="<?php
echo admin_url('admin-post.php?action=backwpup');
?>
" method="post">
<?php
wp_nonce_field('backwpupsettings_page');
?>
<input type="hidden" name="page" value="backwpupsettings" />
<input type="hidden" name="anchor" value="#backwpup-tab-general" />
<div class="table ui-tabs-hide" id="backwpup-tab-general">
<h3 class="title"><?php
_e('Display Settings', 'backwpup');
?>
</h3>
<p><?php
_e('Do you want to see BackWPup in the WordPress admin bar?', 'backwpup');
?>
</p>
<table class="form-table">
<tr>
<th scope="row"><?php
_e('Admin bar', 'backwpup');
?>
</th>
<td>
<fieldset>
<legend class="screen-reader-text"><span><?php
_e('Admin Bar', 'backwpup');
?>
</span>
</legend>
<label for="showadminbar">
<input name="showadminbar" type="checkbox" id="showadminbar"
value="1" <?php
checked(get_site_option('backwpup_cfg_showadminbar'), TRUE);
?>
/>
<?php
_e('Show BackWPup links in admin bar.', 'backwpup');
?>
</label>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Folder sizes', 'backwpup');
?>
</th>
<td>
<fieldset>
<legend class="screen-reader-text"><span><?php
_e('Folder sizes', 'backwpup');
?>
</span>
</legend>
<label for="showfoldersize">
<input name="showfoldersize" type="checkbox" id="showfoldersize"
value="1" <?php
checked(get_site_option('backwpup_cfg_showfoldersize'), TRUE);
?>
/>
<?php
_e('Display folder sizes in the files tab when editing a job. (Might increase loading time of files tab.)', 'backwpup');
?>
</label>
</fieldset>
</td>
</tr>
</table>
<h3 class="title"><?php
_e('Security', 'backwpup');
?>
</h3>
<p><?php
//.........这里部分代码省略.........