本文整理汇总了PHP中Browser::getPlatform方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::getPlatform方法的具体用法?PHP Browser::getPlatform怎么用?PHP Browser::getPlatform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::getPlatform方法的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: 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: 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()");
}
示例4: 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.');
}
}
}
示例5: 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('');
}
示例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: __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);
}
示例8: __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);
}
示例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: 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);
}
示例11: array
$level_txt = '<strong>' . $lang_global['level2'] . '</strong>';
} else {
$array_mod = array();
foreach ($list_modules as $row_mod) {
if (!empty($row_mod['admins']) and in_array($row['admin_id'], explode(',', $row_mod['admins']))) {
$array_mod[] = $row_mod['custom_title'];
}
}
$level_txt = implode(', ', $array_mod);
}
$last_login = intval($row['last_login']);
$last_login = $last_login ? nv_date('l, d/m/Y H:i', $last_login) : $lang_module['last_login0'];
$last_agent = $row['last_agent'];
$_browser = new Browser($last_agent);
$browser = array('key' => $_browser->getBrowserKey(), 'name' => $_browser->getBrowser());
$os = array('key' => $_browser->getPlatformKey(), 'name' => $_browser->getPlatform());
$is_suspend = intval($row['is_suspend']);
if (empty($is_suspend)) {
$is_suspend = $lang_module['is_suspend0'];
} else {
$last_reason = unserialize($row['susp_reason']);
$last_reason = array_shift($last_reason);
list($susp_admin_id, $susp_admin_name) = $db->query('SELECT userid,first_name,last_name FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . intval($last_reason['start_admin']))->fetch(3);
$susp_admin_name = "<a href=\"" . NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&id=" . $susp_admin_id . "\">" . $susp_admin_name . "</a>";
$is_suspend = sprintf($lang_module['is_suspend1'], nv_date('d/m/Y H:i', $last_reason['starttime']), $susp_admin_name, $last_reason['info']);
}
$thead = array();
$thead['level'] = $level;
if (defined('NV_IS_GODADMIN')) {
$thead['edit'] = 1;
$thead['chg_is_suspend'] = $row['admin_id'] != $admin_info['admin_id'] ? 1 : 0;
示例12: isMobile
public static function isMobile($profile = 'mobile')
{
global $CFG;
if ($profile == 'never') {
return false;
}
if ($profile == 'always') {
return true;
}
$browser = new Browser();
//check by browser
switch ($browser->getBrowser()) {
case Browser::BROWSER_IPAD:
case Browser::BROWSER_IPOD:
case Browser::BROWSER_IPHONE:
case Browser::BROWSER_ANDROID:
case Browser::BROWSER_WINDOWS_PHONE:
return true;
}
//check by platform
switch ($browser->getPlatform()) {
case Browser::PLATFORM_IPHONE:
case Browser::PLATFORM_IPOD:
case Browser::PLATFORM_IPAD:
case Browser::PLATFORM_BLACKBERRY:
case Browser::PLATFORM_NOKIA:
case Browser::PLATFORM_ANDROID:
case Browser::PLATFORM_WINDOWS_CE:
case Browser::PLATFORM_WINDOWS_PHONE:
//case Browser::PLATFORM_MICROSOFT_SURFACE:
return true;
}
//end of switch
//if we are still not mobile, but webkit browwsers count, check that too
if ($profile == 'webkit') {
switch ($browser->getBrowser()) {
case Browser::BROWSER_SAFARI:
case Browser::BROWSER_ICAB:
case Browser::BROWSER_OMNIWEB:
case Browser::BROWSER_NOKIA_S60:
case Browser::BROWSER_CHROME:
return true;
}
}
return false;
}
示例13: _save
/**
* Save data
*
* @param Array $dataForms Data form
* @param Array &$return Return
* @param Array $post Post form
* @param String $submissionsData Submission Data
* @param String $fieldId Field Id
* @param String $dataContentEmail Data content Email
* @param Strig $nameFileByIndentifier Get name Field by Indentifier
* @param String $requiredField required field
* @param String $fileAttach Email File Attach
*
* @return boolean
*/
private function _save($dataForms, &$return, $post, $submissionsData, $dataContentEmail, $nameFileByIndentifier, $requiredField, $fileAttach)
{
$user = JFactory::getUser();
$ip = getenv('REMOTE_ADDR');
$country = $this->countryCityFromIP($ip);
$browser = new Browser();
$checkSaveSubmission = true;
$formSettings = !empty($dataForms->form_settings) ? json_decode($dataForms->form_settings) : "";
if (!empty($formSettings->action_save_submissions) && $formSettings->action_save_submissions == "No") {
$checkSaveSubmission = false;
}
if ($checkSaveSubmission) {
$table = JTable::getInstance('Submission', 'JSNUniformTable');
$table->bind(array('form_id' => (int) $post['form_id'], 'user_id' => $user->id, 'submission_ip' => $ip, 'submission_country' => $country['country'], 'submission_country_code' => $country['country_code'], 'submission_browser' => $browser->getBrowser(), 'submission_browser_version' => $browser->getVersion(), 'submission_browser_agent' => $browser->getUserAgent(), 'submission_os' => $browser->getPlatform(), 'submission_created_by' => $user->id, 'submission_created_at' => date('Y-m-d H:i:s'), 'submission_state' => 1));
if (!$table->store()) {
$return->error = $table->getError();
return false;
}
}
$this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_templates')->where("form_id = " . (int) $dataForms->form_id));
$dataTemplates = $this->_db->loadObjectList();
$this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_emails')->where("form_id = " . (int) $dataForms->form_id));
$dataEmails = $this->_db->loadObjectList();
$formSubmitter = isset($dataForms->form_submitter) ? json_decode($dataForms->form_submitter) : '';
$checkEmailSubmitter = true;
$defaultSubject = isset($dataForms->form_title) ? $dataForms->form_title . " [" . $dataForms->form_id . "]" : '';
if ($dataTemplates) {
foreach ($dataTemplates as $emailTemplate) {
if (!empty($emailTemplate->template_message)) {
$emailTemplate->template_message = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_message);
} else {
$htmlMessage = array();
if ($dataContentEmail) {
$htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
}
$emailTemplate->template_message = $htmlMessage;
}
$emailTemplate->template_subject = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_subject);
$emailTemplate->template_subject = !empty($emailTemplate->template_subject) ? $emailTemplate->template_subject : $defaultSubject;
$emailTemplate->template_from = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_from);
$emailTemplate->template_reply_to = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_reply_to);
$emailTemplate->template_subject = strip_tags($emailTemplate->template_subject);
$emailTemplate->template_from = strip_tags($emailTemplate->template_from);
$emailTemplate->template_reply_to = strip_tags($emailTemplate->template_reply_to);
if ($emailTemplate->template_notify_to == 0 && count($formSubmitter)) {
$checkEmailSubmitter = false;
$listEmailSubmitter = array();
foreach ($formSubmitter as $item) {
if (!empty($item)) {
$emailSubmitter = new stdClass();
$emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
if (!empty($emailSubmitter->email_address)) {
$listEmailSubmitter[] = $emailSubmitter;
}
}
}
$sent = $this->_sendEmailList($emailTemplate, $listEmailSubmitter, $fileAttach);
// Set the success message if it was a success
if (!JError::isError($sent)) {
$msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
}
}
if ($emailTemplate->template_notify_to == 1) {
$sent = $this->_sendEmailList($emailTemplate, $dataEmails, $fileAttach);
// Set the success message if it was a success
if (!JError::isError($sent)) {
$msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
}
}
}
}
if ($checkEmailSubmitter && count($formSubmitter)) {
$emailTemplate = new stdClass();
$htmlMessage = array();
if ($dataContentEmail) {
$htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
}
$emailTemplate->template_message = $htmlMessage;
$listEmailSubmitter = array();
foreach ($formSubmitter as $item) {
if (!empty($item)) {
$emailSubmitter = new stdClass();
$emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
if (!empty($emailSubmitter->email_address)) {
$listEmailSubmitter[] = $emailSubmitter;
//.........这里部分代码省略.........
示例14: unsubscribe
public function unsubscribe($id)
{
$browser = new Browser();
$userbrowser = $browser->getBrowser() . ' ' . $browser->getVersion();
$userplatform = $browser->getPlatform();
$userIP = $_SERVER["REMOTE_ADDR"];
$tracker = Tracker::find($id);
$tracker->unsubscribed = 1;
if ($tracker->IP_address == '') {
$tracker->IP_address = $userIP;
}
if ($tracker->browser == '') {
$tracker->browser = $userbrowser;
}
if ($tracker->platform == '') {
$tracker->platform = $userplatform;
}
if ($tracker->read == 0) {
$tracker->read = 1;
}
if ($tracker->read_at == '0000-00-00 00:00:00') {
$tracker->read_at = new Datetime();
}
$tracker->save();
$sub_id = $tracker->subscriber_id;
$subscriber = Subscriber::find($sub_id);
$subscriber->active = 0;
$subscriber->save();
echo "You have been successfully unsubscribed.";
}
示例15: foreach
//Headers
foreach ($column_names as $col) {
$array[0][] = $col;
}
foreach ($result as $row) {
foreach ($columns as $col) {
$array[$j][] = strip_tags($row[$col]);
}
$j++;
}
switch ($exportFormat) {
case 'xls':
//TODO add date if exists
$file_name = !empty($action) ? $action : 'company_report';
$browser = new Browser();
if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS) {
Export::export_table_xls_html($array, $file_name, 'ISO-8859-15');
} else {
Export::export_table_xls_html($array, $file_name);
}
break;
case 'csv':
default:
//TODO add date if exists
$file_name = !empty($action) ? $action : 'company_report';
Export::arrayToCsv($array, $file_name);
break;
}
exit;
}
$i = 0;