当前位置: 首页>>代码示例>>PHP>>正文


PHP Input::user_agent方法代码示例

本文整理汇总了PHP中Input::user_agent方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::user_agent方法的具体用法?PHP Input::user_agent怎么用?PHP Input::user_agent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Input的用法示例。


在下文中一共展示了Input::user_agent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: read

 /**
  * read the session
  *
  * @access public
  * @param
  *        	boolean, set to true if we want to force a new session to be created
  * @return Fuel\Core\Session_Driver
  */
 public function read($force = false)
 {
     // initialize the session
     $this->data = array();
     $this->keys = array();
     $this->flash = array();
     // get the session cookie
     $payload = $this->_get_cookie();
     // validate it
     if ($payload === false or $force) {
         // not a valid cookie, or a forced session reset
     } elseif (!isset($payload[0]) or !is_array($payload[0])) {
         // not a valid cookie payload
     } elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
         // session has expired
     } elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
         // IP address doesn't match
     } elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent()) {
         // user agent doesn't match
     } else {
         // session is valid, retrieve the payload
         if (isset($payload[0]) and is_array($payload[0])) {
             $this->keys = $payload[0];
         }
         if (isset($payload[1]) and is_array($payload[1])) {
             $this->data = $payload[1];
         }
         if (isset($payload[2]) and is_array($payload[2])) {
             $this->flash = $payload[2];
         }
     }
     return parent::read();
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:41,代码来源:cookie.php

示例2: read

 /**
  * read the session
  *
  * @access	public
  * @param	boolean, set to true if we want to force a new session to be created
  * @return	Fuel\Core\Session_Driver
  */
 public function read($force = false)
 {
     // initialize the session
     $this->data = array();
     $this->keys = array();
     $this->flash = array();
     // get the session cookie
     $payload = $this->_get_cookie();
     // validate it
     if ($force) {
         // a forced session reset
     } elseif ($payload === false) {
         // no cookie found
     } elseif (!isset($payload[0]) or !is_array($payload[0])) {
         logger('DEBUG', 'Error: not a valid cookie payload!');
     } elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
         logger('DEBUG', 'Error: session id has expired!');
     } elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
         logger('DEBUG', 'Error: IP address in the session doesn\'t match this requests source IP!');
     } elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent()) {
         logger('DEBUG', 'Error: User agent in the session doesn\'t match the browsers user agent string!');
     } else {
         // session is valid, retrieve the payload
         if (isset($payload[0]) and is_array($payload[0])) {
             $this->keys = $payload[0];
         }
         if (isset($payload[1]) and is_array($payload[1])) {
             $this->data = $payload[1];
         }
         if (isset($payload[2]) and is_array($payload[2])) {
             $this->flash = $payload[2];
         }
     }
     return parent::read();
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:42,代码来源:cookie.php

