本文整理汇总了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);
}
}
}
示例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");
?>
—<?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';
?>
示例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');