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);
}
/* Toggle this off as it's not ready for prime time just yet.
if( current_user_can( 'manage_options' ) && self::check_identity_crisis() ) {
add_action( 'admin_notices', array( $this, 'alert_identity_crisis' ) );
}
/**/
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'));
}
}