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


PHP Agent::languages方法代码示例

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


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

示例1: test_languages

 /**
  * Tests Agent::languages()
  *
  * @test
  */
 public function test_languages()
 {
     $expected = array("en-us", "en", "nl-be", "nl");
     $output = Agent::languages();
     $this->assertEquals($expected, $output);
 }
开发者ID:wushian,项目名称:MDD,代码行数:11,代码来源:agent.php

示例2: fromBrowser

 private function fromBrowser()
 {
     if (!$this->language) {
         $matches = array_intersect($this->settings->languages(), Agent::languages());
         if (count($matches)) {
             $this->language = $matches[0];
         }
     }
     return $this;
 }
开发者ID:Thorazine,项目名称:cms,代码行数:10,代码来源:CmsLanguageMiddleware.php

示例3: getUiLanguageFromSession

 public function getUiLanguageFromSession()
 {
     $setLanguage = \Session::get('ui_language', \Config::get('app.locale'));
     if (\Config::get('paperwork.userAgentLanguage')) {
         $uaLanguages = \Agent::languages();
         foreach ($uaLanguages as $uaLanguage) {
             if (PaperworkHelpers::hasUiLanguage($uaLanguage)) {
                 $setLanguage = $uaLanguage;
                 break;
             }
         }
     }
     return $setLanguage;
 }
开发者ID:Liongold,项目名称:paperwork,代码行数:14,代码来源:PaperworkHelpers.php

示例4: action_view

 public static function action_view($short_url)
 {
     if (is_object($short_url) === false) {
         $short_url = Model_Url::query()->where('short_url', $short_url)->get_one();
     }
     $short_url->hits = $short_url->hits + 1;
     $short_url->save();
     if (empty($short_url) === false) {
         $results = Controller_Url::check_loop($short_url);
         $data['url'] = $results['url'];
         $data['iframe'] = $results['iframe'];
         if (isset($results['image']) === true) {
             $data['image'] = $results['image'];
         }
         if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
             $ip = $_SERVER["HTTP_CF_CONNECTING_IP"];
         } else {
             $ip = Input::real_ip();
         }
         $country = Model_Url_Stats_Country::query()->where('start_ip', '<=', ip2long($ip))->where('end_ip', '>=', ip2long($ip))->get_one();
         if (empty($country) === false) {
             $country = $country->country;
         } else {
             $country = 'N/A';
         }
         $lang = Agent::languages();
         // Insert Some Stats
         $stats = Model_Url_Stat::forge(array('url_id' => $short_url->id, 'ip' => $ip, 'country' => $country, 'referer' => Input::referrer(), 'language' => serialize($lang)));
         $stats->save();
         return new Response(View::Forge('url/redirect', $data));
     } else {
         Session::set('error', 'We couldn\'t');
         Response::Redirect(Uri::Base());
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:35,代码来源:url.php


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