本文整理汇总了PHP中backupbuddy_core::is_network_activated方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::is_network_activated方法的具体用法?PHP backupbuddy_core::is_network_activated怎么用?PHP backupbuddy_core::is_network_activated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::is_network_activated方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_action
// Register BackupBuddy API. As of BackupBuddy v5.0. Access credentials will be checked within callback.
add_action('wp_ajax_backupbuddy_api', array(pb_backupbuddy::$_ajax, 'api'));
add_action('wp_ajax_nopriv_backupbuddy_api', array(pb_backupbuddy::$_ajax, 'api'));
/********** DASHBOARD (admin) **********/
// Display stats in Dashboard.
//if ( pb_backupbuddy::$options['dashboard_stats'] == '1' ) {
if (!is_multisite() || is_multisite() && is_network_admin()) {
// Only show if standalon OR in main network admin.
pb_backupbuddy::add_dashboard_widget('stats', 'BackupBuddy v' . pb_backupbuddy::settings('version'), 'godmode');
}
//}
/********** FILTERS (admin) **********/
pb_backupbuddy::add_filter('plugin_row_meta', 10, 2);
/********** PAGES (admin) **********/
$icon = '';
if (is_multisite() && backupbuddy_core::is_network_activated() && !defined('PB_DEMO_MODE')) {
// Multisite installation.
if (defined('PB_BACKUPBUDDY_MULTISITE_EXPERIMENT') && PB_BACKUPBUDDY_MULTISITE_EXPERIMENT == TRUE) {
// comparing with bool but loose so string is acceptable.
if (is_network_admin()) {
// Network Admin pages
pb_backupbuddy::add_page('', 'backup', array(pb_backupbuddy::settings('name'), __('Backup', 'it-l10n-backupbuddy')), 'manage_network', $icon);
pb_backupbuddy::add_page('backup', 'migrate_restore', __('Migrate, Restore', 'it-l10n-backupbuddy'), 'manage_network');
pb_backupbuddy::add_page('backup', 'destinations', __('Remote Destinations', 'it-l10n-backupbuddy'), pb_backupbuddy::$options['role_access']);
pb_backupbuddy::add_page('backup', 'multisite_import', __('MS Import (beta)', 'it-l10n-backupbuddy'), 'manage_network');
pb_backupbuddy::add_page('backup', 'server_tools', __('Server Tools', 'it-l10n-backupbuddy'), 'manage_network');
pb_backupbuddy::add_page('backup', 'malware_scan', __('Malware Scan', 'it-l10n-backupbuddy'), 'manage_network');
pb_backupbuddy::add_page('backup', 'scheduling', __('Schedules', 'it-l10n-backupbuddy'), 'manage_network');
pb_backupbuddy::add_page('backup', 'settings', __('Settings', 'it-l10n-backupbuddy'), 'manage_network');
} else {
// Subsite pages.
示例2: preflight_check
public static function preflight_check()
{
$tests = array();
// MULTISITE BETA WARNING.
if (is_multisite() && backupbuddy_core::is_network_activated() && !defined('PB_DEMO_MODE')) {
// Multisite installation.
$tests[] = array('test' => 'multisite_beta', 'success' => false, 'message' => 'WARNING: BackupBuddy Multisite functionality is EXPERIMENTAL and NOT officially supported. Multiple issues are known. Usage of it is at your own risk and should not be relied upon. Standalone WordPress sites are suggested. You may use the "Export" feature to export your subsites into standalone WordPress sites. To enable experimental BackupBuddy Multisite functionality you must add the following line to your wp-config.php file: <b>define( \'PB_BACKUPBUDDY_MULTISITE_EXPERIMENT\', true );</b>');
}
// end network-activated multisite.
// LOOPBACKS TEST.
if (($loopback_response = self::loopback_test()) === true) {
$success = true;
$message = '';
} else {
// failed
$success = false;
if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON == true) {
$message = __('Running in Alternate WordPress Cron mode. HTTP Loopback Connections are not enabled on this server but you have overridden this in the wp-config.php file (this is a good thing).', 'it-l10n-backupbuddy') . ' <a href="http://ithemes.com/codex/page/BackupBuddy:_Frequent_Support_Issues#HTTP_Loopback_Connections_Disabled" target="_blank">' . __('Additional Information Here', 'it-l10n-backupbuddy') . '</a>.';
} else {
$message = __('HTTP Loopback Connections are not enabled on this server or are not functioning properly. You may encounter stalled, significantly delayed backups, or other difficulties. See details in the box below. This may be caused by a conflicting plugin such as a caching plugin.', 'it-l10n-backupbuddy') . ' <a href="http://ithemes.com/codex/page/BackupBuddy:_Frequent_Support_Issues#HTTP_Loopback_Connections_Disabled" target="_blank">' . __('Click for instructions on how to resolve this issue.', 'it-l10n-backupbuddy') . '</a>';
$message .= ' <b>Details:</b> <textarea style="height: 50px; width: 100%;">' . $loopback_response . '</textarea>';
}
}
$tests[] = array('test' => 'loopbacks', 'success' => $success, 'message' => $message);
// POSSIBLE CACHING PLUGIN CONFLICT WARNING.
$success = true;
$message = '';
$found_plugins = array();
if (!is_multisite()) {
$active_plugins = serialize(get_option('active_plugins'));
foreach (self::$warn_plugins as $warn_plugin => $warn_plugin_title) {
if (FALSE !== strpos($active_plugins, $warn_plugin)) {
// Plugin active.
$found_plugins[] = $warn_plugin_title;
$success = false;
}
}
}
if (count($found_plugins) > 0) {
$message = __('One or more caching plugins were detected as activated. Some caching plugin configurations may possibly cache & interfere with backup processes or WordPress cron. If you encounter problems clear the caching plugin\'s cache (deactivating the plugin may help) to troubleshoot.', 'it-l10n-backupbuddy') . ' ';
$message .= __('Activated caching plugins detected:', 'it-l10n-backupbuddy') . ' ';
$message .= implode(', ', $found_plugins);
$message .= '.';
}
$tests[] = array('test' => 'loopbacks', 'success' => $success, 'message' => $message);
// WORDPRESS IN SUBDIRECTORIES TEST.
$wordpress_locations = self::get_wordpress_locations();
if (count($wordpress_locations) > 0) {
$success = false;
$message = __('WordPress may have been detected in one or more subdirectories. Backing up multiple instances of WordPress may result in server timeouts due to increased backup time. You may exclude WordPress directories via the Settings page. Detected non-excluded locations:', 'it-l10n-backupbuddy') . ' ' . implode(', ', $wordpress_locations);
} else {
$success = true;
$message = '';
}
$tests[] = array('test' => 'wordpress_subdirectories', 'success' => $success, 'message' => $message);
// Log file directory writable for status logging.
$status_directory = backupbuddy_core::getLogDirectory();
if (!file_exists($status_directory)) {
if (false === pb_backupbuddy::anti_directory_browsing($status_directory, $die = false)) {
$success = false;
$message = 'The status log file directory `' . $status_directory . '` is not creatable or permissions prevent access. Verify permissions of it and/or its parent directory. Backup status information will be unavailable until this is resolved.';
}
}
if (!is_writable($status_directory)) {
$success = false;
$message = 'The status log file directory `' . $status_directory . '` is not writable. Please verify permissions before creating a backup. Backup status information will be unavailable until this is resolved.';
} else {
$success = true;
$message = '';
}
$tests[] = array('test' => 'status_directory_writable', 'success' => $success, 'message' => $message);
// CHECK ZIP AVAILABILITY.
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(backupbuddy_core::getBackupDirectory());
}
/***** BEGIN LOOKING FOR UNFINISHED RECENT BACKUPS *****/
if ('' != pb_backupbuddy::$options['last_backup_serial']) {
$lastBackupFileoptions = backupbuddy_core::getLogDirectory() . 'fileoptions/' . pb_backupbuddy::$options['last_backup_serial'] . '.txt';
if (file_exists($lastBackupFileoptions)) {
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #32.');
$backup_options = new pb_backupbuddy_fileoptions($lastBackupFileoptions, $read_only = true);
if (true !== ($result = $backup_options->is_ok()) || !isset($backup_options->options['updated_time'])) {
// NOTE: If this files during a backup it may try to read the fileoptions file too early due to the last_backup_serial being set. Suppressing errors for now.
pb_backupbuddy::status('details', 'Unable to retrieve fileoptions file (this is normal if a backup is currently in process & may be ignored) `' . backupbuddy_core::getLogDirectory() . 'fileoptions/' . pb_backupbuddy::$options['last_backup_serial'] . '.txt' . '`. Err 54478236765. Details: `' . $result . '`.');
} else {
if ($backup_options->options['updated_time'] < 180) {
// Been less than 3min since last backup.
if (!empty($backup_options->options['steps'])) {
// Look for incomplete steps.
$found_unfinished = false;
foreach ((array) $backup_options->options['steps'] as $step) {
if ($step['finish_time'] == '0') {
// Found an unfinished step.
$found_unfinished = true;
break;
}
}
// end foreach.
//.........这里部分代码省略.........
示例3: multisite_network_warning
function multisite_network_warning()
{
$message = 'BackupBuddy Multisite support is experimental beta software and is not officially supported in a Multisite setting.';
if (!backupbuddy_core::is_network_activated()) {
$message .= ' You must <a href="' . esc_url(admin_url('network/plugins.php')) . '">Network Activate</a> BackupBuddy to use it with Multisite (not activate within subsites nor the main site).';
}
if (!defined('PB_BACKUPBUDDY_MULTISITE_EXPERIMENT') || PB_BACKUPBUDDY_MULTISITE_EXPERIMENT != TRUE) {
$message .= ' You must add the following line to your wp-config.php to activate Multisite experimental functionality: <b>define( \'PB_BACKUPBUDDY_MULTISITE_EXPERIMENT\', true );</b>';
}
pb_backupbuddy::alert($message, true);
}
示例4: register_widgets
function register_widgets()
{
//wp_add_dashboard_widget( 'pb_' . self::settings( 'slug' ) . '_' . $tag, $title, array( &self::$_dashboard, $tag ) );
foreach (pb_backupbuddy::$_dashboard_widgets as $widget) {
if ($widget['capability'] == 'godmode') {
// godmode capabiltiy.
if (is_multisite() && backupbuddy_core::is_network_activated()) {
// In a network installation.
if (!current_user_can('manage_network')) {
continue;
// Skip this widget. Access denied to it.
}
} else {
// Standalone
if (!current_user_can('activate_plugins')) {
continue;
// Skip this widget. Access denied to it.
}
}
} else {
// WP capability.
if (!current_user_can($widget['capability'])) {
continue;
// Skip this widget. Access denied to it.
}
}
$widget_slug = 'pb_' . pb_backupbuddy::settings('slug') . '_' . $widget['tag'];
wp_add_dashboard_widget($widget_slug, $widget['title'], array(&$this, $widget['tag']));
// If force top is enabled then we will attempt to force the widget to the top if possible.
if (isset($widget['force_top']) && $widget['force_top'] === true) {
// Note: Only works if users have never re-arranged their dashboard widgets.
global $wp_meta_boxes;
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
$widget_backup = array($widget_slug => $normal_dashboard[$widget_slug]);
// Save copy of our widget.
unset($normal_dashboard[$widget_slug]);
// Delete our widget.
$wp_meta_boxes['dashboard']['normal']['core'] = array_merge($widget_backup, $normal_dashboard);
// Merge our widget into the top.
}
}
}