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


PHP Localize::GetTranslations方法代码示例

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


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

示例1: function

// Verify HTTP_HOST is in the list of authorized domains
if (!empty(Config::$_authorizedDomains)) {
    array_walk(Config::$_authorizedDomains, function (&$domain) {
        $domain = strtolower($domain);
    });
    if (!in_array(strtolower($_SERVER['HTTP_HOST']), Config::$_authorizedDomains)) {
        die("This domain is not authorized to access this software!<br /><br />(Did you forget to add your domains/subdomains to the \$_authorizedDomains array in the configuration class file?)");
    }
}
// Configure localization
$countryCode = !isset($_GET['ccode']) ? !isset($_SESSION['ccode']) ? Config::_DEFAULT_COUNTRY : $_SESSION['ccode'] : trim($_GET['ccode']);
if (!isset($_SESSION['langs']) || !isset($_SESSION['translations']) || !isset($_SESSION['missingTranslations']) || !isset($_SESSION['ccode']) || $_SESSION['ccode'] != $countryCode) {
    $localize = new Localize($countryCode);
    $_SESSION['ccode'] = $countryCode;
    $_SESSION['langs'] = $localize->GetLocalizationInfo();
    $_SESSION['translations'] = $localize->GetTranslations();
    $_SESSION['missingTranslations'] = $localize->GetMissingTranslations();
}
foreach ($_SESSION['translations'] as $constant => $value) {
    $value = isset($_SESSION['missingTranslations'][$constant]) && $_SESSION['langs'][$_SESSION['ccode']]['direction'] == 'rtl' ? '<span dir="' . Localize::_FALLBACK_DIRECTION . '">' . $value . '</span>' : $value;
    define($constant, $value);
}
// If localization just changed, urldecode everything in $_GET that was encoded by http_build_query()
if (isset($_GET['ccode'])) {
    foreach ($_GET as $k => $v) {
        $_GET[$k] = urldecode($v);
    }
}
// Instantiate converter class and populate vars/arrays
$converter = new VideoConverter();
$videoHosts = $converter->GetVideoHosts();
开发者ID:sahartak,项目名称:youtube,代码行数:31,代码来源:index.php


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