1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
<?php
/**
* Device Detector - The Universal Device Detection library for parsing User Agents
*
* @link https://matomo.org
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/
declare(strict_types=1);
use DeviceDetector\Parser\Client\Browser;
use DeviceDetector\Parser\Client\Browser\Engine;
use DeviceDetector\Parser\Client\FeedReader;
use DeviceDetector\Parser\Client\Library;
use DeviceDetector\Parser\Client\MediaPlayer;
use DeviceDetector\Parser\Client\MobileApp;
use DeviceDetector\Parser\Client\PIM;
use DeviceDetector\Parser\Device\AbstractDeviceParser;
use DeviceDetector\Parser\OperatingSystem;
include __DIR__ . '/../vendor/autoload.php';
$brands = AbstractDeviceParser::$deviceBrands;
natcasesort($brands);
$bots = [];
$ymlParser = new Spyc();
$parsedBots = $ymlParser->loadFile(__DIR__ . '/../regexes/bots.yml');
foreach ($parsedBots as $parsedBot) {
if (in_array($parsedBot['name'], $bots, true)) {
continue;
}
$bots[] = $parsedBot['name'];
}
natcasesort($bots);
$detections = '## What Device Detector is able to detect
The lists below are auto generated and updated from time to time. Some of them might not be complete.
*Last update: ' . date('Y/m/d') . '*
### List of detected operating systems:
' . implode(', ', OperatingSystem::getAvailableOperatingSystems()) . '
### List of detected browsers:
' . implode(', ', Browser::getAvailableBrowsers()) . '
### List of detected browser engines:
' . implode(', ', Engine::getAvailableEngines()) . '
### List of detected libraries:
' . implode(', ', Library::getAvailableClients()) . '
### List of detected media players:
' . implode(', ', MediaPlayer::getAvailableClients()) . '
### List of detected mobile apps:
' . implode(', ', MobileApp::getAvailableClients()) .
' and *mobile apps using [AFNetworking](https://github.com/AFNetworking/AFNetworking)' .
' or [Electron](https://github.com/electron/electron)*
### List of detected PIMs (personal information manager):
' . implode(', ', PIM::getAvailableClients()) . '
### List of detected feed readers:
' . implode(', ', FeedReader::getAvailableClients()) . '
### List of brands with detected devices:
' . implode(', ', $brands) . '
### List of detected bots:
' . implode(', ', $bots) . "\n";
$file = __DIR__ . '/../README.md';
$readme = file_get_contents($file);
$readme = substr($readme, 0, strpos($readme, '## What Device Detector is able to detect'));
$readme .= $detections;
file_put_contents($file, $readme);
|