WordPress.org

Making WordPress.org

Changeset 6020


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

Browse Happy API: Add support for Puffin.

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

    r6019 r6020  
    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|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|Kindle|Firefox|SamsungBrowser|(?:Mobile )?Safari|NokiaBrowser|MSIE|RockMelt|AppleWebKit|Chrome|IEMobile|Version)(?:[/ ])(?P<version>[0-9.]+)%im',
    5454        $user_agent,
    5555        $result,
     
    180180        $data['name']     = 'Pale Moon';
    181181        $data['version']  = $result['version'][ $key ];
     182    }
     183    // Puffin
     184    elseif ( false !== ( $key = array_search( 'Puffin', $result['name'] ) ) ) {
     185        $data['name']     = 'Puffin';
     186        $data['version']  = $result['version'][ $key ];
     187        $version          = '';
     188        // If not an already-identified mobile platform, set it as such.
     189        if ( ! $data['mobile'] ) {
     190            $data['mobile']   = true;
     191            $data['platform'] = '';
     192        }
    182193    }
    183194    // SeaMonkey
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/tests/phpunit/tests/browse-happy.php

    r6019 r6020  
    523523            ],
    524524
     525            // Puffin
     526
     527            [
     528                'Mozilla/5.0 (Linux; Android 4.4.2; BLOOM Build/KOT49H; it-it) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Puffin/6.1.3.1599AP',
     529                'Android Puffin 6.1.3.1599',
     530            ],
     531            [
     532                'Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X; en-CA) AppleWebKit/537.36 (KHTML, like Gecko) Version/9.3.5 Mobile/13G36 Safari/537.36 Puffin/5.2.0IT Chrome/55.0.2623',
     533                'iPad Puffin 5.2.0',
     534            ],
     535            [
     536                'Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36 Puffin/4.8.0.2965AP',
     537                'Mobile Puffin 4.8.0.2965',
     538            ],
     539
    525540            // QQ Browser
    526541
Note: See TracChangeset for help on using the changeset viewer.