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


PHP sfWebRequest::getPreferredCulture方法代码示例

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


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

示例1: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         $ssaml = new SimpleSAML_Auth_Simple('default-sp');
         $attributes = $ssaml->getAttributes();
         if ($this->getUser()->isFirstRequest()) {
             if (array_key_exists('preferredLanguage', $attributes)) {
                 $culture = $attributes['preferredLanguage'];
                 if ($culture != 'hu' && $culture != 'en') {
                     $culture = $request->getPreferredCulture(array('en', 'hu'));
                 }
             } else {
                 $culture = $request->getPreferredCulture(array('en', 'hu'));
             }
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
     $p = Doctrine::getTable('Principal')->findOneByFedid($this->getUser()->getUsername());
     if ($p) {
         $oos = $p->getOrganization();
         $ros = $p->getRelatedOrganizations(TRUE);
     } else {
         $p = new Principal();
         $p->setFedid($this->getUser()->getUsername());
         $p->save();
     }
     $this->oos = $oos;
     $this->ros = $ros;
 }
开发者ID:br00k,项目名称:yavom,代码行数:38,代码来源:actions.class.php

示例2: executeSwitch

 public function executeSwitch(sfWebRequest $request)
 {
     $referer = $request->getReferer();
     if ($request->hasParameter("lang")) {
         $lang = $request->getParameter('lang');
     } else {
         $lang = $request->getPreferredCulture(array('en', 'hu'));
     }
     if ($lang != 'en' && $lang != 'hu') {
         $lang = $request->getPreferredCulture(array('en', 'hu'));
     }
     $this->getUser()->setCulture($lang);
     $pos = strpos($referer, '/hu/');
     if ($pos === false) {
         $pos = strpos($referer, '/en/');
         if ($pos === false) {
             $whereto = false;
         } else {
             $eleje = substr($referer, 0, $pos);
             $whereto = substr($referer, $pos + 4);
         }
     } else {
         $eleje = substr($referer, 0, $pos);
         $whereto = substr($referer, $pos + 4);
     }
     if (!$whereto) {
         $this->redirect('localized_homepage');
     } else {
         $this->redirect($eleje . "/" . $lang . "/" . $whereto);
     }
 }
开发者ID:br00k,项目名称:yavom,代码行数:31,代码来源:actions.class.php

示例3: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('pt', 'en'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
     }
 }
开发者ID:kidh0,项目名称:hboaventura-home,代码行数:17,代码来源:actions.class.php

示例4: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('en', 'es'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
 }
开发者ID:BGCX067,项目名称:f2gsym-svn-to-git,代码行数:18,代码来源:actions.class.php

示例5: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('en', 'fr'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
     $this->categories = Doctrine_Core::getTable('JobeetCategory')->getWithJobs();
 }
开发者ID:yodacode,项目名称:Jobeet,代码行数:14,代码来源:actions.class.php

示例6: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         $ssaml = new SimpleSAML_Auth_Simple('default-sp');
         $attributes = $ssaml->getAttributes();
         //die(var_dump($attributes['preferredLanguage']));
         if ($this->getUser()->isFirstRequest()) {
             if (array_key_exists('preferredLanguage', $attributes)) {
                 $culture = $attributes['preferredLanguage'];
                 if ($culture != 'hu' && $culture != 'en') {
                     $culture = $request->getPreferredCulture(array('hu', 'en'));
                 }
             } else {
                 $culture = $request->getPreferredCulture(array('hu', 'en'));
             }
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('localized_homepage');
     }
 }
开发者ID:br00k,项目名称:yavom,代码行数:28,代码来源:actions.class.php

示例7: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     if (!$request->getParameter('sf_culture')) {
         if ($this->getUser()->isFirstRequest()) {
             $culture = $request->getPreferredCulture(array('en', 'hr'));
             $this->getUser()->setCulture($culture);
             $this->getUser()->isFirstRequest(false);
         } else {
             $culture = $this->getUser()->getCulture();
         }
         $this->redirect('homepage');
     }
     $this->cities = Doctrine_Core::getTable('city')->TopCities(8);
     $this->apartments = Doctrine_Core::getTable('apartment')->LastAdded(9);
 }
开发者ID:alifst11,项目名称:symfonybooking,代码行数:15,代码来源:actions.class.php

示例8: getPreferredCountry

 /**
  * Gets the preferred country of the user based on the browser request.
  *
  * @return string country
  **/
 public static function getPreferredCountry(sfWebRequest $request)
 {
     $culture = explode('_', $request->getPreferredCulture());
     return count($culture) > 1 ? $culture[1] : $culture[0];
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:10,代码来源:CultureTools.class.php


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