function admin_init()
{
// If the plugin is not connected, display a connect message.
if (Jetpack_Options::get_option('do_activate') || !Jetpack_Options::get_option('activated')) {
Jetpack::plugin_initialize();
}
if (!Jetpack::is_active() && !Jetpack::is_development_mode()) {
if (4 != Jetpack_Options::get_option('activated')) {
// Show connect notice on dashboard and plugins pages
add_action('load-index.php', array($this, 'prepare_connect_notice'));
add_action('load-plugins.php', array($this, 'prepare_connect_notice'));
}
} elseif (false === Jetpack_Options::get_option('fallback_no_verify_ssl_certs')) {
// Upgrade: 1.1 -> 1.1.1
// Check and see if host can verify the Jetpack servers' SSL certificate
$args = array();
Jetpack_Client::_wp_remote_request(Jetpack::fix_url_for_bad_hosts(Jetpack::api_url('test')), $args, true);
} else {
// Show the notice on the Dashboard only for now
add_action('load-index.php', array($this, 'prepare_manage_jetpack_notice'));
// Identity crisis notices
add_action('jetpack_notices', array($this, 'alert_identity_crisis'));
}
// If the plugin has just been disconnected from WP.com, show the survey notice
if (isset($_GET['disconnected']) && 'true' === $_GET['disconnected']) {
add_action('jetpack_notices', array($this, 'disconnect_survey_notice'));
}
if (current_user_can('manage_options') && 'ALWAYS' == JETPACK_CLIENT__HTTPS && !self::permit_ssl()) {
add_action('admin_notices', array($this, 'alert_required_ssl_fail'));
}
add_action('load-plugins.php', array($this, 'intercept_plugin_error_scrape_init'));
add_action('admin_enqueue_scripts', array($this, 'admin_menu_css'));
add_filter('plugin_action_links_' . plugin_basename(JETPACK__PLUGIN_DIR . 'jetpack.php'), array($this, 'plugin_action_links'));
if (Jetpack::is_active() || Jetpack::is_development_mode()) {
// Artificially throw errors in certain whitelisted cases during plugin activation
add_action('activate_plugin', array($this, 'throw_error_on_activate_plugin'));
// Kick off synchronization of user role when it changes
add_action('set_user_role', array($this, 'user_role_change'));
}
// Jetpack Manage Activation Screen from .com
Jetpack::module_configuration_activation_screen('manage', array($this, 'manage_activate_screen'));
}