WordPress.org

Making WordPress.org

Changeset 5991


Ignore:
Timestamp:
10/02/2017 07:47:55 PM (22 months ago)
Author:
coffee2code
Message:

Browse Happy API: Add support for UC Browser.

Location:
sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/parse.php

    r5989 r5991  
    7676
    7777    preg_match_all(
    78         '%(?P<name>Opera Mini|Opera|OPR|Edge|Trident|Silk|Camino|Kindle|Firefox|(?:Mobile )?Safari|NokiaBrowser|MSIE|RockMelt|AppleWebKit|Chrome|IEMobile|Version)(?:[/ ])(?P<version>[0-9.]+)%im',
     78        '%(?P<name>Opera Mini|Opera|OPR|Edge|UCBrowser|UCWEB|Trident|Silk|Camino|Kindle|Firefox|(?:Mobile )?Safari|NokiaBrowser|MSIE|RockMelt|AppleWebKit|Chrome|IEMobile|Version)(?:[/ ])(?P<version>[0-9.]+)%im',
    7979        $user_agent,
    8080        $result,
     
    112112        }
    113113        $data['version'] = $result['version'][ $key ];
     114    }
     115    // UC Browser
     116    elseif (
     117        false !== ( $key = array_search( 'UCBrowser', $result['name'] ) )
     118    ||
     119        false !== ( $key = array_search( 'UCWEB', $result['name'] ) )
     120    ) {
     121        $data['name']     = 'UC Browser';
     122        $data['version']  = $result['version'][ $key ];
     123        $version          = '';
    114124    }
    115125    // Nokia Browser
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/tests/phpunit/tests/browse-happy.php

    r5989 r5991  
    509509            ],
    510510
     511            // UC Browser
     512
     513            [
     514                'Mozilla/5.0 (Linux; U; Android 4.4.2; id; SM-G900 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/9.9.2.467 U3/0.8.0 Mobile Safari/534.30 evaliant',
     515                'Android UC Browser 9.9.2.467',
     516            ],
     517            [
     518                'Mozilla/5.0 (Linux; U; Android 4.2.2; en-US; Micromax A102 Build/MicromaxA102) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/11.1.0.882 U3/0.8.0 Mobile Safari/534.30',
     519                'Android UC Browser 11.1.0.882',
     520            ],
     521            [
     522                'UCWEB/8.8 (iPhone; CPU OS_6; en-US)AppleWebKit/534.1 U3/3.0.0 Mobile',
     523                'iPhone UC Browser 8.8',
     524            ],
     525            [
     526                'UCWEB/2.0 (Java; U; MIDP-2.0; Nokia203/20.37) U2/1.0.0 UCBrowser/8.7.0.218 U2/1.0.0 Mobile',
     527                'Mobile UC Browser 8.7.0.218',
     528            ],
     529            [
     530                'Nokia5200/2.0 (05.00) Profile/MIDP-2.0 Configuration/CLDC-1.1 UCWEB/2.0 (Java; U; MIDP-2.0; id; Nokia5200) U2/1.0.0 UCBrowser/9.5.0.449 U2/1.0.0 Mobile',
     531                'Mobile UC Browser 9.5.0.449',
     532            ],
     533            [
     534                'Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop) like Gecko UCBrowser/4.2.1.541',
     535                'Windows UC Browser 4.2.1.541',
     536            ],
     537
    511538            // Miscellaneous
    512539
Note: See TracChangeset for help on using the changeset viewer.