Files

49 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2016-10-12 11:37:13 -04:00
<?php
class OS
{
2018-05-21 11:49:15 -04:00
/*
* if changing below constants, you should add permanent redirects for old OS names used in URLs
*/
2021-05-14 20:10:54 +08:00
public const OS_ANDROID = 'android',
2016-10-12 11:37:13 -04:00
OS_IOS = 'ios',
OS_LINUX = 'linux',
OS_OSX = 'osx',
OS_WINDOWS = 'windows';
2018-05-21 11:49:15 -04:00
public static function getAll()
{
//url, English name, icon class, partial name
//yes, this is probably a bad pattern
return [
2021-02-16 12:58:36 -05:00
OS::OS_WINDOWS => ['/windows', 'Windows', 'icon-windows', __("Get LBRY Desktop for Windows"), "Windows"],
OS::OS_OSX => ['/osx', 'macOS', 'icon-apple', __("Get LBRY Desktop for macOS"), "OSX"],
OS::OS_LINUX => ['/linux', 'Linux', 'icon-linux', __("Get LBRY Desktop for Linux"), "Linux"],
OS::OS_ANDROID => ['/android', 'Android', 'icon-android', __('Get LBRY Android'), false],
OS::OS_IOS => ['/ios', 'iOS', 'icon-ios', __('Get Odysee for iOS'), false]
2016-10-12 11:37:13 -04:00
];
2018-05-21 11:49:15 -04:00
}
2017-04-18 18:12:58 -04:00
2018-05-21 11:49:15 -04:00
public static function getOsForExtension($ext)
2017-04-18 18:12:58 -04:00
{
2018-05-21 11:49:15 -04:00
switch ($ext) {
2017-04-18 18:12:58 -04:00
case 'deb':
2020-01-22 12:13:37 -05:00
case 'AppImage':
2017-04-18 18:12:58 -04:00
return OS::OS_LINUX;
case 'dmg':
case 'pkg':
return OS::OS_OSX;
2017-12-14 15:26:04 -05:00
case 'msi': // fallthrough
2017-04-18 18:12:58 -04:00
case 'exe':
return OS::OS_WINDOWS;
2019-03-21 17:22:38 -04:00
case 'apk':
return OS::OS_ANDROID;
2017-04-18 18:12:58 -04:00
default:
throw new LogicException("Unknown ext $ext");
}
2018-05-21 11:49:15 -04:00
}
}