static function init()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Jetpack_Connection_Banner();
     }
     return self::$instance;
 }
示例#2
0
 function admin_init()
 {
     // If the plugin is not connected, display a connect message.
     if (Jetpack_Options::get_option_and_ensure_autoload('do_activate', '0') || !Jetpack_Options::get_option('activated')) {
         Jetpack::plugin_initialize();
     }
     if (!Jetpack::is_active() && !Jetpack::is_development_mode()) {
         Jetpack_Connection_Banner::init();
     } 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 {
         if ($this->can_display_jetpack_manage_notice() && !Jetpack_Options::get_option('dismissed_manage_banner')) {
             // Show the notice on the Dashboard only for now
             add_action('load-index.php', array($this, 'prepare_manage_jetpack_notice'));
         }
     }
     if (current_user_can('manage_options') && 'AUTO' == JETPACK_CLIENT__HTTPS && !self::permit_ssl()) {
         add_action('jetpack_notices', array($this, 'alert_auto_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'));
     }
     // Jetpack Manage Activation Screen from .com
     Jetpack::module_configuration_activation_screen('manage', array($this, 'manage_activate_screen'));
     // Add custom column in wp-admin/users.php to show whether user is linked.
     add_filter('manage_users_columns', array($this, 'jetpack_icon_user_connected'));
     add_action('manage_users_custom_column', array($this, 'jetpack_show_user_connected_icon'), 10, 3);
     add_action('admin_print_styles', array($this, 'jetpack_user_col_style'));
 }
 function test_get_random_connection_banner_value_if_not_set()
 {
     Jetpack_Options::delete_option('connection_banner_ab');
     $this->assertNotEquals(false, Jetpack_Connection_Banner::get_random_connection_banner_value());
     $this->assertNotEquals(false, Jetpack_Options::get_option('connection_banner_ab'));
 }