Make WordPress Core

Ticket #27626: disable-wp-check-browser-version.php

File disable-wp-check-browser-version.php, 1006 bytes (added by SergeyBiryukov, 11 years ago)
Line 
1<?php
2/*
3Plugin Name: Disable wp_check_browser_version()
4Version: 0.1
5Plugin URI: https://core.trac.wordpress.org/ticket/27626
6Description: Disables the check whether the user needs a browser update.
7Author: Sergey Biryukov
8Author URI: http://profiles.wordpress.org/sergeybiryukov/
9*/
10
11class 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
35new Disable_WP_Check_Browser_Version;
36?>