This repository was archived by the owner on Jan 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
7.0.0 #78
Open
gabrielbull
wants to merge
20
commits into
master
Choose a base branch
from
7.0.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
7.0.0 #78
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
05958eb
!! BREAKING CHANGES !!
TomMettam 8d6b754
Fix typo in README.md
TomMettam 09eba0c
Correct regular expression in Firefox and Seamonkey:
TomMettam b19a930
Added empty change log for version 7.0.0
gabrielbull da79d83
Added boilerplate tests for srcipted agent
gabrielbull a3874b5
Fixed code style
gabrielbull 235a2a8
Issue #77 - Detection from Microsoft Edge Version returns the HTML Ve…
TomMettam 0f7bff3
Add unit test for EdgeHTML (Un-matched EdgeHTML version string)
TomMettam a88c162
Add tests for the scripted agent detection
TomMettam 242c2d7
Fix code style
TomMettam 5568a8a
Few style changes
gabrielbull ea8a4c3
Add tests for the scripted agent detection
TomMettam 301f64c
Fix code style
TomMettam 80b9c26
Few style changes
gabrielbull 910f635
Added script to fetch latests edge versions from ChangeWindows
gabrielbull d853bbc
Added wikipedia as edge versions source
gabrielbull f567a24
Fixed styling
gabrielbull 62e8556
Merge branch 'feature/edge-version' of github.com:sinergi/php-browser…
gabrielbull aa31357
Removed wikipedia crawling
gabrielbull 945fa53
Removed Edge HTML browser
gabrielbull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
/phpunit.xml.dist export-ignore | ||
/README.md export-ignore | ||
/ruleset.xml export-ignore | ||
/scripts export-ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
composer.lock | ||
phpunit.xml | ||
vendor | ||
.idea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# CHANGELOG | ||
|
||
## 7.0.0 (released 2017-xx-xx) | ||
|
||
- ... | ||
|
||
## 6.1.2 (released 2016-12-28) | ||
|
||
- Added wkhtmltopdf detection | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013-2017 Chris Schuld <[email protected]> | ||
Copyright (c) 2013-present Chris Schuld <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
<?php | ||
|
||
/** | ||
* Fetch versions from changewindows.org | ||
* © 2014-present CHANGEWINDOWS | ||
* | ||
* Disclaimer | ||
* All trademarks mentioned are the property of their respective owners. The content generated by this script | ||
* comes from changewindows.org and may not be accurate. | ||
*/ | ||
class ChangeWindows | ||
{ | ||
private static $errors = array( | ||
'could_not_fetch_version' => 'Could not fetch current version from ChangeWindows', | ||
'invalid_version' => 'Windows version is invalid', | ||
'could_not_fetch_page' => 'Could not fetch page from ChangeWindows' | ||
); | ||
|
||
public static function fetchVersions() | ||
{ | ||
$windowsVersions = json_decode(file_get_contents(__DIR__ . '/windowsVersions.json'), true); | ||
if (!count($windowsVersions)) { | ||
$currentVersion = explode('.', self::fetchCurrentVersion(), 2); | ||
if (!isset($currentVersion[0])) { | ||
throw new Exception(self::$errors['invalid_version']); | ||
} | ||
$windowsVersions = self::fetchVersion($windowsVersions, $currentVersion[0]); | ||
self::writeWindowsVersions($windowsVersions); | ||
} else { | ||
reset($windowsVersions); | ||
$firstVersion = key($windowsVersions); | ||
end($windowsVersions); | ||
$lastVersion = key($windowsVersions); | ||
|
||
try { | ||
$result = self::fetchVersion($windowsVersions, $firstVersion); | ||
$windowsVersions = $result; | ||
} catch (Exception $e) { | ||
} | ||
|
||
$windowsVersions = self::fetchVersion($windowsVersions, $lastVersion); | ||
self::writeWindowsVersions($windowsVersions); | ||
} | ||
} | ||
|
||
private static function fetchVersion($windowsVersions, $version) | ||
{ | ||
$siblingVersions = self::fetchPage($version); | ||
$windowsVersions[$version] = true; | ||
self::writeWindowsVersions($windowsVersions); | ||
|
||
if (isset($siblingVersions[0]) && !isset($windowsVersions[$siblingVersions[0]])) { | ||
$windowsVersions = self::fetchVersion($windowsVersions, $siblingVersions[0]); | ||
} | ||
|
||
if (isset($siblingVersions[1]) && !isset($windowsVersions[$siblingVersions[1]])) { | ||
$windowsVersions = self::fetchVersion($windowsVersions, $siblingVersions[1]); | ||
} | ||
|
||
return $windowsVersions; | ||
} | ||
|
||
private static function writeWindowsVersions($windowsVersions) | ||
{ | ||
ksort($windowsVersions); | ||
file_put_contents(__DIR__ . '/windowsVersions.json', json_encode($windowsVersions, JSON_PRETTY_PRINT)); | ||
} | ||
|
||
private static function fetchCurrentVersion() | ||
{ | ||
$content = file_get_contents('https://changewindows.org/filter/pc/all/current/month/true'); | ||
if (!$content) { | ||
throw new Exception(self::$errors['could_not_fetch_version']); | ||
} | ||
$content = explode('class="timeline"', $content, 2); | ||
if (!isset($content[1])) { | ||
throw new Exception(self::$errors['could_not_fetch_version']); | ||
} | ||
$content = explode('build"', $content[1], 2); | ||
if (!isset($content[1])) { | ||
throw new Exception(self::$errors['could_not_fetch_version']); | ||
} | ||
preg_match("/(\d*\.\d*)<\/div>/", $content[1], $matches); | ||
if (!isset($matches[1])) { | ||
throw new Exception(self::$errors['could_not_fetch_version']); | ||
} | ||
return $matches[1]; | ||
} | ||
|
||
private static function fetchPage($version) | ||
{ | ||
$url = "https://changewindows.org/build/{$version}/pc"; | ||
$content = file_get_contents($url); | ||
$siblingVersions = self::fetchSiblingVersions($content); | ||
self::fetchEdgeVersion($content); | ||
return $siblingVersions; | ||
} | ||
|
||
private static function fetchEdgeVersion($content) | ||
{ | ||
preg_match('/<h4[^>]*> *Edge ([\d\.]*) *<\/h4>/', $content, $edge); | ||
preg_match('/<h4[^>]*>EdgeHTML ([\d\.]*)<\/h4>/', $content, $edgeHtml); | ||
|
||
if (isset($edge[1]) && isset($edgeHtml[1])) { | ||
self::writeEdgeVersion($edgeHtml[1], $edge[1]); | ||
} | ||
return null; | ||
} | ||
|
||
private static function writeEdgeVersion($edgeHtml, $edge) | ||
{ | ||
$file = __DIR__ . '/../../src/edgeVersionMap.php'; | ||
$currentVersions = require $file; | ||
if (!isset($currentVersions[$edgeHtml])) { | ||
$currentVersions[$edgeHtml] = $edge; | ||
ksort($currentVersions); | ||
$content = ''; | ||
foreach ($currentVersions as $edgeHtml => $edge) { | ||
$content .= " '{$edgeHtml}' => '{$edge}'," . PHP_EOL; | ||
} | ||
$data = <<<PHP | ||
<?php | ||
|
||
return array( | ||
%s | ||
); | ||
|
||
PHP; | ||
file_put_contents($file, sprintf($data, trim($content))); | ||
} | ||
} | ||
|
||
private static function fetchSiblingVersions($content) | ||
{ | ||
if (!$content) { | ||
throw new Exception(self::$errors['could_not_fetch_page']); | ||
} | ||
$content = explode('build-sidebar', $content, 2); | ||
if (!isset($content[1])) { | ||
throw new Exception(self::$errors['could_not_fetch_page']); | ||
} | ||
$content = explode('fa-angle-left', $content[1]); | ||
if (!isset($content[1])) { | ||
throw new Exception(self::$errors['could_not_fetch_page']); | ||
} | ||
$content = explode('fa-angle-right', $content[1]); | ||
if (!isset($content[0])) { | ||
throw new Exception(self::$errors['could_not_fetch_page']); | ||
} | ||
preg_match_all("/> *(\d+) *</", $content[0], $matches); | ||
if (!isset($matches[1])) { | ||
throw new Exception(self::$errors['could_not_fetch_page']); | ||
} | ||
return $matches[1]; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/ChangeWindows.php'; | ||
ChangeWindows::fetchVersions(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"15002": true, | ||
"15007": true, | ||
"15009": true, | ||
"15014": true, | ||
"15019": true, | ||
"15023": true, | ||
"15025": true, | ||
"15026": true, | ||
"15031": true, | ||
"15034": true, | ||
"15038": true, | ||
"15039": true, | ||
"15042": true, | ||
"15043": true, | ||
"15045": true, | ||
"15046": true, | ||
"15047": true, | ||
"15048": true, | ||
"15049": true, | ||
"15051": true, | ||
"15055": true, | ||
"15058": true, | ||
"15060": true, | ||
"15061": true, | ||
"15062": true, | ||
"15063": true, | ||
"15204": true, | ||
"15205": true, | ||
"16170": true, | ||
"16176": true, | ||
"16179": true | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add changelog