本文整理匯總了PHP中BackWPup_Admin::get_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP BackWPup_Admin::get_instance方法的具體用法?PHP BackWPup_Admin::get_instance怎麽用?PHP BackWPup_Admin::get_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BackWPup_Admin
的用法示例。
在下文中一共展示了BackWPup_Admin::get_instance方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: __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');
}
}