/**
  * おすすめ商品検索.
  *
  * @return array $arrBestProducts 検索結果配列
  */
 public function lfGetRanking()
 {
     $arrRecommends = parent::lfGetRanking();
     $detect = new Mobile_Detect();
     $cur_category_id = 0;
     if ($detect->is("AndroidOS")) {
         $cur_category_id = 1;
     } elseif ($detect->is("iOS")) {
         $cur_category_id = 2;
     } else {
         return array();
     }
     $response = array();
     if (count($arrRecommends) > 0) {
         $objProduct = new SC_Product_Ex();
         foreach ($arrRecommends as $value) {
             $product_id = $value['product_id'];
             $category_id = $objProduct->getCategoryIds($product_id);
             if (in_array($cur_category_id, $category_id)) {
                 // nop
                 $response[] = $value;
             }
         }
     }
     return $response;
 }
 /**
  *
  * @param Mobile_Detect $detect
  */
 function check_os()
 {
     $detect = new Mobile_Detect();
     if ($detect->is("iOS")) {
         // OK
     } else {
         SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
     }
 }
 function LC_Page_iOS_Products_List_action_after(LC_Page_Products_List $objPage)
 {
     $detect = new Mobile_Detect();
     $category_id = self::sfGetCategoryId();
     if ($detect->isMobile()) {
         if ($detect->is("AndroidOS")) {
             $cur_category_id = 1;
         } elseif ($detect->is("iOS")) {
             $cur_category_id = 2;
         } else {
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
         }
         if ($category_id != $cur_category_id) {
             $category_id = $cur_category_id;
             SC_Response_Ex::reload(compact("category_id"));
         }
     }
 }
