File manager - Edit - /home/autoph/public_html/projects/Rating-AutoHub/public/css/jenssegers.tar
Back
agent/LICENSE.md 0000644 00000002054 15025020026 0007237 0 ustar 00 MIT License Copyright (c) 2020 Jens Segers 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 the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. agent/composer.json 0000644 00000002316 15025020026 0010356 0 ustar 00 { "name": "jenssegers/agent", "description": "Desktop/mobile user agent parser with support for Laravel, based on Mobiledetect", "keywords": ["laravel", "useragent", "agent", "user agent", "browser", "platform", "mobile", "desktop"], "homepage": "https://github.com/jenssegers/agent", "license" : "MIT", "authors": [ { "name": "Jens Segers", "homepage": "https://jenssegers.com" } ], "require": { "php": ">=5.6", "mobiledetect/mobiledetectlib": "^2.7.6", "jaybizzle/crawler-detect": "^1.2" }, "require-dev": { "phpunit/phpunit": "^5.0|^6.0|^7.0", "php-coveralls/php-coveralls": "^2.1" }, "autoload": { "psr-4": { "Jenssegers\\Agent\\": "src/" } }, "extra": { "branch-alias": { "dev-master": "3.0-dev" }, "laravel": { "providers": [ "Jenssegers\\Agent\\AgentServiceProvider" ], "aliases": { "Agent": "Jenssegers\\Agent\\Facades\\Agent" } } }, "suggest": { "illuminate/support": "Required for laravel service providers" } } agent/src/Facades/Agent.php 0000644 00000000447 15025020026 0011523 0 ustar 00 <?php namespace Jenssegers\Agent\Facades; use Illuminate\Support\Facades\Facade; class Agent extends Facade { /** * Get the registered name of the component. * * @return string */ protected static function getFacadeAccessor() { return 'agent'; } } agent/src/AgentServiceProvider.php 0000644 00000001307 15025020026 0013225 0 ustar 00 <?php namespace Jenssegers\Agent; use Illuminate\Support\ServiceProvider; class AgentServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = true; /** * Register the service provider. */ public function register() { $this->app->singleton('agent', function ($app) { return new Agent($app['request']->server()); }); $this->app->alias('agent', Agent::class); } /** * Get the services provided by the provider. * * @return array */ public function provides() { return ['agent', Agent::class]; } } agent/src/Agent.php 0000644 00000025622 15025020026 0010177 0 ustar 00 <?php namespace Jenssegers\Agent; use BadMethodCallException; use Jaybizzle\CrawlerDetect\CrawlerDetect; use Mobile_Detect; class Agent extends Mobile_Detect { /** * List of desktop devices. * @var array */ protected static $desktopDevices = [ 'Macintosh' => 'Macintosh', ]; /** * List of additional operating systems. * @var array */ protected static $additionalOperatingSystems = [ 'Windows' => 'Windows', 'Windows NT' => 'Windows NT', 'OS X' => 'Mac OS X', 'Debian' => 'Debian', 'Ubuntu' => 'Ubuntu', 'Macintosh' => 'PPC', 'OpenBSD' => 'OpenBSD', 'Linux' => 'Linux', 'ChromeOS' => 'CrOS', ]; /** * List of additional browsers. * @var array */ protected static $additionalBrowsers = [ 'Opera Mini' => 'Opera Mini', 'Opera' => 'Opera|OPR', 'Edge' => 'Edge|Edg', 'Coc Coc' => 'coc_coc_browser', 'UCBrowser' => 'UCBrowser', 'Vivaldi' => 'Vivaldi', 'Chrome' => 'Chrome', 'Firefox' => 'Firefox', 'Safari' => 'Safari', 'IE' => 'MSIE|IEMobile|MSIEMobile|Trident/[.0-9]+', 'Netscape' => 'Netscape', 'Mozilla' => 'Mozilla', ]; /** * List of additional properties. * @var array */ protected static $additionalProperties = [ // Operating systems 'Windows' => 'Windows NT [VER]', 'Windows NT' => 'Windows NT [VER]', 'OS X' => 'OS X [VER]', 'BlackBerryOS' => ['BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'], 'AndroidOS' => 'Android [VER]', 'ChromeOS' => 'CrOS x86_64 [VER]', // Browsers 'Opera Mini' => 'Opera Mini/[VER]', 'Opera' => [' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]', 'Opera [VER]'], 'Netscape' => 'Netscape/[VER]', 'Mozilla' => 'rv:[VER]', 'IE' => ['IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];', 'rv:[VER]'], 'Edge' => ['Edge/[VER]', 'Edg/[VER]'], 'Vivaldi' => 'Vivaldi/[VER]', 'Coc Coc' => 'coc_coc_browser/[VER]', ]; /** * @var CrawlerDetect */ protected static $crawlerDetect; /** * Get all detection rules. These rules include the additional * platforms and browsers and utilities. * @return array */ public static function getDetectionRulesExtended() { static $rules; if (!$rules) { $rules = static::mergeRules( static::$desktopDevices, // NEW static::$phoneDevices, static::$tabletDevices, static::$operatingSystems, static::$additionalOperatingSystems, // NEW static::$browsers, static::$additionalBrowsers, // NEW static::$utilities ); } return $rules; } public function getRules() { if ($this->detectionType === static::DETECTION_TYPE_EXTENDED) { return static::getDetectionRulesExtended(); } return static::getMobileDetectionRules(); } /** * @return CrawlerDetect */ public function getCrawlerDetect() { if (static::$crawlerDetect === null) { static::$crawlerDetect = new CrawlerDetect(); } return static::$crawlerDetect; } public static function getBrowsers() { return static::mergeRules( static::$additionalBrowsers, static::$browsers ); } public static function getOperatingSystems() { return static::mergeRules( static::$operatingSystems, static::$additionalOperatingSystems ); } public static function getPlatforms() { return static::mergeRules( static::$operatingSystems, static::$additionalOperatingSystems ); } public static function getDesktopDevices() { return static::$desktopDevices; } public static function getProperties() { return static::mergeRules( static::$additionalProperties, static::$properties ); } /** * Get accept languages. * @param string $acceptLanguage * @return array */ public function languages($acceptLanguage = null) { if ($acceptLanguage === null) { $acceptLanguage = $this->getHttpHeader('HTTP_ACCEPT_LANGUAGE'); } if (!$acceptLanguage) { return []; } $languages = []; // Parse accept language string. foreach (explode(',', $acceptLanguage) as $piece) { $parts = explode(';', $piece); $language = strtolower($parts[0]); $priority = empty($parts[1]) ? 1. : floatval(str_replace('q=', '', $parts[1])); $languages[$language] = $priority; } // Sort languages by priority. arsort($languages); return array_keys($languages); } /** * Match a detection rule and return the matched key. * @param array $rules * @param string|null $userAgent * @return string|bool */ protected function findDetectionRulesAgainstUA(array $rules, $userAgent = null) { // Loop given rules foreach ($rules as $key => $regex) { if (empty($regex)) { continue; } // Check match if ($this->match($regex, $userAgent)) { return $key ?: reset($this->matchesArray); } } return false; } /** * Get the browser name. * @param string|null $userAgent * @return string|bool */ public function browser($userAgent = null) { return $this->findDetectionRulesAgainstUA(static::getBrowsers(), $userAgent); } /** * Get the platform name. * @param string|null $userAgent * @return string|bool */ public function platform($userAgent = null) { return $this->findDetectionRulesAgainstUA(static::getPlatforms(), $userAgent); } /** * Get the device name. * @param string|null $userAgent * @return string|bool */ public function device($userAgent = null) { $rules = static::mergeRules( static::getDesktopDevices(), static::getPhoneDevices(), static::getTabletDevices(), static::getUtilities() ); return $this->findDetectionRulesAgainstUA($rules, $userAgent); } /** * Check if the device is a desktop computer. * @param string|null $userAgent deprecated * @param array $httpHeaders deprecated * @return bool */ public function isDesktop($userAgent = null, $httpHeaders = null) { return !$this->isMobile($userAgent, $httpHeaders) && !$this->isTablet($userAgent, $httpHeaders) && !$this->isRobot($userAgent); } /** * Check if the device is a mobile phone. * @param string|null $userAgent deprecated * @param array $httpHeaders deprecated * @return bool */ public function isPhone($userAgent = null, $httpHeaders = null) { return $this->isMobile($userAgent, $httpHeaders) && !$this->isTablet($userAgent, $httpHeaders); } /** * Get the robot name. * @param string|null $userAgent * @return string|bool */ public function robot($userAgent = null) { if ($this->getCrawlerDetect()->isCrawler($userAgent ?: $this->userAgent)) { return ucfirst($this->getCrawlerDetect()->getMatches()); } return false; } /** * Check if device is a robot. * @param string|null $userAgent * @return bool */ public function isRobot($userAgent = null) { return $this->getCrawlerDetect()->isCrawler($userAgent ?: $this->userAgent); } /** * Get the device type * @param null $userAgent * @param null $httpHeaders * @return string */ public function deviceType($userAgent = null, $httpHeaders = null) { if ($this->isDesktop($userAgent, $httpHeaders)) { return "desktop"; } elseif ($this->isPhone($userAgent, $httpHeaders)) { return "phone"; } elseif ($this->isTablet($userAgent, $httpHeaders)) { return "tablet"; } elseif ($this->isRobot($userAgent)) { return "robot"; } return "other"; } public function version($propertyName, $type = self::VERSION_TYPE_STRING) { if (empty($propertyName)) { return false; } // set the $type to the default if we don't recognize the type if ($type !== self::VERSION_TYPE_STRING && $type !== self::VERSION_TYPE_FLOAT) { $type = self::VERSION_TYPE_STRING; } $properties = self::getProperties(); // Check if the property exists in the properties array. if (true === isset($properties[$propertyName])) { // Prepare the pattern to be matched. // Make sure we always deal with an array (string is converted). $properties[$propertyName] = (array) $properties[$propertyName]; foreach ($properties[$propertyName] as $propertyMatchString) { if (is_array($propertyMatchString)) { $propertyMatchString = implode("|", $propertyMatchString); } $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); // Identify and extract the version. preg_match(sprintf('#%s#is', $propertyPattern), $this->userAgent, $match); if (false === empty($match[1])) { $version = ($type === self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1]); return $version; } } } return false; } /** * Merge multiple rules into one array. * @param array $all * @return array */ protected static function mergeRules(...$all) { $merged = []; foreach ($all as $rules) { foreach ($rules as $key => $value) { if (empty($merged[$key])) { $merged[$key] = $value; } elseif (is_array($merged[$key])) { $merged[$key][] = $value; } else { $merged[$key] .= '|' . $value; } } } return $merged; } /** * @inheritdoc */ public function __call($name, $arguments) { // Make sure the name starts with 'is', otherwise if (strpos($name, 'is') !== 0) { throw new BadMethodCallException("No such method exists: $name"); } $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); $key = substr($name, 2); return $this->matchUAAgainstKey($key); } } agent/README.md 0000644 00000010177 15025020026 0007117 0 ustar 00 Agent ===== [](https://packagist.org/packages/jenssegers/agent) [](https://packagist.org/packages/jenssegers/agent) [](https://travis-ci.org/jenssegers/agent) [](https://coveralls.io/r/jenssegers/agent) [](https://www.paypal.me/jenssegers) A PHP desktop/mobile user agent parser with support for Laravel, based on [Mobile Detect](https://github.com/serbanghita/Mobile-Detect) with desktop support and additional functionality. <p align="center"> <img src="https://jenssegers.com/static/media/agent.png" height="275"> </p> Installation ------------ Install using composer: ```bash composer require jenssegers/agent ``` Laravel (optional) ------------------ Add the service provider in `config/app.php`: ```php Jenssegers\Agent\AgentServiceProvider::class, ``` And add the Agent alias to `config/app.php`: ```php 'Agent' => Jenssegers\Agent\Facades\Agent::class, ``` Basic Usage ----------- Start by creating an `Agent` instance (or use the `Agent` Facade if you are using Laravel): ```php use Jenssegers\Agent\Agent; $agent = new Agent(); ``` If you want to parse user agents other than the current request in CLI scripts for example, you can use the `setUserAgent` and `setHttpHeaders` methods: ```php $agent->setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2'); $agent->setHttpHeaders($headers); ``` All of the original [Mobile Detect](https://github.com/serbanghita/Mobile-Detect) methods are still available, check out some original examples at https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples ### Is? Check for a certain property in the user agent. ```php $agent->is('Windows'); $agent->is('Firefox'); $agent->is('iPhone'); $agent->is('OS X'); ``` ### Magic is-method Magic method that does the same as the previous `is()` method: ```php $agent->isAndroidOS(); $agent->isNexus(); $agent->isSafari(); ``` ### Mobile detection Check for mobile device: ```php $agent->isMobile(); $agent->isTablet(); ``` ### Match user agent Search the user agent with a regular expression: ```php $agent->match('regexp'); ``` Additional Functionality ------------------------ ### Accept languages Get the browser's accept languages. Example: ```php $languages = $agent->languages(); // ['nl-nl', 'nl', 'en-us', 'en'] ``` ### Device name Get the device name, if mobile. (iPhone, Nexus, AsusTablet, ...) ```php $device = $agent->device(); ``` ### Operating system name Get the operating system. (Ubuntu, Windows, OS X, ...) ```php $platform = $agent->platform(); ``` ### Browser name Get the browser name. (Chrome, IE, Safari, Firefox, ...) ```php $browser = $agent->browser(); ``` ### Desktop detection Check if the user is using a desktop device. ```php $agent->isDesktop(); ``` *This checks if a user is not a mobile device, tablet or robot.* ### Phone detection Check if the user is using a phone device. ```php $agent->isPhone(); ``` ### Robot detection Check if the user is a robot. This uses [jaybizzle/crawler-detect](https://github.com/JayBizzle/Crawler-Detect) to do the actual robot detection. ```php $agent->isRobot(); ``` ### Robot name Get the robot name. ```php $robot = $agent->robot(); ``` ### Browser/platform version MobileDetect recently added a `version` method that can get the version number for components. To get the browser or platform version you can use: ```php $browser = $agent->browser(); $version = $agent->version($browser); $platform = $agent->platform(); $version = $agent->version($platform); ``` *Note, the version method is still in beta, so it might not return the correct result.* ## License Laravel User Agent is licensed under [The MIT License (MIT)](LICENSE). ## Security contact information To report a security vulnerability, follow [these steps](https://tidelift.com/security).
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings