WordPress.org

Make WordPress Core

Ticket #20923: 20923.diff

File 20923.diff, 666 bytes (added by georgestephanis, 6 years ago)
  • wp-includes/functions.php

     
    36853685        if ( ! wp_is_mobile() )
    36863686                return true;
    36873687
    3688         $ua = $_SERVER['HTTP_USER_AGENT'];
     3688        $regex = '#(iPod|iPad|iPhone); U; CPU( iPhone)? OS ([\d_]+) like Mac OS X#';
    36893689
    3690         if ( strpos($ua, 'iPhone') !== false
    3691                 || strpos($ua, 'iPad') !== false
    3692                 || strpos($ua, 'iPod') !== false ) {
    3693                         return false;
    3694         } else {
    3695                 return true;
    3696         }
     3690        return ( preg_match( $regex, $_SERVER['HTTP_USER_AGENT'], $version ) && version_compare( '6', $version[3], '<=' ) );
    36973691}
    36983692