本文整理汇总了PHP中BackWPup_Job::get_jobrun_url方法的典型用法代码示例。如果您正苦于以下问题:PHP BackWPup_Job::get_jobrun_url方法的具体用法?PHP BackWPup_Job::get_jobrun_url怎么用?PHP BackWPup_Job::get_jobrun_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackWPup_Job
的用法示例。
在下文中一共展示了BackWPup_Job::get_jobrun_url方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public static function update($backwpup_jobid)
{
$params = array('id' => NULL, 'email_me' => 0, 'log_output_length' => 0, 'testfirst' => 0);
if (empty($backwpup_jobid)) {
$params['id'] = get_site_option('backwpup_cfg_easycronjobid');
$params['cron_job_name'] = sprintf('WordPress on %s', home_url());
$params['cron_expression'] = '*/5 * * * *';
$url = BackWPup_Job::get_jobrun_url('runext', 0);
$url = remove_query_arg('_nonce', $url['url']);
$url = remove_query_arg('doing_wp_cron', $url);
$url = remove_query_arg('backwpup_run', $url);
$url = add_query_arg(array('doing_wp_cron' => ''), $url);
$cookies = get_site_transient('backwpup_cookies');
$params['url'] = $url;
if (!empty($cookies)) {
$params['cookies'] = http_build_query($cookies);
}
} else {
$params['id'] = BackWPup_Option::get($backwpup_jobid, 'easycronjobid');
if (empty($params['id'])) {
$params['id'] = NULL;
}
$params['cron_job_name'] = sprintf('BackWPup %s on %s', BackWPup_Option::get($backwpup_jobid, 'name'), home_url());
$params['cron_expression'] = BackWPup_Option::get($backwpup_jobid, 'cron');
$url = BackWPup_Job::get_jobrun_url('runext', $backwpup_jobid);
$cookies = get_site_transient('backwpup_cookies');
$params['url'] = $url['url'];
if (!empty($cookies)) {
$params['cookies'] = http_build_query($cookies);
}
}
if (empty($params['id'])) {
$message = self::query_api('add', $params);
} else {
$message = self::query_api('edit', $params);
}
delete_site_transient('backwpup_easycron_' . $params['id']);
if ($message['status'] == 'success' && !empty($message['cron_job_id'])) {
if (empty($backwpup_jobid)) {
update_site_option('backwpup_cfg_easycronjobid', $message['cron_job_id']);
} else {
BackWPup_Option::update($backwpup_jobid, 'easycronjobid', $message['cron_job_id']);
}
return TRUE;
} else {
if ($message['error']['code'] == 25) {
if (empty($backwpup_jobid)) {
delete_site_option('backwpup_cfg_easycronjobid');
} else {
BackWPup_Option::delete($backwpup_jobid, 'easycronjobid');
}
}
}
return FALSE;
}
示例2: 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']));
}
}
}
示例3: page
//.........这里部分代码省略.........
?>
name="activetype" id="idactivetype-wpcron"
value="wpcron" /> <?php
_e('with WordPress cron', 'backwpup');
?>
</label><br/>
<?php
$disabled = '';
$easycron_api = get_site_option('backwpup_cfg_easycronapikey');
if (empty($easycron_api)) {
$disabled = ' disabled="disabled"';
}
?>
<label for="idactivetype-easycron"><input class="radio help-tip"
type="radio"<?php
checked('easycron', BackWPup_Option::get($jobid, 'activetype'), TRUE);
?>
name="activetype" id="idactivetype-easycron"<?php
echo $disabled;
?>
value="easycron" title="<?php
_e('Use EasyCron.com Cron jobs.');
?>
" /> <?php
_e('with <a href="https://www.easycron.com?ref=36673" class="help-tip" title="Affiliate Link!">EasyCron.com</a>', 'backwpup');
?>
<?php
if (empty($easycron_api)) {
echo ' <strong>' . sprintf(__('Setup <a href="https://www.easycron.com?ref=36673" class="help-tip" title="Affiliate Link!">Account</a> / <a href="%s">API Key</a> first.', 'backwpup'), network_admin_url('admin.php') . '?page=backwpupsettings#backwpup-tab-apikey') . '</strong>';
}
?>
</label><br/>
<?php
$url = BackWPup_Job::get_jobrun_url('runext', BackWPup_Option::get($jobid, 'jobid'));
?>
<label for="idactivetype-link"><input class="radio help-tip"
type="radio"<?php
checked('link', BackWPup_Option::get($jobid, 'activetype'), TRUE);
?>
name="activetype" id="idactivetype-link"
value="link" title="<?php
esc_attr_e('Copy the link for an external start. This option has to be activated to make the link work.', 'backwpup');
?>
" /> <?php
_e('with a link', 'backwpup');
?>
<code><a href="<?php
echo $url['url'];
?>
" target="_blank"><?php
echo $url['url'];
?>
</a></code></label>
<br />
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Start job with CLI', 'backwpup');
?>
</th>
<td class="help-tip" title="<?php
esc_attr_e('Use WP-CLI commands to let the job start with the server’s cron on command line interface.', 'backwpup');
?>
">
示例4: ajax_working
/**
*
* Function to generate json data
*
*/
public static function ajax_working()
{
check_ajax_referer('backwpupworking_ajax_nonce');
if (!current_user_can('backwpup_jobs_start')) {
die('-1');
}
$log_folder = get_site_option('backwpup_cfg_logfolder');
$log_folder = BackWPup_File::get_absolute_path($log_folder);
$logfile = isset($_GET['logfile']) ? $log_folder . basename(trim($_GET['logfile'])) : NULL;
$logpos = isset($_GET['logpos']) ? absint($_GET['logpos']) : 0;
$restart_url = '';
//check if logfile renamed
if (file_exists($logfile . '.gz')) {
$logfile .= '.gz';
}
if (!is_readable($logfile) || strstr($_GET['logfile'], 'backwpup_log_') === false) {
die('0');
}
$job_object = BackWPup_Job::get_working_data();
$done = 0;
if (is_object($job_object)) {
$warnings = $job_object->warnings;
$errors = $job_object->errors;
$step_percent = $job_object->step_percent;
$substep_percent = $job_object->substep_percent;
$runtime = current_time('timestamp') - $job_object->start_time;
$onstep = $job_object->steps_data[$job_object->step_working]['NAME'];
$lastmsg = $job_object->lastmsg;
$lasterrormsg = $job_object->lasterrormsg;
} else {
$logheader = BackWPup_Job::read_logheader($logfile);
$warnings = $logheader['warnings'];
$runtime = $logheader['runtime'];
$errors = $logheader['errors'];
$step_percent = 100;
$substep_percent = 100;
$onstep = '<div class="backwpup-message backwpup-info"><p>' . esc_html__('Job completed', 'backwpup') . '</p></div>';
if ($errors > 0) {
$lastmsg = '<div class="error"><p>' . esc_html__('ERROR:', 'backwpup') . ' ' . sprintf(esc_html__('Job has ended with errors in %s seconds. You must resolve the errors for correct execution.', 'backwpup'), $logheader['runtime']) . '</p></div>';
} elseif ($warnings > 0) {
$lastmsg = '<div class="backwpup-message backwpup-warning"><p>' . esc_html__('WARNING:', 'backwpup') . ' ' . sprintf(esc_html__('Job has done with warnings in %s seconds. Please resolve them for correct execution.', 'backwpup'), $logheader['runtime']) . '</p></div>';
} else {
$lastmsg = '<div class="updated"><p>' . sprintf(esc_html__('Job done in %s seconds.', 'backwpup'), $logheader['runtime']) . '</p></div>';
}
$lasterrormsg = '';
$done = 1;
}
if ('.gz' == substr($logfile, -3)) {
$logfiledata = file_get_contents('compress.zlib://' . $logfile, FALSE, NULL, $logpos);
} else {
$logfiledata = file_get_contents($logfile, FALSE, NULL, $logpos);
}
preg_match('/<body[^>]*>/si', $logfiledata, $match);
if (!empty($match[0])) {
$startpos = strpos($logfiledata, $match[0]) + strlen($match[0]);
} else {
$startpos = 0;
}
$endpos = stripos($logfiledata, '</body>');
if (FALSE === $endpos) {
$endpos = strlen($logfiledata);
}
$length = strlen($logfiledata) - (strlen($logfiledata) - $endpos) - $startpos;
//check if restart must done on ALTERNATE_WP_CRON
if (is_object($job_object) && defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
$restart = BackWPup_Job::get_jobrun_url('restartalt');
if ($job_object->pid === 0 && $job_object->uniqid === '') {
$restart_url = $restart['url'];
}
$last_update = microtime(TRUE) - $job_object->timestamp_last_update;
if (empty($job_object->pid) && $last_update > 10) {
$restart_url = $restart['url'];
}
}
wp_send_json(array('log_pos' => strlen($logfiledata) + $logpos, 'log_text' => substr($logfiledata, $startpos, $length), 'warning_count' => $warnings, 'error_count' => $errors, 'running_time' => $runtime, 'step_percent' => $step_percent, 'on_step' => $onstep, 'last_msg' => $lastmsg, 'last_error_msg' => $lasterrormsg, 'sub_step_percent' => $substep_percent, 'restart_url' => $restart_url, 'job_done' => $done));
}
示例5: page
//.........这里部分代码省略.........
<div class="table ui-tabs-hide" id="backwpup-tab-apikey">
<?php
do_action('backwpup_page_settings_tab_apikey');
?>
</div>
<div class="table ui-tabs-hide" id="backwpup-tab-information">
<br />
<?php
echo '<table class="wp-list-table widefat fixed" cellspacing="0" style="width: 85%;margin-left:auto;;margin-right:auto;">';
echo '<thead><tr><th width="35%">' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></thead>';
echo '<tfoot><tr><th>' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></tfoot>';
echo '<tr title=">=3.2"><td>' . __('WordPress version', 'backwpup') . '</td><td>' . BackWPup::get_plugin_data('wp_version') . '</td></tr>';
if (!class_exists('BackWPup_Pro', FALSE)) {
echo '<tr title=""><td>' . __('BackWPup version', 'backwpup') . '</td><td>' . BackWPup::get_plugin_data('Version') . ' <a href="' . translate(BackWPup::get_plugin_data('pluginuri'), 'backwpup') . '">' . __('Get pro.', 'backwpup') . '</a></td></tr>';
} else {
echo '<tr title=""><td>' . __('BackWPup Pro version', 'backwpup') . '</td><td>' . BackWPup::get_plugin_data('Version') . '</td></tr>';
}
echo '<tr title=">=5.3.3"><td>' . __('PHP version', 'backwpup') . '</td><td>' . PHP_VERSION . '</td></tr>';
echo '<tr title=">=5.0.7"><td>' . __('MySQL version', 'backwpup') . '</td><td>' . $wpdb->get_var("SELECT VERSION() AS version") . '</td></tr>';
if (function_exists('curl_version')) {
$curlversion = curl_version();
echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . $curlversion['version'] . '</td></tr>';
echo '<tr title=""><td>' . __('cURL SSL version', 'backwpup') . '</td><td>' . $curlversion['ssl_version'] . '</td></tr>';
} else {
echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . __('unavailable', 'backwpup') . '</td></tr>';
}
echo '<tr title=""><td>' . __('WP-Cron url:', 'backwpup') . '</td><td>' . site_url('wp-cron.php') . '</td></tr>';
//response test
echo '<tr><td>' . __('Server self connect:', 'backwpup') . '</td><td>';
$raw_response = BackWPup_Job::get_jobrun_url('test');
$test_result = '';
if (is_wp_error($raw_response)) {
$test_result .= sprintf(__('The HTTP response test get an error "%s"', 'backwpup'), $raw_response->get_error_message());
} elseif (200 != wp_remote_retrieve_response_code($raw_response) && 204 != wp_remote_retrieve_response_code($raw_response)) {
$test_result .= sprintf(__('The HTTP response test get a false http status (%s)', 'backwpup'), wp_remote_retrieve_response_code($raw_response));
}
$headers = wp_remote_retrieve_headers($raw_response);
if (isset($headers['x-backwpup-ver']) && $headers['x-backwpup-ver'] != BackWPup::get_plugin_data('version')) {
$test_result .= sprintf(__('The BackWPup HTTP response header returns a false value: "%s"', 'backwpup'), $headers['x-backwpup-ver']);
}
if (empty($test_result)) {
_e('Response Test O.K.', 'backwpup');
} else {
echo $test_result;
}
echo '</td></tr>';
//folder test
echo '<tr><td>' . __('Temp folder:', 'backwpup') . '</td><td>';
if (!is_dir(BackWPup::get_plugin_data('TEMP'))) {
echo sprintf(__('Temp folder %s doesn\'t exist.', 'backwpup'), BackWPup::get_plugin_data('TEMP'));
} elseif (!is_writable(BackWPup::get_plugin_data('TEMP'))) {
echo sprintf(__('Temporary folder %s is not writable.', 'backwpup'), BackWPup::get_plugin_data('TEMP'));
} else {
echo BackWPup::get_plugin_data('TEMP');
}
echo '</td></tr>';
echo '<tr><td>' . __('Log folder:', 'backwpup') . '</td><td>';
if (!is_dir(get_site_option('backwpup_cfg_logfolder'))) {
echo sprintf(__('Logs folder %s not exist.', 'backwpup'), get_site_option('backwpup_cfg_logfolder'));
} elseif (!is_writable(get_site_option('backwpup_cfg_logfolder'))) {
echo sprintf(__('Log folder %s is not writable.', 'backwpup'), get_site_option('backwpup_cfg_logfolder'));
} else {
示例6: load
/**
*
*/
public static function load()
{
//Create Table
self::$listtable = new self();
switch (self::$listtable->current_action()) {
case 'delete':
//Delete Job
if (!current_user_can('backwpup_jobs_edit')) {
break;
}
if (is_array($_GET['jobs'])) {
check_admin_referer('bulk-jobs');
foreach ($_GET['jobs'] as $jobid) {
wp_clear_scheduled_hook('backwpup_cron', array('id' => $jobid));
BackWPup_Option::delete_job($jobid);
}
}
break;
case 'copy':
//Copy Job
if (!current_user_can('backwpup_jobs_edit')) {
break;
}
$old_job_id = (int) $_GET['jobid'];
check_admin_referer('copy-job_' . $_GET['jobid']);
//create new
$newjobid = BackWPup_Option::get_job_ids();
sort($newjobid);
$newjobid = end($newjobid) + 1;
$old_options = BackWPup_Option::get_job($old_job_id);
foreach ($old_options as $key => $option) {
if ($key == "jobid") {
$option = $newjobid;
}
if ($key == "name") {
$option = __('Copy of', 'backwpup') . ' ' . $option;
}
if ($key == "activetype") {
$option = '';
}
if ($key == "archivename") {
$option = str_replace($_GET['jobid'], $newjobid, $option);
}
if ($key == "logfile" || $key == "lastbackupdownloadurl" || $key == "lastruntime" || $key == "lastrun") {
continue;
}
BackWPup_Option::update($newjobid, $key, $option);
}
break;
case 'start_cli':
//Get cmd start file
if (!current_user_can('backwpup_jobs_start')) {
break;
}
check_admin_referer('start_cli');
if (empty($_GET['jobid'])) {
break;
}
if (FALSE === strpos(PHP_OS, "WIN")) {
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=BackWPup_cmd_start_job_" . $_GET['jobid'] . ".sh;");
if (defined('PHP_BINDIR')) {
echo "#!/bin/sh" . PHP_EOL;
}
echo "@\$1php -c \"" . php_ini_loaded_file() . "\" -r \"\$_SERVER[ 'SERVER_ADDR' ] = '" . $_SERVER['SERVER_ADDR'] . "'; \$_SERVER[ 'REMOTE_ADDR' ] = '" . $_SERVER['REMOTE_ADDR'] . "'; \$_SERVER[ 'HTTP_HOST' ] = '" . $_SERVER['HTTP_HOST'] . "'; \$_SERVER[ 'HTTP_USER_AGENT' ] = '" . BackWPup::get_plugin_data('name') . "'; define( 'DOING_CRON', TRUE ); require '" . ABSPATH . "wp-load.php'; if( class_exists( 'BackWPup_Job' ) ) BackWPup_Job::start_cli( " . $_GET['jobid'] . " );\"";
die;
} else {
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=BackWPup_cmd_start_job_" . $_GET['jobid'] . ".cmd;");
echo "@%1php.exe -c \"" . php_ini_loaded_file() . "\" -r \"\$_SERVER[ 'SERVER_ADDR' ] = '" . $_SERVER['SERVER_ADDR'] . "'; \$_SERVER[ 'REMOTE_ADDR' ] = '" . $_SERVER['REMOTE_ADDR'] . "'; \$_SERVER[ 'HTTP_HOST' ] = '" . $_SERVER['HTTP_HOST'] . "'; \$_SERVER[ 'HTTP_USER_AGENT' ] = '" . BackWPup::get_plugin_data('name') . "'; define( 'DOING_CRON', TRUE ); require '" . ABSPATH . "wp-load.php'; if( class_exists( 'BackWPup_Job' ) ) BackWPup_Job::start_cli( " . $_GET['jobid'] . " );\"";
die;
}
break;
case 'runnow':
if (!empty($_GET['jobid'])) {
if (!current_user_can('backwpup_jobs_start')) {
wp_die(__('Sorry, you don\'t have permissions to do that.', 'backwpup'));
}
check_admin_referer('backwpup_job_run-runnowlink');
//check temp folder
BackWPup_Job::check_folder(BackWPup::get_plugin_data('TEMP'), TRUE);
//check log folder
BackWPup_Job::check_folder(get_site_option('backwpup_cfg_logfolder'));
//check server callback
$raw_response = BackWPup_Job::get_jobrun_url('test');
$test_result = '';
if (is_wp_error($raw_response)) {
$test_result .= sprintf(__('The HTTP response test get an error "%s"', 'backwpup'), $raw_response->get_error_message());
} elseif (200 != wp_remote_retrieve_response_code($raw_response) && 204 != wp_remote_retrieve_response_code($raw_response)) {
$test_result .= sprintf(__('The HTTP response test get a false http status (%s)', 'backwpup'), wp_remote_retrieve_response_code($raw_response));
}
//.........这里部分代码省略.........
示例7: page
//.........这里部分代码省略.........
</div>
<div class="table ui-tabs-hide" id="backwpup-tab-information">
<br />
<?php
echo '<table class="wp-list-table widefat fixed" cellspacing="0" style="width:85%;margin-left:auto;margin-right:auto;">';
echo '<thead><tr><th width="35%">' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></thead>';
echo '<tfoot><tr><th>' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></tfoot>';
echo '<tr title=">=3.2"><td>' . __('WordPress version', 'backwpup') . '</td><td>' . esc_html(BackWPup::get_plugin_data('wp_version')) . '</td></tr>';
if (!class_exists('BackWPup_Pro', FALSE)) {
echo '<tr title=""><td>' . __('BackWPup version', 'backwpup') . '</td><td>' . esc_html(BackWPup::get_plugin_data('Version')) . ' <a href="' . __('http://backwpup.com', 'backwpup') . '">' . __('Get pro.', 'backwpup') . '</a></td></tr>';
} else {
echo '<tr title=""><td>' . __('BackWPup Pro version', 'backwpup') . '</td><td>' . esc_html(BackWPup::get_plugin_data('Version')) . '</td></tr>';
}
$bit = '';
if (PHP_INT_SIZE === 4) {
$bit = ' (32bit)';
}
if (PHP_INT_SIZE === 8) {
$bit = ' (64bit)';
}
echo '<tr title=">=5.3.3"><td>' . __('PHP version', 'backwpup') . '</td><td>' . esc_html(PHP_VERSION . ' ' . $bit) . '</td></tr>';
echo '<tr title=">=5.0.7"><td>' . __('MySQL version', 'backwpup') . '</td><td>' . esc_html($wpdb->get_var("SELECT VERSION() AS version")) . '</td></tr>';
if (function_exists('curl_version')) {
$curlversion = curl_version();
echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . esc_html($curlversion['version']) . '</td></tr>';
echo '<tr title=""><td>' . __('cURL SSL version', 'backwpup') . '</td><td>' . esc_html($curlversion['ssl_version']) . '</td></tr>';
} else {
echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . __('unavailable', 'backwpup') . '</td></tr>';
}
echo '<tr title=""><td>' . __('WP-Cron url:', 'backwpup') . '</td><td>' . site_url('wp-cron.php') . '</td></tr>';
//response test
echo '<tr><td>' . __('Server self connect:', 'backwpup') . '</td><td>';
$raw_response = BackWPup_Job::get_jobrun_url('test');
$response_code = wp_remote_retrieve_response_code($raw_response);
$response_body = wp_remote_retrieve_body($raw_response);
if (strstr($response_body, 'BackWPup test request') === false) {
$test_result = __('<strong>Not expected HTTP response:</strong><br>', 'backwpup');
if (!$response_code) {
$test_result .= sprintf(__('WP Http Error: <code>%s</code>', 'backwpup'), esc_html($raw_response->get_error_message())) . '<br>';
} else {
$test_result .= sprintf(__('Status-Code: <code>%d</code>', 'backwpup'), esc_html($response_code)) . '<br>';
}
$response_headers = wp_remote_retrieve_headers($raw_response);
foreach ($response_headers as $key => $value) {
$test_result .= esc_html(ucfirst($key)) . ': <code>' . esc_html($value) . '</code><br>';
}
$content = esc_html(wp_remote_retrieve_body($raw_response));
if ($content) {
$test_result .= sprintf(__('Content: <code>%s</code>', 'backwpup'), $content);
}
echo $test_result;
} else {
_e('Response Test O.K.', 'backwpup');
}
echo '</td></tr>';
//folder test
echo '<tr><td>' . __('Temp folder:', 'backwpup') . '</td><td>';
if (!is_dir(BackWPup::get_plugin_data('TEMP'))) {
echo sprintf(__('Temp folder %s doesn\'t exist.', 'backwpup'), esc_html(BackWPup::get_plugin_data('TEMP')));
} elseif (!is_writable(BackWPup::get_plugin_data('TEMP'))) {
echo sprintf(__('Temporary folder %s is not writable.', 'backwpup'), esc_html(BackWPup::get_plugin_data('TEMP')));
} else {
echo esc_html(BackWPup::get_plugin_data('TEMP'));
}
echo '</td></tr>';
示例8: information
protected function information()
{
global $wpdb;
// Copied from BackWPup_Page_Settings
ob_start();
echo '<table class="wp-list-table widefat fixed" cellspacing="0" style="width: 85%;margin-left:auto;;margin-right:auto;">';
echo '<thead><tr><th width="35%">' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></thead>';
echo '<tfoot><tr><th>' . __('Setting', 'backwpup') . '</th><th>' . __('Value', 'backwpup') . '</th></tr></tfoot>';
echo '<tr title=">=3.2"><td>' . __('WordPress version', 'backwpup') . '</td><td>' . esc_html(BackWPup::get_plugin_data('wp_version')) . '</td></tr>';
if (!class_exists('BackWPup_Pro', false)) {
echo '<tr title=""><td>' . __('BackWPup version', 'backwpup') . '</td><td>' . esc_html(BackWPup::get_plugin_data('Version')) . ' <a href="' . esc_url(translate(BackWPup::get_plugin_data('pluginuri'), 'backwpup')) . '">' . __('Get pro.', 'backwpup') . '</a></td></tr>';
} else {
echo '<tr title=""><td>' . __('BackWPup Pro version', 'backwpup') . '</td><td>' . esc_html(BackWPup::get_plugin_data('Version')) . '</td></tr>';
}
echo '<tr title=">=5.3.3"><td>' . __('PHP version', 'backwpup') . '</td><td>' . esc_html(PHP_VERSION) . '</td></tr>';
echo '<tr title=">=5.0.7"><td>' . __('MySQL version', 'backwpup') . '</td><td>' . esc_html($wpdb->get_var('SELECT VERSION() AS version')) . '</td></tr>';
if (function_exists('curl_version')) {
$curlversion = curl_version();
echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . esc_html($curlversion['version']) . '</td></tr>';
echo '<tr title=""><td>' . __('cURL SSL version', 'backwpup') . '</td><td>' . esc_html($curlversion['ssl_version']) . '</td></tr>';
} else {
echo '<tr title=""><td>' . __('cURL version', 'backwpup') . '</td><td>' . __('unavailable', 'backwpup') . '</td></tr>';
}
echo '<tr title=""><td>' . __('WP-Cron url:', 'backwpup') . '</td><td>' . esc_html(site_url('wp-cron.php')) . '</td></tr>';
echo '<tr><td>' . __('Server self connect:', 'backwpup') . '</td><td>';
$raw_response = BackWPup_Job::get_jobrun_url('test');
$test_result = '';
if (is_wp_error($raw_response)) {
$test_result .= sprintf(__('The HTTP response test get an error "%s"', 'backwpup'), esc_html($raw_response->get_error_message()));
} elseif (200 !== (int) wp_remote_retrieve_response_code($raw_response) && 204 !== (int) wp_remote_retrieve_response_code($raw_response)) {
$test_result .= sprintf(__('The HTTP response test get a false http status (%s)', 'backwpup'), esc_html(wp_remote_retrieve_response_code($raw_response)));
}
$headers = wp_remote_retrieve_headers($raw_response);
if (isset($headers['x-backwpup-ver']) && BackWPup::get_plugin_data('version') !== $headers['x-backwpup-ver']) {
$test_result .= sprintf(__('The BackWPup HTTP response header returns a false value: "%s"', 'backwpup'), esc_html($headers['x-backwpup-ver']));
}
if (empty($test_result)) {
esc_html_e('Response Test O.K.', 'backwpup');
} else {
echo esc_html($test_result);
}
echo '</td></tr>';
echo '<tr><td>' . __('Temp folder:', 'backwpup') . '</td><td>';
if (!is_dir(BackWPup::get_plugin_data('TEMP'))) {
echo sprintf(__('Temp folder %s doesn\'t exist.', 'backwpup'), esc_html(BackWPup::get_plugin_data('TEMP')));
} elseif (!is_writable(BackWPup::get_plugin_data('TEMP'))) {
echo sprintf(__('Temporary folder %s is not writable.', 'backwpup'), esc_html(BackWPup::get_plugin_data('TEMP')));
} else {
echo esc_html(BackWPup::get_plugin_data('TEMP'));
}
echo '</td></tr>';
echo '<tr><td>' . __('Log folder:', 'backwpup') . '</td><td>';
if (!is_dir(get_site_option('backwpup_cfg_logfolder'))) {
echo sprintf(__('Logs folder %s not exist.', 'backwpup'), esc_html(get_site_option('backwpup_cfg_logfolder')));
} elseif (!is_writable(get_site_option('backwpup_cfg_logfolder'))) {
echo sprintf(__('Log folder %s is not writable.', 'backwpup'), esc_html(get_site_option('backwpup_cfg_logfolder')));
} else {
echo esc_html(get_site_option('backwpup_cfg_logfolder'));
}
echo '</td></tr>';
echo '<tr title=""><td>' . __('Server', 'backwpup') . '</td><td>' . esc_html($_SERVER['SERVER_SOFTWARE']) . '</td></tr>';
echo '<tr title=""><td>' . __('Operating System', 'backwpup') . '</td><td>' . esc_html(PHP_OS) . '</td></tr>';
echo '<tr title=""><td>' . __('PHP SAPI', 'backwpup') . '</td><td>' . esc_html(PHP_SAPI) . '</td></tr>';
echo '<tr title=""><td>' . __('Current PHP user', 'backwpup') . '</td><td>' . esc_html(get_current_user()) . '</td></tr>';
$text = (bool) ini_get('safe_mode') ? __('On', 'backwpup') : __('Off', 'backwpup');
echo '<tr title=""><td>' . __('Safe Mode', 'backwpup') . '</td><td>' . $text . '</td></tr>';
echo '<tr title=">=30"><td>' . __('Maximum execution time', 'backwpup') . '</td><td>' . ini_get('max_execution_time') . ' ' . __('seconds', 'backwpup') . '</td></tr>';
if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
echo '<tr title="ALTERNATE_WP_CRON"><td>' . __('Alternative WP Cron', 'backwpup') . '</td><td>' . __('On', 'backwpup') . '</td></tr>';
} else {
echo '<tr title="ALTERNATE_WP_CRON"><td>' . __('Alternative WP Cron', 'backwpup') . '</td><td>' . __('Off', 'backwpup') . '</td></tr>';
}
if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) {
echo '<tr title="DISABLE_WP_CRON"><td>' . __('Disabled WP Cron', 'backwpup') . '</td><td>' . __('On', 'backwpup') . '</td></tr>';
} else {
echo '<tr title="DISABLE_WP_CRON"><td>' . __('Disabled WP Cron', 'backwpup') . '</td><td>' . __('Off', 'backwpup') . '</td></tr>';
}
if (defined('FS_CHMOD_DIR')) {
echo '<tr title="FS_CHMOD_DIR"><td>' . __('CHMOD Dir', 'backwpup') . '</td><td>' . FS_CHMOD_DIR . '</td></tr>';
} else {
echo '<tr title="FS_CHMOD_DIR"><td>' . __('CHMOD Dir', 'backwpup') . '</td><td>0755</td></tr>';
}
$now = localtime(time(), true);
echo '<tr title=""><td>' . __('Server Time', 'backwpup') . '</td><td>' . esc_html($now['tm_hour']) . ':' . esc_html($now['tm_min']) . '</td></tr>';
echo '<tr title=""><td>' . __('Blog Time', 'backwpup') . '</td><td>' . esc_html(date_i18n('H:i')) . '</td></tr>';
echo '<tr title=""><td>' . __('Blog Timezone', 'backwpup') . '</td><td>' . esc_html(get_option('timezone_string')) . '</td></tr>';
echo '<tr title=""><td>' . __('Blog Time offset', 'backwpup') . '</td><td>' . sprintf(__('%s hours', 'backwpup'), esc_html(get_option('gmt_offset'))) . '</td></tr>';
echo '<tr title="WPLANG"><td>' . __('Blog language', 'backwpup') . '</td><td>' . esc_html(get_bloginfo('language')) . '</td></tr>';
echo '<tr title="utf8"><td>' . __('MySQL Client encoding', 'backwpup') . '</td><td>';
echo defined('DB_CHARSET') ? esc_html(DB_CHARSET) : '';
echo '</td></tr>';
echo '<tr title="URF-8"><td>' . __('Blog charset', 'backwpup') . '</td><td>' . esc_html(get_bloginfo('charset')) . '</td></tr>';
echo '<tr title=">=128M"><td>' . __('PHP Memory limit', 'backwpup') . '</td><td>' . esc_html(ini_get('memory_limit')) . '</td></tr>';
echo '<tr title="WP_MEMORY_LIMIT"><td>' . __('WP memory limit', 'backwpup') . '</td><td>' . esc_html(WP_MEMORY_LIMIT) . '</td></tr>';
echo '<tr title="WP_MAX_MEMORY_LIMIT"><td>' . __('WP maximum memory limit', 'backwpup') . '</td><td>' . esc_html(WP_MAX_MEMORY_LIMIT) . '</td></tr>';
echo '<tr title=""><td>' . __('Memory in use', 'backwpup') . '</td><td>' . esc_html(size_format(@memory_get_usage(true), 2)) . '</td></tr>';
//disabled PHP functions
$disabled = ini_get('disable_functions');
if (!empty($disabled)) {
$disabledarry = explode(',', $disabled);
//.........这里部分代码省略.........