Esempio n. 4
0
 public function testBasicMethods()
 {
     $this->assertNotEmpty($this->detect->getScriptVersion());
     $this->detect->setHttpHeaders(array('SERVER_SOFTWARE' => 'Apache/2.2.15 (Linux) Whatever/4.0 PHP/5.2.13', 'REQUEST_METHOD' => 'POST', 'HTTP_HOST' => 'home.ghita.org', 'HTTP_X_REAL_IP' => '1.2.3.4', 'HTTP_X_FORWARDED_FOR' => '1.2.3.5', 'HTTP_CONNECTION' => 'close', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25', 'HTTP_ACCEPT' => 'text/vnd.wap.wml, application/json, text/javascript, */*; q=0.01', 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest', 'HTTP_REFERER' => 'http://mobiledetect.net', 'HTTP_PRAGMA' => 'no-cache', 'HTTP_CACHE_CONTROL' => 'no-cache', 'REMOTE_ADDR' => '11.22.33.44', 'REQUEST_TIME' => '01-10-2012 07:57'));
     //12 because only 12 start with HTTP_
     $this->assertCount(12, $this->detect->getHttpHeaders());
     $this->assertTrue($this->detect->checkHttpHeadersForMobile());
     $this->detect->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25');
     $this->assertNotEmpty($this->detect->getUserAgent());
     $this->assertTrue($this->detect->isMobile());
     $this->assertFalse($this->detect->isTablet());
     $this->assertTrue($this->detect->isIphone());
     $this->assertTrue($this->detect->isiphone());
     $this->assertTrue($this->detect->isiOS());
     $this->assertTrue($this->detect->isios());
     $this->assertTrue($this->detect->is('iphone'));
     $this->assertTrue($this->detect->is('ios'));
 }
 /**
  * Page を初期化する.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $detect = new Mobile_Detect();
     if ($detect->is("FireFox")) {
         $this->tpl_mainpage = "unsupported/firefox.tpl";
         // SC_Utils_Ex::sfDispSiteError ( FREE_ERROR_MSG, "", FALSE, "Firefox は対応していません", TRUE );
     }
 }
 public function isSmartphone()
 {
     $detect = new Mobile_Detect();
     if ($detect->is("AndroidOS")) {
         // AndroidOS の場合 Tab 問わず
         return true;
     } elseif (parent::isSmartphone()) {
         // それ以外の端末の場合 標準の仕様
         return true;
     } elseif ($detect->match("bingbot|Twitterbot|msnbot")) {
         // bing bot の場合 モバイル
         return true;
     }
     return false;
 }
Esempio n. 7
0
File: start.php Progetto: n8b/VMN
function lazy_load_init()
{
    elgg_extend_view('css/elgg', 'lazy_load/css');
    require_once dirname(__FILE__) . '/vendors/Mobile_Detect.php';
    $mobile = new Mobile_Detect();
    if (!$mobile->is('iOS')) {
        // register our js library
        $js = elgg_get_simplecache_url('js', 'lazy_load/js');
        elgg_register_simplecache_view('js/lazy_load/js');
        elgg_register_js('lazy_load.js', $js);
        //use lazy load on all pages
        elgg_load_js('lazy_load.js');
        elgg_register_plugin_hook_handler('view', 'page/default', 'lazy_load_defaultpage');
    }
}
 public function getArrProducts()
 {
     $objPage = new LC_Page_Products_List_Ex();
     $objPage->orderby = "date";
     $objPage->init();
     $objPage->arrSearchData = array();
     $detect = new Mobile_Detect();
     if ($detect->is("iOS")) {
         $objPage->arrSearchData["category_id"] = 2;
     } else {
         $objPage->arrSearchData["category_id"] = 1;
     }
     $arrSearchCondition = $objPage->lfGetSearchCondition($objPage->arrSearchData);
     $arrProducts = $objPage->lfGetProductsList($arrSearchCondition, NEW_CONTENTS_SEARCH_PMAX, 0, $this->objProduct);
     unset($arrProducts["productStatus"]);
     return $arrProducts;
 }
 function action()
 {
     parent::action();
     if (is_array($this->arrResults) && count($this->arrResults) > 0) {
         $objPurchase = new SC_Helper_Purchase_Ex();
         $detect = new Mobile_Detect();
         foreach ($this->arrResults as &$order) {
             $order["detail"] = $objPurchase->getOrderDetail($order["order_id"]);
             if (isset($order["useragent"])) {
                 $detect->setUserAgent($order["useragent"]);
                 $useragent = array();
                 if ($detect->is("AndroidOS")) {
                     preg_match("{.*;([^;]+) Build}", $order["useragent"], $useragent);
                     $order["device"] = $useragent[1];
                 }
             }
         }
     }
 }
Esempio n. 10
0
';
$detect = new Mobile_Detect();
$html .= '<table border="1">';
$html .= '
    <tr>
        <th>UA</th>
        <th>isMobile()</th>
        <th>isTablet()</th>
        <th>is(\'chrome\')</th>
        <th>isiOS()</th>
        <th>isAndroidOS()</th>
        <th>is(\'bot\')</th>
    </tr>
    ';
foreach ($userAgents as $userAgent) {
    $isChrome = $detect->is('chrome', $userAgent);
    $isiOS = $detect->isiOS();
    $isAndroidOS = $detect->isAndroidOS();
    $isBot = $detect->is('bot', $userAgent);
    $isMobile = $detect->isMobile($userAgent, array());
    $isTablet = $detect->isTablet($userAgent);
    $html .= '<tr>';
    $html .= '<td>' . $userAgent . '</td>';
    $html .= '<td class="' . ($isMobile ? 'true' : 'false') . '">' . ($isMobile ? 'true' : 'false') . '</td>';
    $html .= '<td class="' . ($isTablet ? 'true' : 'false') . '">' . ($isTablet ? 'true' : 'false') . '</td>';
    $html .= '<td class="' . ($isChrome ? 'true' : 'false') . '">' . ($isChrome ? 'true' : 'false') . '</td>';
    $html .= '<td class="' . ($isiOS ? 'true' : 'false') . '">' . ($isiOS ? 'true' : 'false') . '</td>';
    $html .= '<td class="' . ($isAndroidOS ? 'true' : 'false') . '">' . ($isAndroidOS ? 'true' : 'false') . '</td>';
    $html .= '<td class="' . ($isBot ? 'true' : 'false') . '">' . ($isBot ? 'true' : 'false') . '</td>';
    $html .= '</tr>';
}
Esempio n. 11
0
        $response["body"] = empty($HTTP_body) ? null : $HTTP_body;
    }
    // geoip integration
    if ($geoip) {
        $ip_source = array("IP-source" => $override_clientip && !empty($headers[$clientip_header]) ? $clientip_header : "REMOTE_ADDR");
        $response["geoip_info"] = array_merge($ip_source, get_geoip_info($clientip));
    }
    // Device detection integration
    if ($devicedetect) {
        require_once 'vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php';
        $detect = new Mobile_Detect();
        $response["device"]["is_mobile"] = $detect->isMobile() ? true : false;
        $response["device"]["is_tablet"] = $detect->isTablet() ? true : false;
        $rules = $detect->getRules();
        foreach ($rules as $rule => $value) {
            if ($detect->is($rule)) {
                $response["device"][$rule] = true;
            }
        }
    }
    echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    echo PHP_EOL;
} else {
    header('Content-Type: text/plain');
    echo $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . ' ' . $_SERVER['SERVER_PROTOCOL'] . PHP_EOL;
    $headers = apache_request_headers();
    foreach ($headers as $header => $value) {
        echo "{$header}: {$value}";
        echo PHP_EOL;
    }
    $HTTP_body = file_get_contents('php://input');
Esempio n. 12
0
 function init()
 {
     parent::init();
     $objCustomer = new SC_Customer_Ex();
     if (isset($_GET["sid"]) && isset($_GET["admin"])) {
         $sid = $_REQUEST["sid"];
         $email = $objCustomer->getValue("email");
         $osid = session_id();
         if ($osid != $sid) {
             session_destroy();
             session_id($sid);
             session_start();
         }
         $objCustomer->setLogin($email);
         $get = $_GET;
         unset($get["sid"]);
         SC_Response_Ex::reload($get, true);
     }
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objProduct = new SC_Product_Ex();
     if (GC_Utils_Ex::isFrontFunction() && $this->skip_load_page_layout == false) {
         $objCustomer = new SC_Customer_Ex();
         // 画面更新毎に情報を更新する
         if ($objCustomer->isLoginSuccess()) {
             // 初回アクセス時に更新
             $objCustomer->updateSession();
             $this->tpl_login = true;
             $this->tpl_point = $objCustomer->getValue("point");
             $this->tpl_customer_id = $objCustomer->getValue("customer_id");
             $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date");
             $this->tpl_carrier = $objCustomer->getValue("carrier");
             $downloadable_days = $this->arrSiteInfo["downloadable_days"];
             $downloadable_days_unlimited = $this->arrSiteInfo["downloadable_days_unlimited"];
             $date = null;
             if ($downloadable_days_unlimited) {
                 $date = SC_Utils_Ex::sfGetTimestamp(RELEASE_YEAR, 1, 1, false);
                 $date2 = SC_Utils_Ex::sfGetTimestamp(9999, 12, 31, false);
             } else {
                 $xdate = strtotime("-{$downloadable_days} day");
                 $date = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
                 $xdate = strtotime("+{$downloadable_days} day");
                 $date2 = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
             }
             $this->downloadable_days = $date;
             $this->downloadable_days2 = $date2;
             $objPurchase = new SC_Helper_Purchase_Ex();
             $arrOrderId = $objQuery->getCol("order_id", "dtb_order", "payment_date > ? AND customer_id = ?", array($date, $this->tpl_customer_id));
             $this->arrRedownloadProduct = array();
             foreach ($arrOrderId as $order_id) {
                 $arrOrderDetail = $objPurchase->getOrderDetail($order_id, true);
                 $this->arrRedownloadProduct = array_merge($this->arrRedownloadProduct, $arrOrderDetail);
             }
             // 再ダウンロード可能な商品一覧
             $this->arrRedownloadProduct = SC_Utils_Ex::makeArrayIDToKey("product_id", $this->arrRedownloadProduct);
             foreach ($this->arrRedownloadProduct as $product_id => $row) {
                 $row["product"] = $objProduct->getDetail($product_id);
                 $this->arrRedownloadProduct[$product_id] = $row;
             }
         } else {
             $this->tpl_login = false;
             $this->tpl_point = 0;
             $this->tpl_customer_id = 0;
             $this->tpl_first_buy_date = null;
             $this->tpl_carrier = 9;
             $this->arrRedownloadProduct = array();
         }
         $objDb = new SC_Helper_DB_Ex();
         if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) {
             $where = " customer_id =  ? AND transaction_status =  ? AND continue_account_id IS NOT NULL AND del_flg = 0";
             $arrWhereVal = array($this->tpl_customer_id, 40);
             if ($objQuery->exists("cp_dtb_customer_transaction", $where, $arrWhereVal)) {
                 // OK
             } else {
                 switch (basename(dirname($_SERVER["SCRIPT_NAME"]))) {
                     case "au":
                         break;
                     default:
                         if ($objCustomer->isLoginSuccess()) {
                             $objCustomer->EndSession();
                             SC_Response_Ex::reload();
                         }
                         break;
                 }
             }
         }
         $objCategory = new SC_Helper_Category_Ex();
         $this->arrCommonCategory = $objCategory->getList(true);
         $this->arrCommonCategoryTree = $objCategory->getTree();
         $detect = new Mobile_Detect();
         $script_file = $_SERVER["SCRIPT_NAME"];
         $script_file = ltrim($script_file, "/");
         $script_file2 = str_replace("ios/", "", $script_file);
         if ($detect->is("iOS")) {
             if (file_exists(HTML_REALDIR . "ios/{$script_file}")) {
                 SC_Response_Ex::sendRedirect(HTTP_URL . "ios/{$script_file}", $_GET);
             }
         } elseif (strcmp($script_file, $script_file2) !== 0) {
             SC_Response_Ex::sendRedirect(HTTP_URL . "{$script_file2}", $_GET);
         }
         $_SESSION["is_android"] = $detect->is("AndroidOS");
         if ($detect->isMobile() == false) {
             // NG
             $this->device_support = false;
         } elseif ($detect->is("iOS")) {
             if ($detect->match("iPhone")) {
                 // OK
                 $this->device_support = true;
             } elseif ($detect->match("iPod")) {
                 // NG
                 $this->device_support = false;
             } elseif ($detect->match("iPad")) {
                 // NG
                 $this->device_support = false;
             } else {
                 // NG
                 $this->device_support = false;
             }
             $version = $detect->version("iOS", $detect::VERSION_TYPE_FLOAT);
             if ($version < 6) {
                 // NG
                 $this->device_support = false;
             }
         } elseif ($detect->match("Android") == false) {
             // NG
             $this->device_support = false;
         } elseif (class_exists("SC_DeviceAndroidSelect_Ex", true)) {
             $useragent = array();
             if (preg_match("|.*; ([^;]+) Build/.*|", $_SERVER["HTTP_USER_AGENT"], $useragent)) {
                 $device = new SC_DeviceAndroidSelect_Ex(array("search_device_user_agent_word" => $useragent[1], "search_status" => 1));
                 $this->device_support = $device->exists();
                 $this->tpl_device = $device->getOne();
             }
         } elseif ($detect->match("Android")) {
             // OK
             $this->device_support = true;
         } else {
             // NG
             $this->device_support = false;
         }
     }
     if ($this->device_support) {
         GC_Utils_Ex::gfPrintLog("対応端末:" . $_SERVER['HTTP_USER_AGENT']);
         return;
     } else {
         GC_Utils_Ex::gfPrintLog("非対応端末:" . $_SERVER['HTTP_USER_AGENT']);
         if (is_a($this, "LC_Page_Index")) {
             SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
         } elseif (is_a($this, "LC_Page_Unsupported")) {
             // 非対応端末表示を行わない
             return;
         } elseif (is_a($this, "LC_Page_Entry_Kiyaku")) {
             // 非対応端末表示を行わない
             return;
         } elseif ($this->not_unsupported) {
             // 非対応端末表示を行わない
             return;
         } else {
             SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
         }
     }
 }
Esempio n. 13
0
 * @filename layout.php
 * @author  Daniel Scheidler
 * @copyright Oktober 2012
 */
$detect = new Mobile_Detect();
$bannerWidth = 780;
$bannerHeight = 195;
$mainSizeInternal = 620;
$_SESSION['additionalLayoutHeight'] = $bannerHeight;
$mainHeight = 390;
$mainWidth = $mainSizeInternal;
if (isset($_SESSION['MENU_PARENT']) && $_SESSION['MENU_PARENT'] != "Steuerung" && isset($_SESSION['runLink']) && $_SESSION['runLink'] != "start") {
    $mainWidth = $bannerWidth;
}
if ($detect->isMobile()) {
    if ($detect->is('iOS')) {
        // iOS
        include "layout_apple.php";
        exit;
    }
    if ($detect->isTablet()) {
        // Tablet
        include "layout_tablet.php";
        exit;
    }
    // Any other mobile device.
    include "layout_mobile.php";
    exit;
}
$sqlNoFrame = "SELECT * FROM homecontrol_noframe WHERE ip = '" . $_SERVER['REMOTE_ADDR'] . "'";
//$_SERVER['HTTP_X_FORWARDED_FOR']
Esempio n. 14
0
 /**
  * get server equipment info by SERVER.
  * @param array $server $_SERVER
  * @return array
  */
 public static function getServerEquipmentInfo($server)
 {
     $base_path = dirname(__FILE__);
     require_once $base_path . DIRECTORY_SEPARATOR . 'Mobile_Detect.php';
     $result = array();
     $detect = new Mobile_Detect($server);
     $isMobile = $detect->isMobile();
     if ($isMobile) {
         $mobileDetectRules = $detect->getMobileDetectionRules();
         $tmpArr = array();
         foreach ($mobileDetectRules as $k => $v) {
             if ($detect->is($k)) {
                 $tmpArr[] = $k;
             }
         }
         $result['equipment_type'] = 'tablet';
         $result['equipment'] = $tmpArr[0];
         $result['equipment_os'] = $tmpArr[1];
         $result['equipment_browser'] = $tmpArr[2];
     } else {
         require_once $base_path . DIRECTORY_SEPARATOR . 'PC_User_Agent.php';
         $pcUserAgent = new PC_User_Agent($server);
         $result['equipment_type'] = 'pc';
         $browserRules = $pcUserAgent->getBrowsers();
         foreach ($browserRules as $k => $v) {
             if ($pcUserAgent->is($k)) {
                 $browser = $k;
                 break;
             }
         }
         $result['equipment_browser'] = $browser ? $browser : '';
         $systemsRules = $pcUserAgent->getOperatingSystems();
         foreach ($systemsRules as $k => $v) {
             if ($pcUserAgent->is($k)) {
                 $system = $k;
                 break;
             }
         }
         $result['equipment_os'] = $system ? $system : '';
         $result['equipment'] = '';
     }
     return $result;
 }
Esempio n. 15
0
/**
 * Return information about user browser
 *
 * Returns array with the following format:
 * array(
 *  'browsername' => Browser name (firefox|chrome|iceweasel|epiphany|safari|opera|ie|unknown)
 *  'browserversion' => Browser version. Empty if unknown
 *  'browseros' => Set with mobile OS (android|blackberry|ios|palm|symbian|webos|maemo|windows|unknown)
 *  'layout' => (tablet|phone|classic)
 *  'phone' => empty if not mobile, (android|blackberry|ios|palm|unknown) if mobile
 *  'tablet' => true/false
 * )
 *
 * @param string $user_agent Content of $_SERVER["HTTP_USER_AGENT"] variable
 * @return	array Check function documentation
 */
function getBrowserInfo($user_agent)
{
    include_once DOL_DOCUMENT_ROOT . '/includes/mobiledetect/mobiledetectlib/Mobile_Detect.php';
    $name = 'unknown';
    $version = '';
    $os = 'unknown';
    $phone = '';
    $detectmobile = new Mobile_Detect(null, $user_agent);
    $tablet = $detectmobile->isTablet();
    if ($detectmobile->isMobile()) {
        $phone = 'unknown';
        // If phone/smartphone, we set phone os name.
        if ($detectmobile->is('AndroidOS')) {
            $os = $phone = 'android';
        } elseif ($detectmobile->is('BlackBerryOS')) {
            $os = $phone = 'blackberry';
        } elseif ($detectmobile->is('iOS')) {
            $os = 'ios';
            $phone = 'iphone';
        } elseif ($detectmobile->is('PalmOS')) {
            $os = $phone = 'palm';
        } elseif ($detectmobile->is('SymbianOS')) {
            $os = 'symbian';
        } elseif ($detectmobile->is('webOS')) {
            $os = 'webos';
        } elseif ($detectmobile->is('MaemoOS')) {
            $os = 'maemo';
        } elseif ($detectmobile->is('WindowsMobileOS') || $detectmobile->is('WindowsPhoneOS')) {
            $os = 'windows';
        }
    }
    // OS
    if (preg_match('/linux/i', $user_agent)) {
        $os = 'linux';
    } elseif (preg_match('/macintosh/i', $user_agent)) {
        $os = 'macintosh';
    }
    // Name
    if (preg_match('/firefox(\\/|\\s)([\\d\\.]*)/i', $user_agent, $reg)) {
        $name = 'firefox';
        $version = $reg[2];
    } elseif (preg_match('/chrome(\\/|\\s)([\\d\\.]+)/i', $user_agent, $reg)) {
        $name = 'chrome';
        $version = $reg[2];
    } elseif (preg_match('/chrome/i', $user_agent, $reg)) {
        $name = 'chrome';
    } elseif (preg_match('/iceweasel/i', $user_agent)) {
        $name = 'iceweasel';
        $version = $reg[2];
    } elseif (preg_match('/epiphany/i', $user_agent)) {
        $name = 'epiphany';
        $version = $reg[2];
    } elseif (preg_match('/safari(\\/|\\s)([\\d\\.]*)/i', $user_agent, $reg)) {
        $name = 'safari';
        $version = $reg[2];
    } elseif (preg_match('/opera(\\/|\\s)([\\d\\.]*)/i', $user_agent, $reg)) {
        $name = 'opera';
        $version = $reg[2];
    } elseif (preg_match('/(MSIE\\s([0-9]+\\.[0-9]))|.*(Trident\\/[0-9]+.[0-9];\\srv:([0-9]+\\.[0-9]+))/i', $user_agent, $reg)) {
        $name = 'ie';
        $version = end($reg);
    }
    // MS products at end
    if ($tablet) {
        $layout = 'tablet';
    } elseif ($phone) {
        $layout = 'phone';
    } else {
        $layout = 'classic';
    }
    return array('browsername' => $name, 'browserversion' => $version, 'browseros' => $os, 'layout' => $layout, 'phone' => $phone, 'tablet' => $tablet);
}
Esempio n. 16
0
 /**
  * Can we match the OS in the route to the device
  *
  * @param string         $routeOS os option in the route
  * @param \Mobile_Detect $device  device object from the WebRequest
  *
  * @return bool|string matched OS
  */
 protected function matchDeviceOS($routeOS, \Mobile_Detect $device)
 {
     $routeOS = strtolower($routeOS);
     if (substr($routeOS, -2) != 'os') {
         $routeOS .= 'os';
     }
     $aOperatingSystems = $this->rejiggerMobileParameterArray($device->getOperatingSystems());
     if (!isset($aOperatingSystems[$routeOS]) || !$device->is($aOperatingSystems[$routeOS])) {
         return false;
     }
     return $aOperatingSystems[$routeOS];
 }
 /**
  * Identify the device based on Mobile_Detect data.
  * 
  * We ignore version information that may be returned by the class for given device
  * as it currently either returns nothing or data worse than uaparser
  * 
  * @param Mobile_Detect $md
  * 
  * @return string
  */
 protected static function parseDeviceMd(Mobile_Detect $md)
 {
     $device = '';
     foreach (self::$md_devices as $family) {
         if ($md->is($family)) {
             $device = $family;
             break;
         }
     }
     if (empty($device) || in_array($device, self::$generic_devices)) {
         return '';
     }
     // there is no need to separate device families by tablet/phone because this distinction is already present in ->isMobileTablet()
     $device = str_replace(self::MOBILE_DETECT_TABLET_SUFFIX, '', $device);
     return $device;
 }