getAvailableOperatingSystemFamilies() public static method

Returns all available operating system families
public static getAvailableOperatingSystemFamilies ( ) : array
return array
 public function getAllFamilyOs()
 {
     $allFamilyOs = call_user_func_array('array_merge', OperatingSystem::getAvailableOperatingSystemFamilies());
     $allFamilyOs = array_map(function ($os) {
         return array($os);
     }, $allFamilyOs);
     return $allFamilyOs;
 }
Beispiel #2
0
 public function showList()
 {
     Piwik::checkUserHasSomeAdminAccess();
     $view = new View('@DevicesDetection/list');
     $type = Common::getRequestVar('type', 'brands', 'string');
     $list = array();
     switch ($type) {
         case 'brands':
             $availableBrands = \DeviceDetector\Parser\Device\DeviceParserAbstract::$deviceBrands;
             foreach ($availableBrands as $short => $name) {
                 if ($name != 'Unknown') {
                     $list[$name] = getBrandLogo($name);
                 }
             }
             break;
         case 'browsers':
             $availableBrowsers = \DeviceDetector\Parser\Client\Browser::getAvailableBrowsers();
             foreach ($availableBrowsers as $short => $name) {
                 $list[$name] = getBrowserLogo($short);
             }
             break;
         case 'browserfamilies':
             $availableBrowserFamilies = \DeviceDetector\Parser\Client\Browser::getAvailableBrowserFamilies();
             foreach ($availableBrowserFamilies as $name => $browsers) {
                 $list[$name] = getBrowserFamilyLogo($name);
             }
             break;
         case 'os':
             $availableOSs = \DeviceDetector\Parser\OperatingSystem::getAvailableOperatingSystems();
             foreach ($availableOSs as $short => $name) {
                 $list[$name] = getOsLogo($short);
             }
             break;
         case 'osfamilies':
             $osFamilies = \DeviceDetector\Parser\OperatingSystem::getAvailableOperatingSystemFamilies();
             foreach ($osFamilies as $name => $oss) {
                 $list[$name] = getOsFamilyLogo($name);
             }
             break;
         case 'devicetypes':
             $deviceTypes = \DeviceDetector\Parser\Device\DeviceParserAbstract::getAvailableDeviceTypes();
             foreach ($deviceTypes as $name => $id) {
                 $list[$name] = getDeviceTypeLogo($name);
             }
             break;
     }
     $view->itemList = $list;
     return $view->render();
 }
Beispiel #3
0
/**
 * Returns the path to the logo for the given OS
 *
 * First try to find a logo for the given short code
 * If none can be found try to find a logo for the os family
 * Return unknown logo otherwise
 *
 * @param string  $short  Shortcode or name of OS
 *
 * @return string  path to image
 */
function getOsLogo($short)
{
    $path = 'plugins/DevicesDetection/images/os/%s.gif';
    $short = _mapLegacyOsShortCodes($short);
    // If name is given instead of short code, try to find matching shortcode
    if (strlen($short) > 3) {
        if (in_array($short, OperatingSystemParser::getAvailableOperatingSystems())) {
            $short = array_search($short, OperatingSystemParser::getAvailableOperatingSystems());
        } else {
            $short = substr($short, 0, 3);
        }
    }
    $family = getOSFamilyFullName($short);
    $osFamilies = OperatingSystemParser::getAvailableOperatingSystemFamilies();
    if (!empty($short) && array_key_exists($short, OperatingSystemParser::getAvailableOperatingSystems()) && file_exists(PIWIK_INCLUDE_PATH . '/' . sprintf($path, $short))) {
        return sprintf($path, $short);
    } elseif (!empty($family) && array_key_exists($family, $osFamilies) && file_exists(PIWIK_INCLUDE_PATH . '/' . sprintf($path, $osFamilies[$family][0]))) {
        return sprintf($path, $osFamilies[$family][0]);
    }
    return sprintf($path, 'UNK');
}
Beispiel #4
0
 /**
  * @dataProvider getAllOs
  */
 public function testOSInGroup($os)
 {
     $familyOs = call_user_func_array('array_merge', OperatingSystem::getAvailableOperatingSystemFamilies());
     $this->assertContains($os, $familyOs);
 }