本文整理汇总了PHP中Browser::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::getVersion方法的具体用法?PHP Browser::getVersion怎么用?PHP Browser::getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::getVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
include ROOT . "/library/browser/Browser.php";
$browser = new Browser();
if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() < 7) {
flash_error(lang("ie browser outdated"));
}
if (is_ajax_request()) {
$timezone = array_var($_GET, 'utz');
if ($timezone && $timezone != '') {
$usu = logged_user();
if ($usu instanceof Contact && $usu->isUser() && !$usu->getDisabled()) {
$usu->setTimezone($timezone);
$usu->save();
}
}
$this->redirectTo('dashboard', 'main_dashboard');
} else {
if (!(logged_user() instanceof Contact && logged_user()->isUser())) {
$this->redirectTo('access', 'login');
}
$this->setLayout("website");
$this->setTemplate(get_template_path("empty"));
}
}
示例2: 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]);
}
示例3: 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.');
}
}
}
示例4: 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()");
}
示例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: __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);
}
示例7: __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);
}
示例8: 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;
}
}
示例9: 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();
}
}
示例10: 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;
}
}
示例11: isSupportedVersion
function isSupportedVersion()
{
$BrowserInfo = new Browser();
switch ($BrowserInfo->getBrowser()) {
case Browser::BROWSER_SAFARI:
return $BrowserInfo->getVersion() >= 5;
break;
case Browser::BROWSER_FIREFOX:
return $BrowserInfo->getVersion() >= 4;
break;
case Browser::BROWSER_IE:
return $BrowserInfo->getVersion() >= 10;
break;
case Browser::BROWSER_CHROME:
return $BrowserInfo->getVersion() >= 10;
break;
case Browser::BROWSER_OPERA:
return intval($BrowserInfo->getVersion()) >= 12;
break;
}
return true;
}
示例12: 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;
}
示例13: readResourceMap
public function readResourceMap()
{
if (!$this->resoure_map) {
$context = \CADB\Model\Context::instance();
$map_file = CADB_PATH . "/config/resources.map.json";
if (file_exists($map_file)) {
$fp = fopen($map_file, "r");
$json = trim(fread($fp, filesize($map_file)));
fclose($fp);
$this->resource_map = json_decode($json, true);
}
$browser = new \Browser();
if ($browser->getBrowser() == \Browser::BROWSER_IE && $browser->getVersion() <= 9) {
$fallback_map_file = CADB_PATH . "/config/resources.map.fallback.json";
$this->mergeMap($fallback_map_file, "", true);
}
}
return $this->resource_map;
}
示例14: index
/**
* ControllerCommonHeader::index()
*
* @return
*/
protected function index()
{
if ($this->request->hasQuery('hl')) {
$this->session->set('language', $this->request->getQuery('hl'));
if ($this->session->has('redirect')) {
$this->redirect($this->session->get('redirect'));
} else {
$this->redirect(Url::createAdminUrl('common/home'));
}
}
$this->load->language('common/header');
$this->data['title'] = $this->document->title . " | NecoTienda";
$this->data['breadcrumbs'] = $this->document->breadcrumbs;
$this->data['heading_title'] = $this->language->get('heading_title');
$this->load->library('browser');
$browser = new Browser();
if ($browser->getBrowser() == 'Internet Explorer' && $browser->getVersion() <= 8) {
$this->redirect(Url::createUrl("page/deprecated", null, 'NONSSL', HTTP_CATALOG));
}
if (!$this->user->validSession()) {
$this->data['logged'] = '';
$this->data['home'] = Url::createAdminUrl('common/login');
} else {
$this->data['logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
if ($this->session->has('success')) {
$this->data['success'] = $this->session->get('success');
$this->session->clear('success');
}
if ($this->session->has('error')) {
$this->data['error'] = $this->session->get('error');
$this->session->clear('error');
}
$this->load->auto("setting/store");
$this->data['stores'] = $this->modelStore->getAll();
}
$this->loadCss();
$this->id = 'header';
$this->template = 'common/header.tpl';
$this->render();
}
示例15: getBrowserMajorVersion
/**
* Get browser major version
*
* @return string
*/
public static function getBrowserMajorVersion()
{
if (!class_exists('Browser')) {
t3import('core.libs.browser');
}
$browser = new Browser();
$bver = explode('.', $browser->getVersion());
return $bver[0];
//Major version only
}