From e9d7de5d22929eb96f10e7404b67f1e6a1455157 Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Thu, 13 Aug 2015 20:43:17 +0900 Subject: [PATCH 1/8] php scripts/generate_dataset_class.php --- src/DataSet.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/DataSet.php b/src/DataSet.php index 55bc914..2cf198b 100644 --- a/src/DataSet.php +++ b/src/DataSet.php @@ -1,7 +1,7 @@ 'browser', 'vendor' => 'Microsoft', ), + 'Edge' => array( + 'label' => 'Edge', + 'name' => 'Edge', + 'type' => 'browser', + 'vendor' => 'Microsoft', + ), 'Chrome' => array( 'label' => 'Chrome', 'name' => 'Chrome', @@ -88,12 +94,24 @@ class DataSet 'type' => 'browser', 'vendor' => 'Fenrir Inc.', ), + 'Webview' => array( + 'label' => 'Webview', + 'name' => 'Webview', + 'type' => 'browser', + 'vendor' => 'OS vendor', + ), 'Win' => array( 'label' => 'Win', 'name' => 'Windows UNKNOWN Ver', 'type' => 'os', 'category' => 'pc', ), + 'Win10' => array( + 'label' => 'Win10', + 'name' => 'Windows 10', + 'type' => 'os', + 'category' => 'pc', + ), 'Win8.1' => array( 'label' => 'Win8.1', 'name' => 'Windows 8.1', @@ -238,6 +256,12 @@ class DataSet 'type' => 'os', 'category' => 'smartphone', ), + 'BlackBerry10' => array( + 'label' => 'BlackBerry10', + 'name' => 'BlackBerry 10', + 'type' => 'os', + 'category' => 'smartphone', + ), 'docomo' => array( 'label' => 'docomo', 'name' => 'docomo', @@ -508,6 +532,12 @@ class DataSet 'type' => 'full', 'category' => 'crawler', ), + 'twitter' => array( + 'label' => 'twitter', + 'name' => 'twitter', + 'type' => 'full', + 'category' => 'crawler', + ), 'mixi' => array( 'label' => 'mixi', 'name' => 'mixi', From 49b7be15c63905a718bf8f3f3491b0411843c76a Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Thu, 13 Aug 2015 20:44:34 +0900 Subject: [PATCH 2/8] Support Twitterbot --- src/AgentCategory/Crawler/Crawlers.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/AgentCategory/Crawler/Crawlers.php b/src/AgentCategory/Crawler/Crawlers.php index 46b14ea..31b1e89 100644 --- a/src/AgentCategory/Crawler/Crawlers.php +++ b/src/AgentCategory/Crawler/Crawlers.php @@ -64,6 +64,10 @@ public static function challenge($ua, &$result) } elseif (strpos($ua, 'facebookexternalhit') !== false) { static::updateMap($result, DataSet::get('facebook')); + return true; + } elseif (strpos($ua, 'Twitterbot/') !== false) { + static::updateMap($result, DataSet::get('twitter')); + return true; } elseif (strpos($ua, 'ichiro') !== false) { if (strpos($ua, 'http://help.goo.ne.jp/door/crawler.html') !== false || strpos($ua, 'compatible; ichiro/mobile goo;') !== false) { From eedea28a9bc6005e4db275659abe78bceb6442d5 Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Thu, 13 Aug 2015 20:51:49 +0900 Subject: [PATCH 3/8] Support Windows10 --- src/AgentCategory/Os/Windows.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AgentCategory/Os/Windows.php b/src/AgentCategory/Os/Windows.php index f3fc1f2..0773f2d 100644 --- a/src/AgentCategory/Os/Windows.php +++ b/src/AgentCategory/Os/Windows.php @@ -37,7 +37,9 @@ public static function challenge($ua, &$result) $version = $matches[1]; - if ($version === 'NT 6.3') { + if ($version === 'NT 10.0') { + $data = DataSet::get('Win10'); + } elseif ($version === 'NT 6.3') { $data = DataSet::get('Win8.1'); } elseif ($version === 'NT 6.2') { $data = DataSet::get('Win8'); From bd224abadb4ee0e8bacc7f95c4bfe3e761fda01b Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Thu, 13 Aug 2015 20:52:01 +0900 Subject: [PATCH 4/8] Support MS Edge --- src/AgentCategory/Browser/SafariChrome.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/AgentCategory/Browser/SafariChrome.php b/src/AgentCategory/Browser/SafariChrome.php index adb9f57..19fa704 100644 --- a/src/AgentCategory/Browser/SafariChrome.php +++ b/src/AgentCategory/Browser/SafariChrome.php @@ -15,6 +15,19 @@ public static function challenge($ua, &$result) $version = DataSet::VALUE_UNKNOWN; + $epos = strpos($ua, 'Edge'); + + if ($epos > -1) { + if (preg_match('#Edge/([.0-9]+)#', $ua, $matches)) { + $version = $matches[1]; + + static::updateMap($result, DataSet::get('Edge')); + static::updateVersion($result, $version); + + return true; + } + } + $cpos = strpos($ua, 'Chrome'); if ($cpos === false) { From ca12ea58d79bfd532613293c3b09879d403a2eed Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Thu, 13 Aug 2015 21:00:24 +0900 Subject: [PATCH 5/8] Support Webview --- src/AgentCategory/Browser/Webview.php | 31 +++++++++++++++++++++++++++ src/Classifier.php | 5 +++++ 2 files changed, 36 insertions(+) create mode 100644 src/AgentCategory/Browser/Webview.php diff --git a/src/AgentCategory/Browser/Webview.php b/src/AgentCategory/Browser/Webview.php new file mode 100644 index 0000000..b299074 --- /dev/null +++ b/src/AgentCategory/Browser/Webview.php @@ -0,0 +1,31 @@ + Date: Thu, 13 Aug 2015 21:03:10 +0900 Subject: [PATCH 6/8] Support BlackBerry10 --- src/AgentCategory/Os/SmartPhone.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/AgentCategory/Os/SmartPhone.php b/src/AgentCategory/Os/SmartPhone.php index 9ad40aa..c07436a 100644 --- a/src/AgentCategory/Os/SmartPhone.php +++ b/src/AgentCategory/Os/SmartPhone.php @@ -25,6 +25,11 @@ public static function challenge($ua, &$result) $data = DataSet::get('Android'); } elseif (strpos($ua, 'CFNetwork') !== false) { $data = DataSet::get('iOS'); + } elseif (strpos($ua, 'BB10') !== false) { + $data = DataSet::get('BlackBerry10'); + if (preg_match('#BB10(?:.+)Version/([.0-9]+)#', $ua, $matches)) { + $version = $matches[1]; + } } elseif (strpos($ua, 'BlackBerry') !== false) { $data = DataSet::get('BlackBerry'); if (preg_match('/BlackBerry(?:\\d+)\/([.0-9]+) /', $ua, $matches) === 1) { From 75b4211985e7d349215ab0d55c6b72c667e0ce4f Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Thu, 13 Aug 2015 21:10:08 +0900 Subject: [PATCH 7/8] Run Travis CI against PHP 7 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index d404b2c..20b7113 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,12 @@ php: - 5.4 - 5.5 - 5.6 + - 7 - hhvm matrix: allow_failures: + - php: 7 - php: hhvm before_script: From 09ca71335228e8f3bae18cf313523aaa2a430461 Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Thu, 13 Aug 2015 21:29:11 +0900 Subject: [PATCH 8/8] Update require-dev --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index a8706f3..f8a4b3d 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,10 @@ "php": ">= 5.3.3" }, "require-dev": { - "phpunit/phpunit": ">=4.1.0", - "satooshi/php-coveralls": ">=0.6.0", - "symfony/yaml": ">=2.4.0", - "fabpot/php-cs-fixer": ">=0.4.0" + "phpunit/phpunit": "4.8.*", + "satooshi/php-coveralls": "0.6.*", + "symfony/yaml": "2.7.*", + "fabpot/php-cs-fixer": "1.10.*" }, "autoload": { "psr-4": { "Woothee\\": "src/" }