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


PHP Utilities::GetSupportedLanguages方法代码示例

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


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

示例1: BuildSearchIndex

 public static function BuildSearchIndex($site, $page, $root = '../')
 {
     // get content from published fragment
     $content = '';
     $fragment = $root . 'sites/' . $site['FriendlyId'] . '/fragments/publish/' . $page['PageUniqId'] . '.html';
     if (file_exists($fragment)) {
         $content = file_get_contents($fragment);
     }
     // remove existing index
     SearchIndex::Remove($page['PageUniqId']);
     // build the search index for the page in the default language
     $isDefaultLanguage = true;
     Utilities::BuildSearchIndex($site, $page, $site['Language'], $isDefaultLanguage, $content, $root);
     // get a list of other languages
     $rootPrefix = $root . 'sites/' . $site['FriendlyId'] . '/';
     // build index for non-default languages
     $languages = Utilities::GetSupportedLanguages($rootPrefix);
     $isDefaultLanguage = false;
     foreach ($languages as $language) {
         if ($language != $site['Language']) {
             Utilities::BuildSearchIndex($site, $page, $language, $isDefaultLanguage, $content, $root);
         }
     }
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:24,代码来源:Publish.php

示例2: str_replace

<?php

include 'app.php';
// set language to preferred language (HTTP_ACCEPT_LANGUAGE)
$supported = Utilities::GetSupportedLanguages('');
$language = Utilities::GetPreferredLanguage($supported);
Utilities::SetLanguage($language);
?>
<!DOCTYPE html>
<html lang="<?php 
print str_replace('_', '-', $language);
?>
">

<head>
	
<title><?php 
print _("Login");
?>
&mdash;<?php 
print BRAND;
?>
</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<!-- include styles -->
<?php 
include 'modules/css.php';
?>
开发者ID:eavesmonkey,项目名称:respond,代码行数:31,代码来源:undefined.php

示例3: define

<?php

// debugging
define('DEBUG', false);
if (DEBUG) {
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
} else {
    error_reporting(E_ERROR | E_PARSE);
}
session_start();
// authenticate secure pages
if ($isSecure == true) {
    $siteAuthUser = new SiteAuthUser($siteFriendlyId, $rootPrefix, $pageUrl);
    // get auth user
    $siteAuthUser->Authenticate($pageTypeUniqId, $rootPrefix, $pageUrl);
}
// get supported language
$supported = Utilities::GetSupportedLanguages($rootPrefix);
// check if multiple languages are supported
if (count($supported) > 1) {
    if (isset($_SESSION[$siteFriendlyId . '.Language'])) {
        $language = $_SESSION[$siteFriendlyId . '.Language'];
    } else {
        // set language as the default language
        $_SESSION[$siteFriendlyId . '.Language'] = $language;
    }
}
Utilities::SetLanguage($language, $rootPrefix . 'locale');
开发者ID:eavesmonkey,项目名称:respond,代码行数:29,代码来源:site.php


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