本文整理汇总了PHP中Mobile_Detect::getUserAgent方法的典型用法代码示例。如果您正苦于以下问题:PHP Mobile_Detect::getUserAgent方法的具体用法?PHP Mobile_Detect::getUserAgent怎么用?PHP Mobile_Detect::getUserAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile_Detect
的用法示例。
在下文中一共展示了Mobile_Detect::getUserAgent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printf
global $rewrite_url;
echo SITE_URL;
printf($rewrite_url[$type], $variable1, $variable2);
}
class_loader('Mobile_Detect');
$detect = new Mobile_Detect();
if (!$detect->isiOS()) {
if (DCRM_PCINDEX == 2) {
header("Location: " . SITE_URL . $rewrite_url['misc']);
exit;
} else {
$isCydia = false;
}
} else {
if (DCRM_MOBILE == 2) {
if (!strpos($detect->getUserAgent(), 'Cydia')) {
$isCydia = false;
} else {
$isCydia = true;
}
} else {
exit('Access Denied');
}
}
if (file_exists('Release')) {
$release = file('Release');
$release_origin = __('No Name');
$release_mtime = filemtime('Release');
$release_time = date('Y-m-d H:i:s', $release_mtime);
foreach ($release as $line) {
if (preg_match('#^Origin#', $line)) {
示例2: testSetUserAgent
/**
* @covers Mobile_Detect::setUserAgent, Mobile_Detect::getUserAgent
*/
public function testSetUserAgent()
{
$md = new Mobile_Detect(array());
$md->setUserAgent('hello world');
$this->assertSame('hello world', $md->getUserAgent());
}
示例3: systemHash
function get_device_info()
{
global $memcacheWorking, $memcache;
$detect = new Mobile_Detect();
$ua = $detect->getUserAgent();
//If Cache working
if ($memcacheWorking) {
$device_info = $memcache->get(md5("user-agent" . $ua . systemHash()));
if (!$device_info) {
$parse_info = PLATFORMS::parseUserAgentInfo($detect);
$memcache->set(md5("user-agent" . $ua . systemHash()), $parse_info, false);
return $parse_info;
} else {
return $device_info;
}
} else {
return PLATFORMS::parseUserAgentInfo($detect);
}
}
示例4: getIspData
die;
}
AUTH::set_timezone($rotator_row['user_timezone']);
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
if ($rotator_row['maxmind'] == '1') {
$IspData = getIspData($ip_address);
} else {
$IspData = null;
}
//GEO Lookup
$GeoData = getGeoData($ip_address);
//User-agent parser
$parser = Parser::create();
//Device type
$detect = new Mobile_Detect();
$ua = $detect->getUserAgent();
$result = $parser->parse($ua);
if (!$detect->isMobile() && !$detect->isTablet()) {
switch ($result->device->family) {
//Is Bot
case 'Bot':
$result->device->family = "Bot";
break;
//Is Desktop
//Is Desktop
case 'Other':
$result->device->family = "Desktop";
break;
}
} else {
if ($detect->isTablet()) {
示例5: substr
//if we're on ipad or iphone check safari version
if ($is_ios) {
$ios_vers = substr($detect->version('iOS'), 0, 1);
$phoneOs = 'ios';
// $ios_vers = $detect->version('iOS');
// $safari_vers = $detect->version('Safari');
if ($ios_vers < 7) {
$ios_vers = "uns-device";
$browser = 'ie8';
}
}
if ($detect->isAndroidOS()) {
$phoneOs = 'android';
}
//checking for mobile web apps
$user_agent = $detect->getUserAgent();
// $user_agent = 'Mozilla/5.0 (Linux; Android 5.0.2; D5803 Build/23.1.A.1.28; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.121 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/36.0.0.39.166;]';
// $user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D508';
// $user_agent = '600.1.4 (KHTML, like Gecko) Version/8';
//echo $user_agent.'<br>';
$reg_exp = '/.*KHTML.*\\) Version./';
// $reg_exp = '/.*KHTML.*/';
//echo 'regexp '.$reg_exp.'<br>';
$touch_webview_browser = false;
$if_cond = 0;
if ($detect->isMobile() || $detect->isTablet()) {
// if( true ) {
if (preg_match('/.wv./', $user_agent)) {
// Android devices with lollipop and above os has 'wv' in the webview browser
$touch_webview_browser = true;
$if_cond = 'wv';
示例6: time
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/connect.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/Mobile_Detect.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/202-config/vendor/autoload.php';
use UAParser\Parser;
$detect = new Mobile_Detect();
$parser = Parser::create();
$result = $parser->parse($detect->getUserAgent());
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$mysql['user_name'] = $db->real_escape_string($_POST['user_name']);
$user_pass = salt_user_pass($_POST['user_pass']);
$mysql['user_pass'] = $db->real_escape_string($user_pass);
//check to see if this user exists
$user_sql = "\tSELECT \t* \n\t\t\t\t\tFROM \t\t202_users \n\t\t\t\t \tWHERE \tuser_name='" . $mysql['user_name'] . "'\n\t\t\t\t\tAND \t\tuser_pass='" . $mysql['user_pass'] . "'";
$user_result = _mysqli_query($user_sql);
$user_row = $user_result->fetch_assoc();
if (!$user_row) {
$error['user'] = 'Your username or password is incorrect.';
}
//RECORD THIS USER LOGIN, into user_logs
$mysql['login_server'] = $db->real_escape_string(serialize($_SERVER));
$mysql['login_session'] = $db->real_escape_string(serialize($_SESSION));
$mysql['login_error'] = $db->real_escape_string(serialize($error));
$mysql['ip_address'] = $db->real_escape_string($_SERVER['REMOTE_ADDR']);
$mysql['login_time'] = time();
if ($error) {
$mysql['login_success'] = 0;
} else {
$mysql['login_success'] = 1;
}