本文整理汇总了PHP中Browser类的典型用法代码示例。如果您正苦于以下问题:PHP Browser类的具体用法?PHP Browser怎么用?PHP Browser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Browser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_save
public function action_save()
{
$msg = '';
$user_id = $this->request->post('user_id');
$b = new Browser();
$url = "https://api.vk.com/method/users.get?user_ids=" . $user_id;
$response = $b->openUrl($url)->jsonAsArray();
if (isset($response['response'])) {
foreach ($response['response'] as $user) {
$userRecord = ORM::factory('User')->where('user_id', '=', $user['uid'])->find_all();
if (count($userRecord)) {
$msg = 'Пользователь уже добавлен';
$this->template->content = View::factory('msg/error')->bind('msg', $msg);
} else {
$newUser = ORM::factory('User');
$newUser->user_id = $user['uid'];
$newUser->first_name = $user['first_name'];
$newUser->last_name = $user['last_name'];
if ($newUser->save()) {
$msg = "Добавлен";
$this->template->content = View::factory('msg/success')->bind('msg', $msg);
}
}
}
}
}
示例2: 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()");
}
示例3: cacheurl
function cacheurl($url, $browser_req = true, $cookies = "", $browser = "Firefox")
{
global $myconfig;
#find cache file
$hash = md5($url);
$datei = "cache/" . $hash;
if (file_exists($datei)) {
if (time() - filemtime($datei) < $myconfig['cachetime']) {
return implode('', file($datei));
}
}
#no cache file exists send browser request
if ($browser_req == true) {
$objekt = new Browser($browser);
if ($cookies != "") {
$objekt->cookies_set($cookies);
}
$objekt->url = $url;
$t_html = $objekt->read();
} else {
$t_html = implode('', file($url));
}
d_write($datei, $t_html);
return $t_html;
}
示例4: 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('');
}
示例5: 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.');
}
}
}
示例6: 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));
}
示例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: __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);
}
示例9: 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;
}
}
示例10: __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);
}
示例11: 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();
}
}
示例12: set
public function set($message, $params = array())
{
$browser = new Browser();
$model = new Timeline();
$model->user_id = Yii::app()->user->id;
$model->message = Yii::t('timeline', $message, $params);
$model->user_agent = $browser->getUserAgent();
$model->ip = CMS::getip();
$model->user_platform = $browser->getPlatform();
$model->save(false, false, false);
}
示例13: 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;
}
}
示例14: myvideo_flv_download
/**
* Parse the video url of a given myvideo video link site
* and returns the http url of the video
* *
* @param string $url
* url of video must contain watch/*
* http://www.myvideo.de/watch/7125794
* @return string
* the url of the video as http url; should the flv file
*/
function myvideo_flv_download($url)
{
preg_match('|watch/(\\d+)/|i', $url, $match);
$objekt = new Browser($browser);
if ($cookies != "") {
$objekt->cookies_set($cookies);
}
$objekt->url = "http://www.myvideo.de/movie/" . $match[1];
$objekt->read();
$head = $objekt->returnHeader();
preg_match('/V\\=(.*?).flv/', $head['Location'], $matches);
return urldecode($matches[1]) . ".flv";
}
示例15: action_index
public function action_index($page = null)
{
$data['table'] = null;
try {
$browser = new Browser();
$data['table'] = $browser->bidding($page);
} catch (BrowserLoginException $e) {
Session::set_flash('alert', ['status' => 'danger', 'message' => e("Login error: " . $e->getMessage())]);
} catch (ParserException $e) {
Session::set_flash('alert', ['status' => 'danger', 'message' => e("Parser error: " . $e->getMessage())]);
}
$this->template->title = 'Bidding list';
$this->template->content = View::forge('admin/bidding/index', $data);
}