WordPress.org

Making WordPress.org

Changeset 6021


Ignore:
Timestamp:
10/11/2017 06:46:15 PM (9 months ago)
Author:
coffee2code
Message:

Browse Happy API: Add support for Chromium.

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

    r6020 r6021  
    4242    // Identify platform/OS in user-agent string.
    4343    if ( preg_match(
    44         '/^.+?(?P<platform>Windows Phone( OS)?|Symbian|SymbOS|Android|iPhone|iPad|Windows|Linux|Macintosh|FreeBSD|OpenBSD|SunOS|RIM Tablet OS|PlayBook)(?: (NT|zvav))*(?: [ix]?[0-9._]+(\-[0-9a-z\.\-]+)?)*(;|\))/im',
     44        '/^.+?(?P<platform>Windows Phone( OS)?|Symbian|SymbOS|Android|iPhone|iPad|Windows|Linux|Macintosh|FreeBSD|OpenBSD|SunOS|RIM Tablet OS|PlayBook)(?: (NT|amd64|armv7l|zvav))*(?: [ix]?[0-9._]+(\-[0-9a-z\.\-]+)?)*(;|\))/im',
    4545        $user_agent,
    4646        $regs
     
    5151    // Find tokens of interest in user-agent string.
    5252    preg_match_all(
    53         '%(?P<name>Opera Mini|Opera|OPR|Edge|UCBrowser|UCWEB|QQBrowser|SymbianOS|Symbian|S40OviBrowser|Trident|Silk|Konqueror|PaleMoon|Puffin|SeaMonkey|Vivaldi|Camino|Kindle|Firefox|SamsungBrowser|(?:Mobile )?Safari|NokiaBrowser|MSIE|RockMelt|AppleWebKit|Chrome|IEMobile|Version)(?:[/ ])(?P<version>[0-9.]+)%im',
     53        '%(?P<name>Opera Mini|Opera|OPR|Edge|UCBrowser|UCWEB|QQBrowser|SymbianOS|Symbian|S40OviBrowser|Trident|Silk|Konqueror|PaleMoon|Puffin|SeaMonkey|Vivaldi|Camino|Chromium|Kindle|Firefox|SamsungBrowser|(?:Mobile )?Safari|NokiaBrowser|MSIE|RockMelt|AppleWebKit|Chrome|IEMobile|Version)(?:[/ ])(?P<version>[0-9.]+)%im',
    5454        $user_agent,
    5555        $result,
     
    165165    elseif ( false !== ( $key = array_search( 'SamsungBrowser', $result['name'] ) ) ) {
    166166        $data['name']     = 'Samsung Browser';
     167        $data['version']  = $result['version'][ $key ];
     168    }
     169    // Chromium
     170    elseif ( false !== ( $key = array_search( 'Chromium', $result['name'] ) ) ) {
     171        $data['name']     = 'Chromium';
    167172        $data['version']  = $result['version'][ $key ];
    168173    }
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/tests/phpunit/tests/browse-happy.php

    r6020 r6021  
    173173            ],
    174174
     175            // Chromium
     176
     177            [
     178                'Mozilla/5.0 (Linux; Ubuntu 14.04 like Android 4.4) AppleWebKit/537.36 Chromium/35.0.1870.2 Mobile Safari/537.36',
     179                'Android Chromium 35.0.1870.2',
     180            ],
     181            [
     182                'Mozilla/5.0 (Linux; Ubuntu 15.04 like Android 4.4) AppleWebKit/537.36 Chromium/55.0.2883.75 Mobile Safari/537.36',
     183                'Android Chromium 55.0.2883.75',
     184            ],
     185            [
     186                'Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/57.0.2987.110 Safari/537.36',
     187                'FreeBSD Chromium 57.0.2987.110',
     188            ],
     189            [
     190                'Mozilla/5.0 (iPhone; U; en-us; CPU OS 3_0 like Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.37 Chromium/57.0.2987.133',
     191                'iPhone Chromium 57.0.2987.133',
     192            ],
     193            [
     194                'Mozilla/5.0 (SMART-TV; X11; Linux armv7l) AppleWebKit/537.42 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.42',
     195                'Linux Chromium 25.0.1349.2',
     196            ],
     197            [
     198                'Mozilla/5.0 (Linux; Ubuntu 14.04) AppleWebKit/537.36 Chromium/35.0.1870.2 Safari/537.36',
     199                'Linux Chromium 35.0.1870.2',
     200            ],
     201            [
     202                'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36',
     203                'Linux Chromium 58.0.3029.110',
     204            ],
     205            [
     206                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/61.0.3163.79 Chrome/61.0.3163.79 Safari/537.36',
     207                'Macintosh Chromium 61.0.3163.79',
     208            ],
     209            [
     210                'LiveSlides/1.6.12.0 Office/16.0 (Microsoft Windows 10 Home 6.2.9200.0) CefSharp/43.0.0.0 Cef/r3.2357.1287.g861c26e Chromium/43.0.2357.130',
     211                'Chromium 43.0.2357.130',
     212            ],
     213            [
     214                'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/41.0.2228.0 Chrome/41.0.2228.0 Safari/537.36',
     215                'Windows Chromium 41.0.2228.0',
     216            ],
     217
    175218            // Firefox
    176219
Note: See TracChangeset for help on using the changeset viewer.