本文整理汇总了PHP中UpdraftPlus_Options::admin_page_url方法的典型用法代码示例。如果您正苦于以下问题:PHP UpdraftPlus_Options::admin_page_url方法的具体用法?PHP UpdraftPlus_Options::admin_page_url怎么用?PHP UpdraftPlus_Options::admin_page_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpdraftPlus_Options
的用法示例。
在下文中一共展示了UpdraftPlus_Options::admin_page_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_login_url
public function get_login_url($redirect_to, $extra_info)
{
if (is_array($extra_info) && !empty($extra_info['user_id']) && is_numeric($extra_info['user_id'])) {
$user_id = $extra_info['user_id'];
if (false == ($login_key = $this->_get_autologin_key($user_id))) {
return $this->_generic_error_response('user_key_failure');
}
// Default value
$redirect_url = network_admin_url();
if (is_array($redirect_to) && !empty($redirect_to['module'])) {
switch ($redirect_to['module']) {
case 'updraftplus':
if ('initiate_restore' == $redirect_to['action'] && class_exists('UpdraftPlus_Options')) {
$redirect_url = UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&udaction=initiate_restore&entities=' . urlencode($redirect_to['data']['entities']) . '&showdata=' . urlencode($redirect_to['data']['showdata']) . '&backup_timestamp=' . (int) $redirect_to['data']['backup_timestamp'];
} elseif ('download_file' == $redirect_to['action']) {
$findex = empty($redirect_to['data']['findex']) ? 0 : (int) $redirect_to['data']['findex'];
// e.g. ?udcentral_action=dl&action=updraftplus_spool_file&backup_timestamp=1455101696&findex=0&what=plugins
$redirect_url = site_url() . '?udcentral_action=spool_file&action=updraftplus_spool_file&findex=' . $findex . '&what=' . urlencode($redirect_to['data']['what']) . '&backup_timestamp=' . (int) $redirect_to['data']['backup_timestamp'];
}
break;
case 'direct_url':
$redirect_url = $redirect_to['url'];
break;
}
}
$login_key = apply_filters('updraftplus_remotecontrol_login_key', array('key' => $login_key, 'created' => time(), 'redirect_url' => $redirect_url), $redirect_to, $extra_info);
// Over-write any previous value - only one can be valid at a time)
update_user_meta($user_id, 'updraftcentral_login_key', $login_key);
return $this->_response(array('login_url' => network_site_url('?udcentral_action=login&login_id=' . $user_id . '&login_key=' . $login_key['key'])));
} else {
return $this->_generic_error_response('user_unknown');
}
}
示例2: itsec_external_backup_link
public function itsec_external_backup_link($x)
{
return UpdraftPlus_Options::admin_page_url() . '?page=updraftplus';
}
示例3: bootstrap
public function bootstrap()
{
if (!empty($this->dropbox_object) && !is_wp_error($this->dropbox_object)) {
return $this->dropbox_object;
}
require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/API.php';
require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/Exception.php';
require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Consumer/ConsumerAbstract.php';
require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Storage/StorageInterface.php';
require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Storage/Encrypter.php';
require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Storage/WordPress.php';
require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Consumer/Curl.php';
// require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Consumer/WordPress.php');
$opts = $this->get_opts();
$key = empty($opts['secret']) ? '' : $opts['secret'];
$sec = empty($opts['appkey']) ? '' : $opts['appkey'];
// Set the callback URL
$callback = UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraftmethod-dropbox-auth';
// Instantiate the Encrypter and storage objects
$encrypter = new Dropbox_Encrypter('ThisOneDoesNotMatterBeyondLength');
// Instantiate the storage
$storage = new Dropbox_WordPress($encrypter, "tk_", 'updraft_dropbox');
// WordPress consumer does not yet work
// $OAuth = new Dropbox_ConsumerWordPress($sec, $key, $storage, $callback);
// Get the DropBox API access details
list($d2, $d1) = $this->defaults();
if (empty($sec)) {
$sec = base64_decode($d1);
}
if (empty($key)) {
$key = base64_decode($d2);
}
$root = 'sandbox';
if ('dropbox:' == substr($sec, 0, 8)) {
$sec = substr($sec, 8);
$root = 'dropbox';
}
try {
$OAuth = new Dropbox_Curl($sec, $key, $storage, $callback);
} catch (Exception $e) {
global $updraftplus;
$updraftplus->log("Dropbox Curl error: " . $e->getMessage());
$updraftplus->log(sprintf(__("%s error: %s", 'updraftplus'), "Dropbox/Curl", $e->getMessage()), 'error');
return false;
}
$this->dropbox_object = new UpdraftPlus_Dropbox_API($OAuth, $root);
return $this->dropbox_object;
}
示例4: backup_now_remote_message
private function backup_now_remote_message()
{
global $updraftplus;
$service = $updraftplus->just_one(UpdraftPlus_Options::get_updraft_option('updraft_service'));
if (is_string($service)) {
$service = array($service);
}
if (!is_array($service)) {
$service = array();
}
$no_remote_configured = empty($service) || array('none') === $service || array('') === $service ? true : false;
if ($no_remote_configured) {
return '<input type="checkbox" disabled="disabled" id="backupnow_includecloud"> <em>' . sprintf(__("Backup won't be sent to any remote storage - none has been saved in the %s", 'updraftplus'), '<a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&tab=settings" id="updraft_backupnow_gotosettings">' . __('settings', 'updraftplus')) . '</a>. ' . __('Not got any remote storage?', 'updraftplus') . ' <a href="https://updraftplus.com/support/updraftplus-vault-faqs/">' . __("Check out UpdraftPlus Vault.", 'updraftplus') . '</a></em>';
} else {
return '<input type="checkbox" id="backupnow_includecloud" checked="checked"> <label for="backupnow_includecloud">' . __("Send this backup to remote storage", 'updraftplus') . '</label>';
}
}
示例5: settings_formcontents
//.........这里部分代码省略.........
:</th>
<td><input type="checkbox" id="updraft_delete_local" name="updraft_delete_local" value="1" <?php
if ($delete_local) {
echo 'checked="checked"';
}
?>
> <br><label for="updraft_delete_local"><?php
_e('Check this to delete any superfluous backup files from your server after the backup run finishes (i.e. if you uncheck, then any files despatched remotely will also remain locally, and any files being kept locally will not be subject to the retention limits).', 'updraftplus');
?>
</label></td>
</tr>
<tr class="expertmode backupdirrow" style="display:none;">
<th><?php
_e('Backup directory', 'updraftplus');
?>
:</th>
<td><input type="text" name="updraft_dir" id="updraft_dir" style="width:525px" value="<?php
echo htmlspecialchars($this->prune_updraft_dir_prefix($updraft_dir));
?>
" /></td>
</tr>
<tr class="expertmode backupdirrow" style="display:none;">
<td></td><td><?php
if ($really_is_writable) {
$dir_info = '<span style="color:green">' . __('Backup directory specified is writable, which is good.', 'updraftplus') . '</span>';
} else {
$dir_info = '<span style="color:red">';
if (!is_dir($updraft_dir)) {
$dir_info .= __('Backup directory specified does <b>not</b> exist.', 'updraftplus');
} else {
$dir_info .= __('Backup directory specified exists, but is <b>not</b> writable.', 'updraftplus');
}
$dir_info .= ' <span style="font-size:110%;font-weight:bold"><a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraft_create_backup_dir&nonce=' . wp_create_nonce('create_backup_dir') . '">' . __('Click here to attempt to create the directory and set the permissions', 'updraftplus') . '</a></span>, ' . __('or, to reset this option', 'updraftplus') . ' <a href="#" onclick="jQuery(\'#updraft_dir\').val(\'updraft\'); return false;">' . __('click here', 'updraftplus') . '</a>. ' . __('If that is unsuccessful check the permissions on your server or change it to another directory that is writable by your web server process.', 'updraftplus') . '</span>';
}
echo $dir_info . ' ' . __("This is where UpdraftPlus will write the zip files it creates initially. This directory must be writable by your web server. It is relative to your content directory (which by default is called wp-content).", 'updraftplus') . ' ' . __("<b>Do not</b> place it inside your uploads or plugins directory, as that will cause recursion (backups of backups of backups of...).", 'updraftplus');
?>
</td>
</tr>
<tr class="expertmode" style="display:none;">
<th><?php
_e('Use the server\'s SSL certificates', 'updraftplus');
?>
:</th>
<td><input type="checkbox" id="updraft_ssl_useservercerts" name="updraft_ssl_useservercerts" value="1" <?php
if (UpdraftPlus_Options::get_updraft_option('updraft_ssl_useservercerts')) {
echo 'checked="checked"';
}
?>
> <br><label for="updraft_ssl_useservercerts"><?php
_e('By default UpdraftPlus uses its own store of SSL certificates to verify the identity of remote sites (i.e. to make sure it is talking to the real Dropbox, Amazon S3, etc., and not an attacker). We keep these up to date. However, if you get an SSL error, then choosing this option (which causes UpdraftPlus to use your web server\'s collection instead) may help.', 'updraftplus');
?>
</label></td>
</tr>
<tr class="expertmode" style="display:none;">
<th><?php
_e('Do not verify SSL certificates', 'updraftplus');
?>
:</th>
<td><input type="checkbox" id="updraft_ssl_disableverify" name="updraft_ssl_disableverify" value="1" <?php
if (UpdraftPlus_Options::get_updraft_option('updraft_ssl_disableverify')) {
echo 'checked="checked"';
}
?>
示例6: adminaction_searchreplace
public function adminaction_searchreplace()
{
echo '<h2>' . __('Search / replace database', 'updraftplus') . '</h2>';
echo '<strong>' . __('Search for', 'updraftplus') . ':</strong> ' . htmlspecialchars($_POST['search']) . "<br>";
echo '<strong>' . __('Replace with', 'updraftplus') . ':</strong> ' . htmlspecialchars($_POST['replace']) . "<br>";
$this->page_size = empty($_POST['pagesize']) || !is_numeric($_POST['pagesize']) ? 5000 : $_POST['pagesize'];
$this->which_tables = empty($_POST['whichtables']) ? '' : explode(',', $_POST['whichtables']);
if (empty($_POST['search'])) {
echo sprintf(__("Failure: No %s was given.", 'updraftplus'), __('search term', 'updraftplus')) . "<br>";
echo '<a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
return;
}
global $updraftplus_restorer;
if (empty($updraftplus_restorer) || !is_a($updraftplus_restorer, '')) {
# Needed for the UpdraftPlus_WPDB class and Updraft_Restorer::sql_exec() method
require_once UPDRAFTPLUS_DIR . '/restorer.php';
$updraftplus_restorer = new Updraft_Restorer(null, null, true);
}
$this->updraftplus_restore_db_pre();
$this->tables_replaced = array();
$this->updraftplus_restored_db_dosearchreplace($_POST['search'], $_POST['replace'], $this->base_prefix, false);
echo '<a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
}
示例7: config_print
public function config_print()
{
$opts = $this->get_opts();
?>
<tr class="updraftplusmethod googledrive">
<td></td>
<td>
<img src="https://developers.google.com/drive/images/drive_logo.png" alt="<?php
_e('Google Drive', 'updraftplus');
?>
">
<p><em><?php
printf(__('%s is a great choice, because UpdraftPlus supports chunked uploads - no matter how big your site is, UpdraftPlus can upload it a little at a time, and not get thwarted by timeouts.', 'updraftplus'), 'Google Drive');
?>
</em></p>
</td>
</tr>
<tr class="updraftplusmethod googledrive">
<th></th>
<td>
<?php
$admin_page_url = UpdraftPlus_Options::admin_page_url();
# This is advisory - so the fact it doesn't match IPv6 addresses isn't important
if (preg_match('#^(https?://(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+))/#', $admin_page_url, $matches)) {
echo '<p><strong>' . htmlspecialchars(sprintf(__("%s does not allow authorisation of sites hosted on direct IP addresses. You will need to change your site's address (%s) before you can use %s for storage.", 'updraftplus'), __('Google Drive', 'updraftplus'), $matches[1], __('Google Drive', 'updraftplus'))) . '</strong></p>';
} else {
?>
<p><a href="https://updraftplus.com/support/configuring-google-drive-api-access-in-updraftplus/"><strong><?php
_e('For longer help, including screenshots, follow this link. The description below is sufficient for more expert users.', 'updraftplus');
?>
</strong></a></p>
<p><a href="https://console.developers.google.com"><?php
_e('Follow this link to your Google API Console, and there activate the Drive API and create a Client ID in the API Access section.', 'updraftplus');
?>
</a> <?php
_e("Select 'Web Application' as the application type.", 'updraftplus');
?>
</p><p><?php
echo htmlspecialchars(__('You must add the following as the authorised redirect URI (under "More Options") when asked', 'updraftplus'));
?>
: <kbd><?php
echo UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-googledrive-auth';
?>
</kbd> <?php
_e('N.B. If you install UpdraftPlus on several WordPress sites, then you cannot re-use your project; you must create a new one from your Google API console for each site.', 'updraftplus');
?>
</p>
<?php
}
?>
</td>
</tr>
<tr class="updraftplusmethod googledrive">
<th><?php
echo __('Google Drive', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
?>
:</th>
<td><input type="text" autocomplete="off" style="width:442px" name="updraft_googledrive[clientid]" value="<?php
echo htmlspecialchars($opts['clientid']);
?>
" /><br><em><?php
_e('If Google later shows you the message "invalid_client", then you did not enter a valid client ID here.', 'updraftplus');
?>
</em></td>
</tr>
<tr class="updraftplusmethod googledrive">
<th><?php
echo __('Google Drive', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
?>
:</th>
<td><input type="<?php
echo apply_filters('updraftplus_admin_secret_field_type', 'password');
?>
" style="width:442px" name="updraft_googledrive[secret]" value="<?php
echo htmlspecialchars($opts['secret']);
?>
" /></td>
</tr>
<?php
# Legacy configuration
if (isset($opts['parentid'])) {
$parentid = is_array($opts['parentid']) ? $opts['parentid']['id'] : $opts['parentid'];
$showparent = is_array($opts['parentid']) && !empty($opts['parentid']['name']) ? $opts['parentid']['name'] : $parentid;
$folder_opts = '<tr class="updraftplusmethod googledrive">
<th>' . __('Google Drive', 'updraftplus') . ' ' . __('Folder', 'updraftplus') . ':</th>
<td><input type="hidden" name="updraft_googledrive[parentid][id]" value="' . htmlspecialchars($parentid) . '">
<input type="text" title="' . esc_attr($parentid) . '" readonly="readonly" style="width:442px" value="' . htmlspecialchars($showparent) . '">';
if (!empty($parentid) && (!is_array($opts['parentid']) || empty($opts['parentid']['name']))) {
$folder_opts .= '<em>' . __("<strong>This is NOT a folder name</strong>.", 'updraftplus') . ' ' . __('It is an ID number internal to Google Drive', 'updraftplus') . '</em>';
} else {
$folder_opts .= '<input type="hidden" name="updraft_googledrive[parentid][name]" value="' . htmlspecialchars($opts['parentid']['name']) . '">';
}
} else {
$folder_opts = '<tr class="updraftplusmethod googledrive">
//.........这里部分代码省略.........
示例8: options_printpage
//.........这里部分代码省略.........
// Enumerate possible unclaimed/re-claimable purchases, and what should be active on this site
$unclaimed_available = array();
$assigned = array();
$have_all = false;
if ($this->connected && isset($updraftplus_addons2->user_addons) && is_array($updraftplus_addons2->user_addons)) {
foreach ($updraftplus_addons2->user_addons as $akey => $addon) {
// Keys: site, sitedescription, key, status
if (isset($addon['status']) && 'active' == $addon['status'] && isset($addon['site']) && ('unclaimed' == $addon['site'] || 'unlimited' == $addon['site'])) {
$key = $addon['key'];
$unclaimed_available[$key] = array('eid' => $akey, 'status' => 'available');
} elseif (isset($addon['status']) && 'active' == $addon['status'] && isset($addon['site']) && $addon['site'] == $sid) {
$key = $addon['key'];
$assigned[$key] = $akey;
if ('all' == $key) {
$have_all = true;
}
} elseif (isset($addon['sitedescription']) && ($home_url === $addon['sitedescription'] || 0 === strpos($addon['sitedescription'], $home_url . ' - '))) {
# Is assigned to a site with the same URL as this one - allow a reclaim
$key = $addon['key'];
$unclaimed_available[$key] = array('eid' => $akey, 'status' => 'reclaimable');
}
}
}
if (!$this->connected) {
$this->show_credentials_form($enter_credentials_begin, $enter_credentials_end);
}
$email = isset($options['email']) ? $options['email'] : '';
$pass = isset($options['password']) ? base64_encode($options['password']) : '';
$sn = base64_encode(get_bloginfo('name'));
$su = base64_encode($home_url);
$ourpageslug = UDADDONS2_PAGESLUG;
$mother = $this->mother;
//$href = (is_multisite()) ? 'settings.php' : 'options-general.php';
$href = UpdraftPlus_Options::admin_page_url();
if (count($unclaimed_available) > 0) {
$nonce = wp_create_nonce('udmanager-nonce');
$pleasewait = htmlspecialchars(__('Please wait whilst we make the claim...', 'updraftplus'));
$notgranted = esc_js(__('Claim not granted - perhaps you have already used this purchase somewhere else?', 'updraftplus'));
$notgrantedlogin = esc_js(__('Claim not granted - your account login details were wrong', 'updraftplus'));
$ukresponse = esc_js(__('An unknown response was received. Response was:', 'updraftplus'));
echo <<<ENDHERE
\t\t<div id="udm_pleasewait" class="updated" style="border: 1px solid; padding: 10px; margin-top: 10px; margin-bottom: 10px; clear: both; float: left; display:none;"><strong>{$pleasewait}</strong></div>
\t\t<script type="text/javascript">
\t\t\tfunction udm_claim(key) {
\t\t\t\tvar data = {
\t\t\t\t\t\taction: 'udaddons_claimaddon',
\t\t\t\t\t\tnonce: '{$nonce}',
\t\t\t\t\t\tkey: key
\t\t\t\t};
\t\t\t\tjQuery('#udm_pleasewait').fadeIn();
\t\t\t\tjQuery.post(ajaxurl, data, function(response) {
\t\t\t\t\tif ('ERR' == response) {
\t\t\t\t\t\talert("{$notgranted}");
\t\t\t\t\t} else if (response == 'OK') {
\t\t\t\t\t\twindow.location.href = '{$href}?page={$ourpageslug}&udm_refresh=1&udm_clearcred=1&tab=addons';
\t\t\t\t\t} else if (response == 'BADAUTH') {
\t\t\t\t\t\talert("{$notgrantedlogin}");
\t\t\t\t\t} else {
\t\t\t\t\t\talert("{$ukresponse} "+response);
\t\t\t\t\t}
\t\t\t\t\tjQuery('#udm_pleasewait').fadeOut();
\t\t\t\t});
\t\t\t}
\t\t</script>
ENDHERE;
}
示例9: do_config_print
public function do_config_print($opts)
{
global $updraftplus_admin;
$bucket_path = empty($opts['bucket_path']) ? '' : untrailingslashit($opts['bucket_path']);
$accesskey = empty($opts['accesskey']) ? '' : $opts['accesskey'];
$secret = empty($opts['secret']) ? '' : $opts['secret'];
$client_id = empty($opts['clientid']) ? '' : $opts['clientid'];
$project_id = empty($opts['project_id']) ? '' : $opts['project_id'];
$storage_class = empty($opts['storage_class']) ? 'STANDARD' : $opts['storage_class'];
$bucket_location = empty($opts['bucket_location']) ? 'US' : $opts['bucket_location'];
?>
<tr class="updraftplusmethod googlecloud">
<td></td>
<td>
<img alt="<?php
_e(sprintf(__('%s logo', 'updraftplus'), 'Google Cloud'));
?>
" src="<?php
echo esc_attr(UPDRAFTPLUS_URL . '/images/googlecloud.png');
?>
"><br>
<p><?php
printf(__('Do not confuse %s with %s - they are separate things.', 'updraftplus'), '<a href="https://cloud.google.com/storage">Google Cloud</a>', '<a href="https://drive.google.com">Google Drive</a>');
?>
</p>
<?php
$admin_page_url = UpdraftPlus_Options::admin_page_url();
# This is advisory - so the fact it doesn't match IPv6 addresses isn't important
if (preg_match('#^(https?://(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+))/#', $admin_page_url, $matches)) {
echo '<p><strong>' . htmlspecialchars(sprintf(__("%s does not allow authorisation of sites hosted on direct IP addresses. You will need to change your site's address (%s) before you can use %s for storage.", 'updraftplus'), __('Google Cloud', 'updraftplus'), $matches[1], __('Google Cloud', 'updraftplus'))) . '</strong></p>';
} else {
?>
<p><a href="https://updraftplus.com/support/configuring-google-cloud-api-access-updraftplus/"><strong><?php
_e('For longer help, including screenshots, follow this link. The description below is sufficient for more expert users.', 'updraftplus');
?>
</strong></a></p>
<p><a href="https://console.developers.google.com"><?php
_e('Follow this link to your Google API Console, and there activate the Storage API and create a Client ID in the API Access section.', 'updraftplus');
?>
</a> <?php
_e("Select 'Web Application' as the application type.", 'updraftplus');
?>
</p><p><?php
echo htmlspecialchars(__('You must add the following as the authorised redirect URI (under "More Options") when asked', 'updraftplus'));
?>
: <kbd><?php
echo UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-googlecloud-auth';
?>
</kbd>
</p>
<?php
}
?>
</td>
</tr>
<tr class="updraftplusmethod googlecloud">
<th><?php
echo __('Google Cloud', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
?>
:</th>
<td>
<input type="text" autocomplete="off" style="width:442px" id="updraft_googlecloud_clientid" name="updraft_googlecloud[clientid]" value="<?php
echo esc_attr($client_id);
?>
" />
<br><em><?php
_e('If Google later shows you the message "invalid_client", then you did not enter a valid client ID here.', 'updraftplus');
?>
</em>
</td>
</tr>
<tr class="updraftplusmethod googlecloud">
<th><?php
echo __('Google Cloud', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
?>
:</th>
<td><input type="<?php
echo apply_filters('updraftplus_admin_secret_field_type', 'password');
?>
" style="width:442px" id="updraft_googlecloud_apisecret" name="updraft_googlecloud[secret]" value="<?php
echo esc_attr($secret);
?>
" /></td>
</tr>
<?php
$updraftplus_admin->storagemethod_row('googlecloud', 'Google Cloud ' . __('Project ID', 'updraftplus') . ':', '<input title="' . esc_attr(sprintf(__('Enter the ID of the %s project you wish to use here.', 'updraftplus'), 'Google Cloud')) . '" type="text" style="width:442px" id="updraft_googlecloud_project_id" name="updraft_googlecloud[project_id]" value="' . esc_attr($project_id) . '"><br><em>' . __('N.B. This is only needed if you have not already created the bucket, and you wish UpdraftPlus to create it for you.', 'updraftplus') . ' ' . __('Otherwise, you can leave it blank.', 'updraftplus') . ' <a href="https://updraftplus.com/faqs/where-do-i-find-my-google-project-id/">' . __('Go here for more information.', 'updraftplus') . '</a></em>');
$updraftplus_admin->storagemethod_row('googlecloud', 'Google Cloud ' . __('Bucket', 'updraftplus') . ':', '<input title="' . esc_attr(sprintf(__('Enter the name of the %s bucket you wish to use here.', 'updraftplus'), 'Google Cloud') . ' ' . __('Bucket names have to be globally unique. If the bucket does not already exist, then it will be created.') . ' ' . sprintf(__('e.g. %s', 'updraftplus'), 'mybackups/workwebsite.')) . '" type="text" style="width:442px" id="updraft_googlecloud_bucket_path" name="updraft_googlecloud[bucket_path]" value="' . esc_attr($bucket_path) . '"><br><a href="https://cloud.google.com/storage/docs/bucket-naming?hl=en"><em>' . __("See Google's guidelines on bucket naming by following this link.", 'updraftplus') . '</a> ' . sprintf(__('You must use a bucket name that is unique, for all %s users.', 'updraftplus'), __('Google Cloud', 'updraftplus')) . '</em>');
?>
<tr class="updraftplusmethod googlecloud">
<th><?php
_e('Storage class', 'updraftplus');
?>
//.........这里部分代码省略.........
示例10: add_networkadmin_page
public static function add_networkadmin_page()
{
global $wp_admin_bar;
if (!is_object($wp_admin_bar) || !is_super_admin() || !function_exists('is_admin_bar_showing') || !is_admin_bar_showing()) {
return;
}
$wp_admin_bar->add_node(array('parent' => 'network-admin', 'id' => 'updraftplus-admin-settings', 'title' => __('UpdraftPlus Backups', 'updraftplus'), 'href' => UpdraftPlus_Options::admin_page_url() . '?page=updraftplus'));
}
示例11: config_print
public static function config_print()
{
?>
<tr class="updraftplusmethod googledrive">
<td><?php
_e('Google Drive', 'updraftplus');
?>
:</td>
<td>
<img src="https://developers.google.com/drive/images/drive_logo.png" alt="<?php
_e('Google Drive', 'updraftplus');
?>
">
<p><em><?php
printf(__('%s is a great choice, because UpdraftPlus supports chunked uploads - no matter how big your site is, UpdraftPlus can upload it a little at a time, and not get thwarted by timeouts.', 'updraftplus'), 'Google Drive');
?>
</em></p>
</td>
</tr>
<tr class="updraftplusmethod googledrive">
<th></th>
<td>
<?php
global $updraftplus_admin;
if (!class_exists('SimpleXMLElement')) {
$updraftplus_admin->show_double_warning('<strong>' . __('Warning', 'updraftplus') . ':</strong> ' . sprintf(__('Your web server\'s PHP installation does not included a required module (%s). Please contact your web hosting provider\'s support.', 'updraftplus'), 'SimpleXMLElement') . ' ' . sprintf(__("UpdraftPlus's %s module <strong>requires</strong> %s. Please do not file any support requests; there is no alternative.", 'updraftplus'), __('Google Drive', 'updraftplus'), 'SimpleXMLElement'), 'googledrive');
}
?>
</td>
</tr>
<tr class="updraftplusmethod googledrive">
<th>Google Drive:</th>
<td>
<p><a href="http://updraftplus.com/support/configuring-google-drive-api-access-in-updraftplus/"><strong><?php
_e('For longer help, including screenshots, follow this link. The description below is sufficient for more expert users.', 'updraftplus');
?>
</strong></a></p>
<p><a href="https://code.google.com/apis/console/"><?php
_e('Follow this link to your Google API Console, and there create a Client ID in the API Access section.', 'updraftplus');
?>
</a> <?php
_e("Select 'Web Application' as the application type.", 'updraftplus');
?>
</p><p><?php
echo htmlspecialchars(__('You must add the following as the authorised redirect URI (under "More Options") when asked', 'updraftplus'));
?>
: <kbd><?php
echo UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-googledrive-auth';
?>
</kbd> <?php
_e('N.B. If you install UpdraftPlus on several WordPress sites, then you cannot re-use your client ID; you must create a new one from your Google API console for each site.', 'updraftplus');
?>
<?php
if (!class_exists('SimpleXMLElement')) {
echo "<b>", __('Warning', 'updraftplus') . ':</b> ' . __("You do not have the SimpleXMLElement installed. Google Drive backups will <b>not</b> work until you do.", 'updraftplus');
}
?>
</p>
</td>
</tr>
<tr class="updraftplusmethod googledrive">
<th><?php
echo __('Google Drive', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
?>
:</th>
<td><input type="text" autocomplete="off" style="width:412px" name="updraft_googledrive_clientid" value="<?php
echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_googledrive_clientid'));
?>
" /><br><em><?php
_e('If Google later shows you the message "invalid_client", then you did not enter a valid client ID here.', 'updraftplus');
?>
</em></td>
</tr>
<tr class="updraftplusmethod googledrive">
<th><?php
echo __('Google Drive', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
?>
:</th>
<td><input type="<?php
echo apply_filters('updraftplus_admin_secret_field_type', 'text');
?>
" style="width:412px" name="updraft_googledrive_secret" value="<?php
echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_googledrive_secret'));
?>
" /></td>
</tr>
<tr class="updraftplusmethod googledrive">
<th><?php
echo __('Google Drive', 'updraftplus') . ' ' . __('Folder ID', 'updraftplus');
?>
:</th>
<td><input type="text" style="width:412px" name="updraft_googledrive_remotepath" value="<?php
echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_googledrive_remotepath'));
?>
" /> <em><?php
//.........这里部分代码省略.........
示例12: auth_request
private function auth_request()
{
# &updraftcopycomparms=, because copy.com is dumb and always appends '?param=value' regardless of the supplied format...
# i.e. we get sent back to somewhere like:
# options-general.php?action=updraftmethod-copycom-auth&updraftcopycomparms=?oauth_token=(etc)&oauth_verifier=(etc)
$callback_url = UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-copycom-auth&updraftcopycomparms=';
$get_request = $this->storage->get('oauth/request?scope=' . $this->get_copycom_perms() . '&oauth_callback=' . urlencode($callback_url));
if (!is_string($get_request)) {
throw new Exception('Unexpected HTTP result returned (' . serialize($get_request) . ')');
}
parse_str($get_request, $result);
# Also, there's oauth_callback_confirmed - not sure it's any use (it should be 'true')
if (empty($result['oauth_token']) || empty($result['oauth_token_secret'])) {
throw new Exception('Unexpected HTTP result returned (' . serialize($get_request) . ')');
}
# We will need this. But don't set token yet, as that is taken to indicate that all is finished
$this->options['tokensecret'] = $result['oauth_token_secret'];
UpdraftPlus_Options::update_updraft_option('updraft_copycom', $this->options);
# Next: request an authorize screen
#$auth_request = $this->storage->get('applications/authorize');
# N.B. It's www.copy.com - not the api_url in the storage
$authurl = 'https://www.copy.com/applications/authorize?oauth_token=' . urlencode($result['oauth_token']);
# = wp_remote_get($this->storage->api_url.'?oauth_token='.urlencode($result['oauth_token']));
#if (is_wp_error($auth_request)) { global $updraftplus; return $updraftplus->log_wp_error($auth_request, false, true); }
if (!headers_sent()) {
header('Location: ' . $authurl);
exit;
} else {
throw new Exception(sprintf(__('The %s authentication could not go ahead, because something else on your site is breaking it. Try disabling your other plugins and switching to a default theme. (Specifically, you are looking for the component that sends output (most likely PHP warnings/errors) before the page begins. Turning off any debugging settings may also help).', 'updraftplus'), 'Copy.Com'));
}
}
示例13: delete_old_dirs
private function delete_old_dirs()
{
global $wp_filesystem, $updraftplus;
$credentials = request_filesystem_credentials(wp_nonce_url(UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraft_delete_old_dirs', 'updraftplus-credentialtest-nonce'));
WP_Filesystem($credentials);
if ($wp_filesystem->errors->get_error_code()) {
foreach ($wp_filesystem->errors->get_error_messages() as $message) {
show_message($message);
}
exit;
}
// From WP_CONTENT_DIR - which contains 'themes'
$ret = $this->delete_old_dirs_dir($wp_filesystem->wp_content_dir());
$updraft_dir = $updraftplus->backups_dir_location();
if ($updraft_dir) {
$ret4 = $updraft_dir ? $this->delete_old_dirs_dir($updraft_dir, false) : true;
} else {
$ret4 = true;
}
// $ret2 = $this->delete_old_dirs_dir($wp_filesystem->abspath());
$plugs = untrailingslashit($wp_filesystem->wp_plugins_dir());
if ($wp_filesystem->is_dir($plugs . '-old')) {
print '<strong>' . esc_html__('Delete', 'updraftplus') . ': </strong>plugins-old: ';
if (!$wp_filesystem->delete($plugs . '-old', true)) {
$ret3 = false;
print '<strong>' . esc_html__('Failed', 'updraftplus') . '</strong><br>';
} else {
$ret3 = true;
print '<strong>' . esc_html__('OK', 'updraftplus') . '</strong><br>';
}
} else {
$ret3 = true;
}
return $ret && $ret3 && $ret4;
}
示例14: bootstrap
public function bootstrap($deauthenticate = false)
{
if (!empty($this->dropbox_object) && !is_wp_error($this->dropbox_object)) {
return $this->dropbox_object;
}
/*
Use Old Dropbox API constant is used to force bootstrap to use the old API this is for users having problems. By default we will use the new Dropbox API v2 as the old version will be deprecated as of June 2017
*/
$dropbox_api = defined('UPDRAFTPLUS_DROPBOX_API_V1') && UPDRAFTPLUS_DROPBOX_API_V1 && time() < 1498608000 ? 'Dropbox' : 'Dropbox2';
require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/API.php';
require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/Exception.php';
require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Consumer/ConsumerAbstract.php';
require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Storage/StorageInterface.php';
require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Storage/Encrypter.php';
require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Storage/WordPress.php';
require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Consumer/Curl.php';
// require_once(UPDRAFTPLUS_DIR.'/includes/'.$dropbox_api.'/OAuth/Consumer/WordPress.php');
$opts = $this->get_opts();
$key = empty($opts['secret']) ? '' : $opts['secret'];
$sec = empty($opts['appkey']) ? '' : $opts['appkey'];
$oauth2_id = base64_decode('aXA3NGR2Zm1sOHFteTA5');
// Set the callback URL
$callbackhome = UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraftmethod-dropbox-auth';
$callback = defined('UPDRAFTPLUS_DROPBOX_AUTH_RETURN_URL') ? UPDRAFTPLUS_DROPBOX_AUTH_RETURN_URL : 'https://auth.updraftplus.com/auth/dropbox/';
// Instantiate the Encrypter and storage objects
$encrypter = new Dropbox_Encrypter('ThisOneDoesNotMatterBeyondLength');
// Instantiate the storage
$storage = new Dropbox_WordPress($encrypter, "tk_", 'updraft_dropbox');
// WordPress consumer does not yet work
// $OAuth = new Dropbox_ConsumerWordPress($sec, $key, $storage, $callback);
// Get the DropBox API access details
list($d2, $d1) = $this->defaults();
if (empty($sec)) {
$sec = base64_decode($d1);
}
if (empty($key)) {
$key = base64_decode($d2);
}
$root = 'sandbox';
if ('dropbox:' == substr($sec, 0, 8)) {
$sec = substr($sec, 8);
$root = 'dropbox';
}
try {
$OAuth = new Dropbox_Curl($sec, $oauth2_id, $key, $storage, $callback, $callbackhome, $deauthenticate);
} catch (Exception $e) {
global $updraftplus;
$updraftplus->log("Dropbox Curl error: " . $e->getMessage());
$updraftplus->log(sprintf(__("%s error: %s", 'updraftplus'), "Dropbox/Curl", $e->getMessage() . ' (' . get_class($e) . ') (line: ' . $e->getLine() . ', file: ' . $e->getFile()) . ')', 'error');
return false;
}
if ($deauthenticate) {
return true;
}
$this->dropbox_object = new UpdraftPlus_Dropbox_API($OAuth, $root);
return $this->dropbox_object;
}
示例15: do_config_print
public function do_config_print($opts)
{
global $updraftplus_admin;
$folder = empty($opts['folder']) ? '' : untrailingslashit($opts['folder']);
$clientid = empty($opts['clientid']) ? '' : $opts['clientid'];
$secret = empty($opts['secret']) ? '' : $opts['secret'];
$site_host = parse_url(network_site_url(), PHP_URL_HOST);
if ('127.0.0.1' == $site_host || '::1' == $site_host || 'localhost' == $site_host) {
// Of course, there are other things that are effectively 127.0.0.1. This is just to help.
$callback_text = '<p><strong>' . htmlspecialchars(sprintf(__('Microsoft OneDrive is not compatible with sites hosted on a localhost or 127.0.0.1 URL - their developer console forbids these (current URL is: %s).', 'updraftplus'), site_url())) . '</strong></p>';
} else {
$callback_text = '<p>' . htmlspecialchars(__('You must add the following as the authorised redirect URI in your OneDrive console (under "API Settings") when asked', 'updraftplus')) . ': <kbd>' . UpdraftPlus_Options::admin_page_url() . '</kbd></p>';
}
$updraftplus_admin->storagemethod_row('onedrive', '', '<img src="' . UPDRAFTPLUS_URL . '/images/onedrive.png">' . $callback_text . '<p><a href="https://account.live.com/developers/applications/create">' . __('Create OneDrive credentials in your OneDrive developer console.', 'updraftplus') . '</a></p><p><a href="https://updraftplus.com/microsoft-onedrive-setup-guide/">' . __('For longer help, including screenshots, follow this link.', 'updraftplus') . '</a></p>');
?>
<tr class="updraftplusmethod onedrive">
<th><?php
echo __('OneDrive', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
?>
:</th>
<td><input type="text" autocomplete="off" style="width:442px" name="updraft_onedrive[clientid]" value="<?php
echo esc_attr($clientid);
?>
" /><br><em><?php
echo htmlspecialchars(__('If OneDrive later shows you the message "unauthorized_client", then you did not enter a valid client ID here.', 'updraftplus'));
?>
</em></td>
</tr>
<tr class="updraftplusmethod onedrive">
<th><?php
echo __('OneDrive', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
?>
:</th>
<td><input type="<?php
echo apply_filters('updraftplus_admin_secret_field_type', 'password');
?>
" style="width:442px" name="updraft_onedrive[secret]" value="<?php
echo esc_attr($secret);
?>
" /></td>
</tr>
<?php
$updraftplus_admin->storagemethod_row('onedrive', 'OneDrive ' . __('Folder', 'updraftplus'), '<input title="' . esc_attr(sprintf(__('Enter the path of the %s folder you wish to use here.', 'updraftplus'), 'OneDrive') . ' ' . __('If the folder does not already exist, then it will be created.') . ' ' . sprintf(__('e.g. %s', 'updraftplus'), 'MyBackups/WorkWebsite.') . ' ' . sprintf(__('If you leave it blank, then the backup will be placed in the root of your %s', 'updraftplus'), 'OneDrive account') . ' ' . sprintf(__('N.B. %s is not case-sensitive.', 'updraftplus'), 'OneDrive')) . '" type="text" style="width:442px" name="updraft_onedrive[folder]" value="' . esc_attr($folder) . '">');
$updraftplus_admin->storagemethod_row('onedrive', sprintf(__('Authenticate with %s', 'updraftplus'), 'OneDrive') . ':', '<p>' . (!empty($opts['refresh_token']) ? "<strong>" . __('(You appear to be already authenticated).', 'updraftplus') . '</strong>' : '') . (!empty($opts['refresh_token']) && !empty($opts['ownername']) ? ' ' . sprintf(__("Account holder's name: %s.", 'updraftplus'), htmlspecialchars($opts['ownername'])) . ' ' : '') . '</p><p><a href="?page=updraftplus&action=updraftmethod-onedrive-auth&updraftplus_onedriveauth=doit">' . sprintf(__('<strong>After</strong> you have saved your settings (by clicking \'Save Changes\' below), then come back here once and click this link to complete authentication with %s.', 'updraftplus'), 'OneDrive') . '</a></p>');
$updraftplus_admin->curl_check('OneDrive', false, 'onedrive', false);
}