本文整理汇总了PHP中Browser类的典型用法代码示例。如果您正苦于以下问题:PHP Browser类的具体用法?PHP Browser怎么用?PHP Browser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Browser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
}
}
开发者ID:stellio,项目名称:vTrack,代码行数:26,代码来源:User.php
示例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()");
}
开发者ID:josueaponte7,项目名称:necotienda_standalone,代码行数:7,代码来源:manufacturer.php
示例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;
}
开发者ID:BackupTheBerlios,项目名称:onlinestreams-svn,代码行数:25,代码来源:inc.php
示例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('');
}
开发者ID:un44444444,项目名称:chenwei,代码行数:25,代码来源:ipcover.php
示例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.');
}
}
}
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:31,代码来源:HelpController.php
示例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));
}
开发者ID:hurradieweltgehtunter,项目名称:Framework---relo,代码行数:26,代码来源:log.class.php
示例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;
}
}
开发者ID:joszz,项目名称:phppi,代码行数:33,代码来源:phppi.php
示例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);
}
开发者ID:koanreview,项目名称:demo-sentinel,代码行数:11,代码来源:Persistence.php
示例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;
}
}
开发者ID:watsonad,项目名称:gpoa,代码行数:9,代码来源:functions.php
示例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);
}
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:57,代码来源:journal2_html_classes.php
示例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();
}
}
开发者ID:josueaponte7,项目名称:necotienda_standalone,代码行数:10,代码来源:search.php
示例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);
}
开发者ID:buildshop,项目名称:bs-common,代码行数:11,代码来源:CTimeline.php
示例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;
}
}
开发者ID:Michaeldgeek,项目名称:NacossUnn,代码行数:13,代码来源:FeedBack.php
示例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";
}
开发者ID:BackupTheBerlios,项目名称:onlinestreams-svn,代码行数:23,代码来源:MyVideo.php
示例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);
}
开发者ID:notfoundsam,项目名称:yahooauc,代码行数:14,代码来源:bidding.php
示例16: 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;
}
开发者ID:xxcrashblackxx,项目名称:bnc-1,代码行数:14,代码来源:ControlAdmin.php
示例17: getHeaders
private function getHeaders($url)
{
loadNitroLib('browser');
$browser = new Browser($url);
try {
$browser->fetch("HEAD");
$headers = $browser->getHeaders();
} catch (Exception $e) {
if (NITRO_DEBUG_MODE) {
$this->log->write('[NitroBrowser]: ' . $e->getMessage());
}
return false;
}
return $headers;
}
开发者ID:artlabsdesign,项目名称:missbloom,代码行数:15,代码来源:nitro_htaccess.php
示例18: getOSData
public function getOSData()
{
$cols = array('meta1', 'clicks', 'click_throughs', 'click_through_rates', 'leads', 'conv', 'payout', 'epc', 'income');
$sql = 'select adv.platform_id, ';
$sql .= getReportGeneralSelects() . 'from ';
$sql .= getReportFilters('platforms/os', 'left join bt_s_clicks_advanced as adv on (click.click_id=adv.click_id)');
$sql .= ' and adv.platform_id > 0 group by adv.platform_id ';
$result = DB::getRows($sql);
$cnt = count($result);
DB::query("delete from bt_c_statcache where user_id='" . DB::quote(getUserId()) . "' and type='platos'");
$bulk = new DB_Bulk_Insert('bt_c_statcache', array('user_id', 'type', 'clicks', 'click_throughs', 'click_through_rates', 'leads', 'conv', 'payout', 'epc', 'income', 'meta1'));
foreach ($result as $row) {
$row['platform_name'] = Browser::getPlatformName($row['platform_id']);
if (!$row['platform_name']) {
$row['platform_name'] = '[unknown os]';
}
$bulk->insert(array(DB::quote(getUserId()), "'platos'", $row['clicks'], $row['click_throughs'], $row['click_through_rates'], $row['leads'], $row['conv'], $row['payout'], $row['epc'], $row['income'], "'" . DB::quote($row['platform_name']) . "'"));
}
$bulk->execute();
$sql = "select * from bt_c_statcache where user_id='" . DB::quote(getUserId()) . "' and type='platos' ";
$sql .= getReportOrder($cols);
$sql .= getReportLimits();
$result = DB::getRows($sql);
return array('data' => $result, 'cnt' => $cnt, 'cols' => $cols);
}
开发者ID:sakibanda,项目名称:ballistic-tracking,代码行数:25,代码来源:PlatformsController.php
示例19: assignCompanyInfoAndTheme
function assignCompanyInfoAndTheme()
{
$this->assign('url', Settings::Get('hosturl', Resources::Get('site.url')));
$this->assign('company', Settings::Get('company_name', Resources::Get('company.webim')));
$this->assign('logo', Settings::Get('logo', WEBIM_ROOT . '/themes/default/images/logo.gif'));
$this->assign('theme', Browser::getCurrentTheme());
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:7,代码来源:class.smartyclass.php
示例20: create
/**
*
* @param Application $app
* @param databox $databox
* @param Browser $browser
*
* @return Session_Logger
*/
public static function create(Application $app, databox $databox, Browser $browser)
{
$colls = [];
if ($app['authentication']->getUser()) {
$bases = $app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]);
foreach ($bases as $collection) {
$colls[] = $collection->get_coll_id();
}
}
$conn = $databox->get_connection();
$sql = "INSERT INTO log\n (id, date,sit_session, user, site, usrid, nav,\n version, os, res, ip, user_agent,appli, fonction,\n societe, activite, pays)\n VALUES\n (null,now() , :ses_id, :usr_login, :site_id, :usr_id\n , :browser, :browser_version, :platform, :screen, :ip\n , :user_agent, :appli, :fonction, :company, :activity, :country)";
$params = [':ses_id' => $app['session']->get('session_id'), ':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getLogin() : null, ':site_id' => $app['conf']->get(['main', 'key']), ':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->getId() : null, ':browser' => $browser->getBrowser(), ':browser_version' => $browser->getExtendedVersion(), ':platform' => $browser->getPlatform(), ':screen' => $browser->getScreenSize(), ':ip' => $browser->getIP(), ':user_agent' => $browser->getUserAgent(), ':appli' => serialize([]), ':fonction' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getJob() : null, ':company' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCompany() : null, ':activity' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getActivity() : null, ':country' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCountry() : null];
$stmt = $conn->prepare($sql);
$stmt->execute($params);
$log_id = $conn->lastInsertId();
$stmt->closeCursor();
$sql = "INSERT INTO log_colls (id, log_id, coll_id) VALUES (null, :log_id, :coll_id)";
$stmt = $conn->prepare($sql);
foreach ($colls as $collId) {
$stmt->execute([':log_id' => $log_id, ':coll_id' => $collId]);
}
$stmt->closeCursor();
unset($stmt, $conn);
return new Session_Logger($databox, $log_id);
}
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:33,代码来源:Logger.php
注:本文中的Browser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论