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


PHP SimpleSAML_XHTML_Template::getLanguageCookie方法代码示例

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


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

示例1: getLanguage

 /**
  * getLanguage() will return the language selected by the user, or the default language
  * This function first looks for a cached language code,
  * then checks for a language cookie,
  * then it tries to calculate the preferred language from HTTP headers.
  * Last it returns the default language.
  */
 public function getLanguage()
 {
     // Language is set in object
     if (isset($this->language)) {
         return $this->language;
     }
     // Language is provided in a stored COOKIE
     $languageCookie = SimpleSAML_XHTML_Template::getLanguageCookie();
     if ($languageCookie !== NULL) {
         $this->language = $languageCookie;
         return $languageCookie;
     }
     /* Check if we can find a good language from the Accept-Language http header. */
     $httpLanguage = $this->getHTTPLanguage();
     if ($httpLanguage !== NULL) {
         return $httpLanguage;
     }
     // Language is not set, and we get the default language from the configuration.
     return $this->getDefaultLanguage();
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:27,代码来源:Template.php

示例2: process

 /**
  * Apply filter to add or replace attributes.
  *
  * Add or replace existing attributes with the configured values.
  *
  * @param array &$request  The current request
  */
 public function process(&$request)
 {
     assert('is_array($request)');
     assert('array_key_exists("Attributes", $request)');
     $attributes =& $request['Attributes'];
     $attrlang = NULL;
     if (array_key_exists($this->langattr, $attributes)) {
         $attrlang = $attributes[$this->langattr][0];
     }
     $lang = SimpleSAML_XHTML_Template::getLanguageCookie();
     if (isset($attrlang)) {
         SimpleSAML_Logger::debug('LanguageAdaptor: Language in attribute was set [' . $attrlang . ']');
     }
     if (isset($lang)) {
         SimpleSAML_Logger::debug('LanguageAdaptor: Language in session   was set [' . $lang . ']');
     }
     if (isset($attrlang) && !isset($lang)) {
         // Language set in attribute but not in cookie - update cookie
         SimpleSAML_XHTML_Template::setLanguageCookie($attrlang);
     } elseif (!isset($attrlang) && isset($lang)) {
         // Language set in cookie, but not in attribute. Update attribute
         $request['Attributes'][$this->langattr] = array($lang);
     }
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:31,代码来源:LanguageAdaptor.php

示例3: getLanguage

 /**
  * getLanguage() will return the language selected by the user, or the default language
  * This function first looks for a cached language code,
  * then checks for a language cookie,
  * then it tries to calculate the preferred language from HTTP headers.
  * Last it returns the default language.
  */
 public function getLanguage()
 {
     // Language is set in object
     if (isset($this->language)) {
         return $this->language;
     }
     // Run custom getLanguage function if defined
     $customFunction = $this->configuration->getArray('language.get_language_function', NULL);
     if (isset($customFunction)) {
         assert('is_callable($customFunction)');
         $customLanguage = call_user_func($customFunction, $this);
         if ($customLanguage !== NULL && $customLanguage !== FALSE) {
             return $customLanguage;
         }
     }
     // Language is provided in a stored COOKIE
     $languageCookie = SimpleSAML_XHTML_Template::getLanguageCookie();
     if ($languageCookie !== NULL) {
         $this->language = $languageCookie;
         return $languageCookie;
     }
     /* Check if we can find a good language from the Accept-Language http header. */
     $httpLanguage = $this->getHTTPLanguage();
     if ($httpLanguage !== NULL) {
         return $httpLanguage;
     }
     // Language is not set, and we get the default language from the configuration.
     return $this->getDefaultLanguage();
 }
开发者ID:jerrcs,项目名称:simplesamlphp,代码行数:36,代码来源:Template.php

示例4: array

        if (sizeof($idpList) > 1) {
            $params['saml:IDPList'] = $idpList;
        } else {
            $params['saml:idp'] = $idpList[0];
        }
    }
    $as->login($params);
}
$sessionExpiry = $as->getAuthData('Expire');
if (!is_array($sessionTicket) || $forceAuthn) {
    $sessionTicket = $ticketFactory->createSessionTicket($session->getSessionId(), $sessionExpiry);
    $ticketStore->addTicket($sessionTicket);
}
$parameters = array();
if (array_key_exists('language', $_GET)) {
    $oldLanguagePreferred = SimpleSAML_XHTML_Template::getLanguageCookie();
    if (isset($oldLanguagePreferred)) {
        $parameters['language'] = $oldLanguagePreferred;
    } else {
        if (is_string($_GET['language'])) {
            $parameters['language'] = $_GET['language'];
        }
    }
}
if (isset($_GET['service'])) {
    $attributes = $as->getAttributes();
    $casUsernameAttribute = $casconfig->getValue('attrname', 'eduPersonPrincipalName');
    $userName = $attributes[$casUsernameAttribute][0];
    if ($casconfig->getValue('attributes', true)) {
        $attributesToTransfer = $casconfig->getValue('attributes_to_transfer', array());
        if (sizeof($attributesToTransfer) > 0) {
开发者ID:simplesamlphp,项目名称:simplesamlphp-module-casserver,代码行数:31,代码来源:login.php


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