Changeset 5988
- Timestamp:
- 10/02/2017 07:39:32 PM (6 years ago)
- 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
r5986 r5988 38 38 'mobile' => false, 39 39 ); 40 $mobile_device = ''; 40 41 41 42 if ( preg_match( … … 54 55 $data['platform'] = 'Android'; 55 56 } 56 } elseif ( 'Windows Phone' === $data['platform'] ) { 57 } 58 // Normalize Windows Phone OS name when "OS" is omitted. 59 elseif ( 'Windows Phone' === $data['platform'] ) { 57 60 $data['platform'] = 'Windows Phone OS'; 58 61 } 59 60 if ( in_array( $data['platform'], array( 'Android', 'Fire OS', 'iPad', 'iPhone', 'PlayBook', 'RIM Tablet OS', 'Windows Phone OS' ) ) ) { 62 // Generically detect some mobile devices. 63 elseif ( 64 ! $data['platform'] 65 && 66 preg_match( '/BlackBerry|Nokia|SonyEricsson/', $user_agent, $matches ) 67 ) { 68 $data['platform'] = 'Mobile'; 69 $mobile_device = $matches[0]; 70 } 71 72 // Flag known mobile platforms as mobile. 73 if ( in_array( $data['platform'], array( 'Android', 'Fire OS', 'iPad', 'iPhone', 'Mobile', 'PlayBook', 'RIM Tablet OS', 'Windows Phone OS' ) ) ) { 61 74 $data['mobile'] = true; 62 75 } … … 146 159 $data['name'] = 'unknown'; 147 160 $result['version'][ $key ] = ''; 161 $version = ''; 148 162 } 149 163 $data['version'] = $result['version'][ $key ]; -
sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/tests/phpunit/tests/browse-happy.php
r5986 r5988 516 516 ], 517 517 [ 518 'BlackBerry; U; Blackberry 9900; en', 519 'Mobile unknown', 520 ], 521 [ 522 'BlackBerry8520/5.0.0.592 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/168', 523 'Mobile unknown', 524 ], 525 [ 518 526 'Nokia-MIT-Browser/3.0', 519 'unknown', // It's really a Nokia Browser, but not critical to recognize as such. 527 'Mobile unknown', // It's really a Nokia Browser, but not critical to recognize as such. 528 ], 529 [ 530 'SonyEricssonW995a/R1GB Browser/NetFront/3.4 Profile/MIDP-2.1 Configuration/CLDC-1.1 JavaPlatform/JP-8.4.4', 531 'Mobile unknown', 520 532 ], 521 533
Note: See TracChangeset
for help on using the changeset viewer.