示例3: check_legacy_ie

 public static function check_legacy_ie($criteria_version = 8)
 {
     if (!$criteria_version) {
         return false;
     }
     if (!preg_match('/MSIE\\s([\\d.]+)/i', \Input::user_agent(), $matches)) {
         return false;
     }
     $version = floor($matches[1]);
     return $version <= $criteria_version;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:11,代码来源:agent.php

示例4: create

 /**
  * create a new session
  *
  * @access	public
  * @return	Fuel\Core\Session_Cookie
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     $this->keys['payload'] = '';
     return $this;
 }
开发者ID:highestgoodlikewater,项目名称:webspider-1,代码行数:17,代码来源:cookie.php

示例5: create

 /**
  * create a new session
  *
  * @access	public
  * @return	Fuel\Core\Session_Memcached
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['previous_id'] = $this->keys['session_id'];
     // prevents errors if previous_id has a unique index
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     return $this;
 }
开发者ID:highestgoodlikewater,项目名称:webspider-1,代码行数:18,代码来源:memcached.php

示例6: create

 /**
  * create a new session
  *
  * @access	public
  * @return	void
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['ip_address'] = \Input::real_ip();
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     $this->keys['payload'] = '';
     // and set the session cookie
     $this->_set_cookie();
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:18,代码来源:cookie.php

示例7: action_send

 public function action_send()
 {
     // CSRF対策
     if (!Security::check_token()) {
         throw new HttpInvalidInputException('ページ遷移が正しくありません');
     }
     $form = $this->forge_form();
     $val = $form->validation()->add_callable('MyValidationRules');
     if (!$val->run()) {
         $form->repopulate();
         $this->template->title = 'コンタクトフォーム: エラー';
         $this->template->content = View::forge('form/index');
         $this->template->content->set_safe('html_error', $val->show_errors());
         $this->template->content->set_safe('html_form', $form->build('form/confirm'));
         return;
     }
     $post = $val->validated();
     $post['ip_address'] = Input::ip();
     $post['user_agent'] = Input::user_agent();
     unset($post['submit']);
     // データベースへ保存
     $model_form = Model_Form::forge($post);
     $ret = $model_form->save();
     if (!$ret) {
         Log::error('データベース保存エラー', __METHOD__);
         $form->repopulate();
         $this->template->title = 'コンタクトフォーム: サーバエラー';
         $this->template->content = View::forge('form/index');
         $html_error = '<p>サーバでエラーが発生しました。</p>';
         $this->template->content->set_safe('html_error', $html_error);
         $this->template->content->set_safe('html_form', $form->build('form/confirm'));
         return;
     }
     // メールの送信
     try {
         $mail = new Model_Mail();
         $mail->send($post);
         $this->template->title = 'コンタクトフォーム: 送信完了';
         $this->template->content = View::forge('form/send');
         return;
     } catch (EmailValidationFailedException $e) {
         Log::error('メール検証エラー: ' . $e->getMessage(), __METHOD__);
         $html_error = '<p>メールアドレスに誤りがあります。</p>';
     } catch (EmailSendingFailedException $e) {
         Log::error('メール送信エラー: ' . $e->getMessage(), __METHOD__);
         $html_error = '<p>メールを送信できませんでした。</p>';
     }
     $form->repopulate();
     $this->template->title = 'コンタクトフォーム: 送信エラー';
     $this->template->content = View::forge('form/index');
     $this->template->content->set_safe('html_error', $html_error);
     $this->template->content->set_safe('html_form', $form->build('form/confirm'));
 }
开发者ID:sato5603,项目名称:fuelphp1st-2nd,代码行数:53,代码来源:form.php

示例8: response

 public function response()
 {
     $error_code = $this->getMessage();
     $error_list = Lang::load('error/user', $error_code);
     if (!isset($error_list[$error_code])) {
         $error_code = \Model_Error::ER00001;
     }
     $error_message = $error_list[$error_code];
     $params = array('error_code' => $error_code, 'error_message' => $error_message, 'line' => $this->getLine(), 'file' => $this->getFile(), 'url' => Uri::main(), 'input' => print_r(Input::all(), true), 'real_ip' => Input::real_ip(), 'user_agent' => Input::user_agent(), 'user_id' => Auth::get_user_id(), 'occurred_at' => date('Y/m/d H:i:s'));
     $email = new Model_Email();
     $email->sendMailByParams('error', $params);
     $response = \Request::forge('errors/index', false)->execute($params)->response();
     return $response;
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:14,代码来源:systemexception.php

示例9: end

 public static function end()
 {
     // cookie details
     $name = Config::get('session.name', 'anchorcms');
     $expire = time() + Config::get('session.expire', 86400);
     $path = Config::get('session.path', '/');
     $domain = Config::get('session.domain', '');
     // update db session
     Db::update('sessions', array('date' => date(DATE_ISO8601), 'ip' => Input::ip_address(), 'ua' => Input::user_agent(), 'data' => serialize(static::$data)), array('id' => static::$id));
     // create cookie with ID
     if (!Cookie::write($name, static::$id, $expire, $path, $domain)) {
         Log::error('Could not write session cookie: ' . static::$id);
     }
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:14,代码来源:session.php

示例10: create

 /**
  * create a new session
  *
  * @access	public
  * @return	void
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['previous_id'] = $this->keys['session_id'];
     // prevents errors if previous_id has a unique index
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     // create the session record
     $this->_write_redis($this->keys['session_id'], serialize(array()));
     // and set the session cookie
     $this->_set_cookie();
 }
开发者ID:469306621,项目名称:Languages,代码行数:21,代码来源:redis.php

示例11: create

 /**
  * create a new session
  *
  * @access	public
  * @return	void
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['previous_id'] = $this->keys['session_id'];
     // prevents errors if previous_id has a unique index
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     $this->keys['payload'] = '';
     // create the session record
     $result = \DB::insert($this->config['table'], array_keys($this->keys))->values($this->keys)->execute($this->config['database']);
     // and set the session cookie
     $this->_set_cookie();
 }
开发者ID:469306621,项目名称:Languages,代码行数:22,代码来源:db.php

示例12: before

 public function before()
 {
     parent::before();
     $client_type = false;
     $ua = \Input::user_agent();
     if (preg_match('/MicroMessenger/i', $ua)) {
         //加载微信公众号信息
         $this->load_wx_account();
         //加载微信粉丝OPENID信息
         $this->load_wechat();
         $client_type = 'wechat';
     }
     $this->load_seller();
     $this->getToken();
     \View::set_global(['client_type' => $client_type]);
 }
开发者ID:wxl2012,项目名称:wx,代码行数:16,代码来源:basecontroller.php

示例13: build_mail

    public function build_mail($post)
    {
        $data['from'] = $post['email'];
        $data['from_name'] = $post['name'];
        $data['to'] = 'info@example.jp';
        $data['to_name'] = '管理者';
        $data['subject'] = 'コンタクトフォーム';
        $ip = Input::ip();
        $agent = Input::user_agent();
        $data['body'] = <<<END
------------------------------------------------------------
          名前: {$post['name']}
メールアドレス: {$post['email']}
    IPアドレス: {$ip}
      ブラウザ: {$agent}
------------------------------------------------------------
コメント:
{$post['comment']}
------------------------------------------------------------
END;
        return $data;
    }
开发者ID:sato5603,项目名称:fuelphp1st-2nd,代码行数:22,代码来源:form.php

示例14: build_mail

    protected function build_mail($post)
    {
        Config::load('contact_form', true);
        $data['from'] = $post['email'];
        $data['from_name'] = $post['name'];
        $data['to'] = Config::get('contact_form.admin_email');
        $data['to_name'] = Config::get('contact_form.admin_name');
        $data['subject'] = Config::get('contact_form.subject');
        $ip = Input::ip();
        $agent = Input::user_agent();
        $data['body'] = <<<END
------------------------------------------------------------
          名前: {$post['name']}
メールアドレス: {$post['email']}
    IPアドレス: {$ip}
      ブラウザ: {$agent}
------------------------------------------------------------
コメント:
{$post['comment']}
------------------------------------------------------------
END;
        return $data;
    }
开发者ID:sato5603,项目名称:fuelphp1st-2nd,代码行数:23,代码来源:mail.php

示例15: _get_context

 /**
  * Generate the default data for the context object.
  * 
  * @param bool $js	Set this to generate the context for JS
  *  
  * @return array The array to use for the "context" object
  */
 private function _get_context($js = true)
 {
     $context_data = array('context' => array('locale' => $this->_get_locale(), 'timezone' => date('e')));
     if ($js !== true) {
         $php_context = array('ip' => \Input::real_ip(), 'userAgent' => \Input::user_agent());
         $context_data['context'] = \Arr::merge($context_data['context'], $php_context);
         // Don't use \Arr::set() since that will always add the keys.
         $context['campaign'] = $this->_add_element('name', \Input::get('utm_campaign'), array());
         $context['campaign'] = $this->_add_element('source', \Input::get('utm_source'), $context['campaign']);
         $context['campaign'] = $this->_add_element('medium', \Input::get('utm_medium'), $context['campaign']);
         $context['campaign'] = $this->_add_element('term', \Input::get('utm_term'), $context['campaign']);
         $context['campaign'] = $this->_add_element('content', \Input::get('utm_content'), $context['campaign']);
         if (!empty($context['campaign'])) {
             $context_data['context'] = \Arr::merge($context_data['context'], $context);
         }
         // If we're using Google Analytics, we add it's ID.
         if (!empty($this->_ga_cookie_id)) {
             \Arr::set($context_data, 'integrations.Google Analytics.clientId', $this->_ga_cookie_id);
         }
     }
     return $context_data;
 }
开发者ID:bitapihub,项目名称:fuelphp-segment-io,代码行数:29,代码来源:analytics.php


注:本文中的Input::user_agent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。