1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Disable wp_check_browser_version() |
---|
4 | Version: 0.1 |
---|
5 | Plugin URI: https://core.trac.wordpress.org/ticket/27626 |
---|
6 | Description: Disables the check whether the user needs a browser update. |
---|
7 | Author: Sergey Biryukov |
---|
8 | Author URI: http://profiles.wordpress.org/sergeybiryukov/ |
---|
9 | */ |
---|
10 | |
---|
11 | class Disable_WP_Check_Browser_Version { |
---|
12 | |
---|
13 | var $user_agent = ''; |
---|
14 | |
---|
15 | function __construct() { |
---|
16 | add_action( 'load-index.php', array( $this, 'clear_user_agent' ) ); |
---|
17 | |
---|
18 | add_action( 'wp_dashboard_setup', array( $this, 'restore_user_agent' ) ); |
---|
19 | add_action( 'wp_user_dashboard_setup', array( $this, 'restore_user_agent' ) ); |
---|
20 | add_action( 'wp_network_dashboard_setup', array( $this, 'restore_user_agent' ) ); |
---|
21 | } |
---|
22 | |
---|
23 | function clear_user_agent() { |
---|
24 | $this->user_agent = $_SERVER['HTTP_USER_AGENT']; |
---|
25 | |
---|
26 | $_SERVER['HTTP_USER_AGENT'] = ''; |
---|
27 | } |
---|
28 | |
---|
29 | function restore_user_agent() { |
---|
30 | $_SERVER['HTTP_USER_AGENT'] = $this->user_agent; |
---|
31 | } |
---|
32 | |
---|
33 | } |
---|
34 | |
---|
35 | new Disable_WP_Check_Browser_Version; |
---|
36 | ?> |
---|