Ejemplo n.º 1
0
function getOsLogoExtended($label)
{
    $short = substr($label, 0, 3);
    $familyName = getOsFamilyFullNameExtended($short);
    $path = getOsFamilyLogoExtended($familyName);
    return $path;
}
Ejemplo n.º 2
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 unkown logo otherwise
 *
 * @param string  $short  Shortcode or name of OS
 *
 * @return string  path to image
 */
function getOsLogoExtended($short)
{
    $path = 'plugins/UserSettings/images/os/%s.gif';
    // 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 = getOsFamilyFullNameExtended($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');
}
Ejemplo n.º 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 unkown logo otherwise
 *
 * @param string  $short  Shortcode or name of OS
 *
 * @return string  path to image
 */
function getOsLogoExtended($short)
{
    $path = 'plugins/UserSettings/images/os/%s.gif';
    // If name is given instead of short code, try to find matching shortcode
    if (strlen($short) > 3) {
        if (array_key_exists($short, DeviceDetector::$osShorts)) {
            $short = DeviceDetector::$osShorts[$short];
        } else {
            $short = substr($short, 0, 3);
        }
    }
    $family = getOsFamilyFullNameExtended($short);
    if (in_array($short, DeviceDetector::$osShorts) && file_exists(PIWIK_INCLUDE_PATH . '/' . sprintf($path, $short))) {
        return sprintf($path, $short);
    } elseif (array_key_exists($family, DeviceDetector::$osFamilies) && file_exists(PIWIK_INCLUDE_PATH . '/' . sprintf($path, DeviceDetector::$osFamilies[$family][0]))) {
        return sprintf($path, DeviceDetector::$osFamilies[$family][0]);
    }
    return sprintf($path, 'UNK');
}