本文整理汇总了PHP中Browser::setUserAgent方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::setUserAgent方法的具体用法?PHP Browser::setUserAgent怎么用?PHP Browser::setUserAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::setUserAgent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserAgent
/**
* Определение браузера
* @return string браузер и версия браузера
*/
public static function getUserAgent($userAgent = null)
{
$browser = new Browser();
if ($userAgent) {
$browser->setUserAgent($userAgent);
}
$brow = $browser->getBrowser();
$version = implode('.', array_slice(explode('.', $browser->getVersion()), 0, 2));
return $version == 'unknown' ? $brow : $brow . ' ' . $version;
}
示例2: Browser
// check if IP exists
if (empty($r['ip'])) {
continue;
}
break;
default:
break;
}
$displayDate = $GROUPED;
$browsingTime = $GROUPED;
$interactionTime = $GROUPED;
$numClicks = $GROUPED;
$numNotes = $GROUPED;
} else {
$browser = new Browser();
$browser->setUserAgent($r['user_agent']);
// display a start on first time visitors
$ftu = $r['ftu'] ? ' class="ftu"' : null;
$abbrDate = date('Y/m/d', strtotime($r['sess_date']));
// use pretty date?
$displayDate = $usePrettyDate ? '<abbr title="' . prettyDate::getStringResolved($r['sess_date']) . '">' . $abbrDate . '</abbr>' : $abbrDate;
$browsingTime = $r['sess_time'];
//$locationId = mask_client(md5($r['ip']));
$lang = $browser->getLanguage();
if ($lang != $browser::LANGUAGE_UNKNOWN) {
$locationId = '<img src="styles/blank.gif" class="flag flag-' . $lang . '" alt="' . $lang . '" title="' . $lang . '" />';
} else {
$locationId = "?";
}
$displayId = 'id=' . $r['id'];
$pageId = $r['cache_id'];
示例3: agentStatistics
public function agentStatistics()
{
$result = array();
$model = Statistics::model()->findAll();
foreach ($model as $data) {
$agent = $data->terminal;
$browser = new Browser();
$browser->setUserAgent($agent);
$browserinfo = str_replace(array(' ', '.'), array('_', '-'), $browser->getBrowser());
$version = str_replace(array(' ', '.'), array('_', '-'), $browser->getVersion());
$platform = str_replace(array(' ', '.'), array('_', '-'), $browser->getPlatform());
// $aolversion = str_replace(array(' ','.'), array('_','-'),$browser->getAolVersion());
$result['Agent'][$browserinfo][$version] += 1;
$result['Platform'][$platform] += 1;
}
return $result;
}
示例4: detectPlatform
public static function detectPlatform($userAgent)
{
Yii::import('app.addons.Browser');
$platform = new Browser();
$platform->setUserAgent($userAgent);
return $platform->getPlatform();
}