本文整理汇总了PHP中Browser::getBrowser方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::getBrowser方法的具体用法?PHP Browser::getBrowser怎么用?PHP Browser::getBrowser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::getBrowser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
Yii::import('app.addons.Browser');
$browser = new Browser();
if ($browser->getBrowser() == Browser::BROWSER_FIREFOX) {
$browserIcon = 'flaticon-firefox';
} elseif ($browser->getBrowser() == Browser::BROWSER_SAFARI) {
$browserIcon = 'flaticon-safari';
} elseif ($browser->getBrowser() == Browser::BROWSER_OPERA) {
$browserIcon = 'flaticon-opera';
} elseif ($browser->getBrowser() == Browser::BROWSER_CHROME) {
$browserIcon = 'flaticon-chrome';
} elseif ($browser->getBrowser() == Browser::BROWSER_IE) {
$browserIcon = 'flaticon-explorer';
}
if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS) {
$platformIcon = 'flaticon-windows';
} elseif ($browser->getPlatform() == Browser::PLATFORM_WINDOWS_8) {
//no tested
$platformIcon = 'flaticon-windows8';
} elseif ($browser->getPlatform() == Browser::PLATFORM_ANDROID) {
$platformIcon = 'flaticon-android';
} elseif ($browser->getPlatform() == Browser::PLATFORM_LINUX) {
$platformIcon = 'flaticon-linux';
} elseif ($browser->getPlatform() == Browser::PLATFORM_APPLE) {
$platformIcon = 'flaticon-apple ';
}
$this->render($this->skin, array('platformIcon' => $platformIcon, 'browserIcon' => $browserIcon, 'browser' => $browser));
}
示例2: __construct
public function __construct()
{
$browser = new Browser();
/* browser name */
$browser_name = null;
switch ($browser->getBrowser()) {
case Browser::BROWSER_CHROME:
$browser_name = 'chrome';
$this->addClass('webkit');
break;
case Browser::BROWSER_FIREFOX:
$browser_name = 'firefox';
break;
case Browser::BROWSER_IE:
$browser_name = 'ie';
break;
case Browser::BROWSER_SAFARI:
$browser_name = 'safari';
$this->addClass('webkit');
break;
case Browser::BROWSER_OPERA:
$browser_name = 'opera';
$this->addClass('webkit');
break;
default:
$browser_name = strtolower(str_replace(' ', '', $browser->getBrowser()));
}
/* browser version */
$version = explode('.', $browser->getVersion());
$version = is_array($version) && count($version) ? $version[0] : '';
/* browser platform */
$platform = null;
switch ($browser->getPlatform()) {
case Browser::PLATFORM_ANDROID:
$platform = 'android';
break;
case Browser::PLATFORM_APPLE:
$platform = 'mac';
break;
case Browser::PLATFORM_IPAD:
$platform = 'ipad';
break;
case Browser::PLATFORM_IPHONE:
$platform = 'iphone';
break;
case Browser::PLATFORM_LINUX:
$platform = 'linux';
break;
case Browser::PLATFORM_WINDOWS:
$platform = 'win';
break;
}
/* add classes */
$this->addClass($browser_name);
$this->addClass($browser_name . $version);
$this->addClass($platform);
}
示例3: add
public function add()
{
$this->load->library('browser');
$browser = new Browser();
if ($browser->getBrowser() != 'GoogleBot') {
$sql = "INSERT INTO " . DB_PREFIX . "search SET \r\n `customer_id` = '" . (int) $this->customer->getId() . "',\r\n store_id = '" . (int) STORE_ID . "', \r\n `request` = '" . $this->db->escape(serialize($_REQUEST)) . "',\r\n `urlQuery` = '" . $this->db->escape($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) . "',\r\n `browser` = '" . $this->db->escape($browser->getBrowser()) . "',\r\n `browser_version`= '" . $this->db->escape($browser->getVersion()) . "',\r\n `os` = '" . $this->db->escape($browser->getPlatform()) . "',\r\n `ip` = '" . $this->db->escape($_SERVER['REMOTE_ADDR']) . "',\r\n `date_added` = NOW()";
$this->db->query($sql);
return $this->db->getLastId();
}
}
示例4: recordVisit
private function recordVisit()
{
$internal = false;
$referer = @$_SERVER['HTTP_REFERER'];
$referer_url = parse_url($referer);
if (strtolower(@$referer_url['host']) === strtolower(@$_SERVER['HTTP_HOST'])) {
$referer = @$referer_url['path'] . (@$referer_url['query'] ? '?' . @$referer_url['query'] : '');
$internal = true;
}
$browser = new \Browser();
$visitor_table = $this->curator->tableName(SchemaCurator::VISIT_TABLE);
$unique = false;
$this->db->insert($visitor_table, ['datetime' => new \DateTime(), 'verb' => @$_SERVER['REQUEST_METHOD'], 'generate' => $this->generated, 'port' => @$_SERVER['SERVER_PORT'], 'memory' => $this->memory, 'status' => http_response_code(), 'address_id' => $this->getLinkedResourceId(SchemaCurator::ADDRESS_TABLE, 'address', @$_SERVER['REMOTE_ADDR']), 'host_id' => $this->getLinkedResourceId(SchemaCurator::HOST_TABLE, 'host', @$_SERVER['HTTP_HOST']), 'path_id' => $this->getLinkedResourceId(SchemaCurator::PATH_TABLE, 'path', @$_SERVER['REQUEST_URI']), 'referer_id' => $this->getLinkedResourceId(SchemaCurator::REFERER_TABLE, 'referer', $referer), 'browser_id' => $this->getLinkedResourceId(SchemaCurator::BROWSER_TABLE, 'browser', $browser->getBrowser() === \Browser::BROWSER_UNKNOWN ? '' : $browser->getBrowser()), 'browser_version_id' => $this->getLinkedResourceId(SchemaCurator::BROWSER_VERSION_TABLE, 'browser_version', $browser->getVersion() === \Browser::VERSION_UNKNOWN ? '' : $browser->getVersion()), 'platform_id' => $this->getLinkedResourceId(SchemaCurator::PLATFORM_TABLE, 'platform', $browser->getPlatform() === \Browser::PLATFORM_UNKNOWN ? '' : $browser->getPlatform()), 'session_id' => $this->getLinkedResourceId(SchemaCurator::SESSION_TABLE, 'session', $this->session_id, $unique), 'is_secure' => isset($_SERVER['HTTPS']), 'is_unique' => $unique, 'is_internal' => $internal], [Type::DATETIME]);
}
示例5: log
public static function log($logType, $user = false, $data1 = false)
{
$browser = new Browser();
$text = '';
$timestamp = time();
if ($user !== false) {
$userId = $user->get('id');
} else {
$userId = 0;
}
$data = '';
switch ($logType) {
case 3:
foreach ($data1 as $key => $value) {
$data .= ' ' . $key . ': ' . $value . '|';
}
break;
case 4:
$data = 'Plattform: ' . $browser->getPlatform() . ' | Browser: ' . $browser->getBrowser() . ' | Version: ' . $browser->getVersion() . ' | UserAgent: ' . $browser->getUserAgent();
break;
default:
break;
}
$text = Texter::get('log|' . $logType);
database::Query('INSERT INTO log (`type`, `text`, `data`, `userId`, `timestamp`) VALUES (' . $logType . ', :var1, :var2, :var3, :var4);', array('var1' => $text, 'var2' => $data, 'var3' => $userId, 'var4' => $timestamp));
}
示例6: updateStats
public function updateStats($manufacturer_id, $customer_id)
{
$this->load->library('browser');
$browser = new Browser();
$this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET viewed = viewed + 1 WHERE manufacturer_id = '" . (int) $manufacturer_id . "'");
$this->db->query("INSERT " . DB_PREFIX . "stat SET \n `object_id` = '" . (int) $manufacturer_id . "',\n `store_id` = '" . (int) STORE_ID . "',\n `customer_id` = '" . (int) $customer_id . "',\n `object_type` = 'manufacturer',\n `server` = '" . $this->db->escape(serialize($_SERVER)) . "',\n `session` = '" . $this->db->escape(serialize($_SESSION)) . "',\n `request` = '" . $this->db->escape(serialize($_REQUEST)) . "',\n `store_url` = '" . $this->db->escape($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) . "',\n `ref` = '" . $this->db->escape($_SERVER['HTTP_REFERER']) . "',\n `browser` = '" . $this->db->escape($browser->getBrowser()) . "',\n `browser_version`= '" . $this->db->escape($browser->getVersion()) . "',\n `os` = '" . $this->db->escape($browser->getPlatform()) . "',\n `ip` = '" . $this->db->escape($_SERVER['REMOTE_ADDR']) . "',\n `date_added` = NOW()");
}
示例7: setThemeMode
function setThemeMode()
{
require 'phppi/includes/classes/browser.php';
$browser = new Browser();
$this->vars['isIE'] = false;
switch ($browser->getBrowser()) {
case Browser::BROWSER_ANDROID:
$this->vars['theme_mode'] = 'mobile';
if ($this->settings['disable_popup_image_viewer_for_mobile'] == true) {
$this->settings['use_popup_image_viewer'] = false;
}
break;
case Browser::BROWSER_IPHONE:
$this->vars['theme_mode'] = 'mobile';
if ($this->settings['disable_popup_image_viewer_for_mobile'] == true) {
$this->settings['use_popup_image_viewer'] = false;
}
break;
case Browser::BROWSER_IPOD:
$this->vars['theme_mode'] = 'mobile';
if ($this->settings['disable_popup_image_viewer_for_mobile'] == true) {
$this->settings['use_popup_image_viewer'] = false;
}
break;
case Browser::BROWSER_IE:
$this->vars['theme_mode'] = 'standard';
$this->vars['isIE'] = true;
break;
default:
$this->vars['theme_mode'] = 'standard';
break;
}
}
示例8: action_index
public function action_index()
{
if (!function_exists('imagetypes')) {
die("ERROR: GD LIB IS NOT LOADED!");
}
//header("Content-type: image/png");
$this->response->headers('Content-type', 'image/png');
/*=================*/
$im = @imagecreatefrompng(APPPATH . "cover.png");
//读取图片名
$color = imagecolorallocate($im, 183, 150, 37);
//文字颜色
$client_address = $_SERVER["REMOTE_ADDR"];
//$user_agent = $_SERVER['HTTP_USER_AGENT'];
//$client_system = $this->_get_system($user_agent);
//$client_browser = $this->_get_browser($user_agent);
$browser = new Browser();
$client_system = $browser->getPlatform();
$client_browser = $browser->getBrowser();
imagestring($im, 3, 125, 44, "[ From {$client_address} / {$client_system} / {$client_browser} ]", $color);
//($im,字大小,左右,上下)
imagepng($im);
imagedestroy($im);
//$this->response->body('');
}
示例9: do_help
public function do_help()
{
$user = Sentry::getUser();
$subject = "Newsletter Help: " . Input::get('subject');
$emailbody = Input::get('message');
$from_name = $user->first_name . ' ' . $user->last_name;
$from_email = $user->email;
$admin = User::first();
$to_name = $admin->first_name . ' ' . $admin->last_name;
$to_email = $admin->email;
$rules = array('subject' => 'required|max:128', 'message' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('dashboard/help')->withErrors($validator);
} else {
$browser = new Browser();
$userbrowser = $browser->getBrowser() . ' ' . $browser->getVersion();
$userplatform = $browser->getPlatform();
$userIP = $_SERVER["REMOTE_ADDR"];
$page = URL::current();
$data = array('emailbody' => $emailbody, 'userbrowser' => $userbrowser, 'userplatform' => $userplatform, 'userIP' => $userIP, 'page' => $page);
$issent = Mail::send('emails.help-email', $data, function ($message) use($from_email, $from_name, $subject, $to_name, $to_email) {
$message->from($from_email, $from_name)->to($to_email, $to_name)->subject($subject);
});
if ($issent) {
return Redirect::to('dashboard/help')->with('success', 'Success! You will be contacted soon regarding your issue.');
} else {
return Redirect::to('dashboard/help')->with('error', 'An error was encountered sending the email. Please try again.');
}
}
}
示例10: __construct
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = array())
{
$browser = new Browser();
$attributes['version'] = $browser->getVersion();
$attributes['platform'] = $browser->getPlatform();
$attributes['browser'] = $browser->getBrowser();
parent::__construct($attributes);
}
示例11: ie_version
function ie_version($output)
{
$browser = new Browser();
if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() < 10) {
return $output . ' class="ie"';
} else {
return $output;
}
}
示例12: getBrowser
/**
* Returns the name of the browser with the given user agent.
*
* @param string $userAgent
* @return string
*/
public static function getBrowser($userAgent = '')
{
require_once CMS_DIR . 'lib/util/Browser.php';
$browser = new \Browser($userAgent);
if (!$browser->isRobot()) {
return $browser->getBrowser();
}
return 'unknown';
}
示例13: sd_get_browser_icon
function sd_get_browser_icon()
{
$icons = array('Opera' => 'opera', 'Opera Mini' => 'opera', 'Internet Explorer' => 'internet-explorer', 'Pocket Internet Explorer' => 'internet-explorer', 'Firefox' => 'firefox', 'Safari' => 'safari', 'iPhone' => 'mobile', 'iPod' => 'mobile', 'iPad' => 'tablet', 'Chrome' => 'chrome', 'Android' => 'android');
$browser = new Browser();
$browser_name = $browser->getBrowser();
$icon = 'home';
if (isset($icons[$browser_name])) {
$icon = $icons[$browser_name];
}
return $icon;
}
示例14: initCanvas
private function initCanvas($data)
{
$data = json_decode($data);
$this->ip = $this->validateInput($_SERVER['REMOTE_ADDR']);
$this->message = filter_var($data->note, FILTER_SANITIZE_STRING);
$browser = new Browser();
$this->browser = "Name of browser " . $browser->getBrowser() . " Version " . $browser->getVersion();
$this->isBrowserMobile = $browser->isMobile();
$this->url = is_null($data->url) ? null : $data->url;
if (!is_null($data->img)) {
$this->img = $data->img;
}
}
示例15: getLogLogin
function getLogLogin($q)
{
$queris = "SELECT * FROM t_loglogin_bnc where uname = '" . $this->db->amanin($q) . "' order by id DESC LIMIT 5";
$data = $this->db->selectData($queris);
$h = "";
for ($i = 0; $i < count($data); $i++) {
$browser = new Browser($data[$i]["user_agent"]);
$h .= '<li class="collection-item dismissable">';
$h .= '<label for="task1">' . $browser->getOS() . '/' . $browser->getBrowser() . ' ' . $browser->getVersion() . '<a href="javascript:void(0);" class="secondary-content"><span class="ultra-small">' . $this->ubahTimeStamp($data[$i]["tgl"]) . '</span></a></label>';
$h .= '<span class="task-cat teal">' . $data[$i]["ip"] . '</span>';
$h .= '</li>';
}
return $h;
}