Example #1
0
function replaceLanguagePlaceholder($match)
{
    if (!is_array($match)) {
        $match = array($match, '');
    }
    $language = 'english';
    if (!defined('DOCVERT_ERROR_OCCURED')) {
        $language = getLanguageToUse();
    }
    if ($language == getFakeLanguageForTranslators()) {
        return $match[0];
    }
    $languagePlaceholderId = $match;
    if (is_array($match)) {
        $languagePlaceholderId = $match[1];
    }
    $placeholderPath = getLanguagePlaceholderPath($languagePlaceholderId, $language);
    if (file_exists($placeholderPath)) {
        return trim(file_get_contents($placeholderPath));
    } elseif ($language != 'english') {
        $placeholderPath = getLanguagePlaceholderPath($languagePlaceholderId, 'english');
        if (file_exists($placeholderPath)) {
            return trim(file_get_contents($placeholderPath));
        }
    }
    return $match[0];
}
Example #2
0
function formatFileSize($fileSize)
{
    $language = getLanguageToUse();
    $fileSizeName = array('english' => array(' B ', " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB"), 'french' => array(' B ', " ko", " Mo", " Go", " To", " Po", " Eo", " Zo", " Yo"));
    return round($fileSize / pow(1024, $i = floor(log($fileSize, 1024)))) . $fileSizeName[$language][$i];
}