public static function get($strName, $strCategory = "global", $blnReturnError = true) { //*** Get a translation from the language file. $strReturn = $blnReturnError ? sprintf(self::$error, $strName, $strCategory) : ""; if (isset(self::$languages[$strCategory][$strName])) { $strReturn = self::$languages[$strCategory][$strName]; } //*** Output sanitisation? switch (self::$sanitizeType) { case "xhtml": if (class_exists("Bili\\Sanitize", true)) { $strReturn = Sanitize::toXhtml($strReturn); } break; case "entities": if (class_exists("Bili\\Sanitize", true)) { $strReturn = Sanitize::toEntities($strReturn); } break; } return $strReturn; }
/** * Format a numeric value according to the language settings. * * @return string string representation of a numeric value */ public static function renderNumber($fltValue, $intMaxDecimal = 2, $intMinDecimal = 2, $blnShowThousandSeparator = true) { $fltValue = floatval($fltValue); $intValue = floor($fltValue); for ($intDecimals = 0; $fltValue != round($fltValue, $intDecimals); $intDecimals++) { //*** Just counting. } if ($intDecimals <= $intMinDecimal) { $intMaxDecimal = $intMinDecimal; } $strDecimalPoint = Language::get("decimal_separator", "global", false); $strThousandSeparator = Language::get("thousands_separator", "global", false); if (empty($strDecimalPoint) || empty($strThousandSeparator)) { $arrLocaleInfo = localeconv(); if (empty($strDecimalPoint) && isset($arrLocaleInfo["decimal_point"])) { $strDecimalPoint = $arrLocaleInfo["decimal_point"]; } if (empty($strThousandSeparator) && isset($arrLocaleInfo["thousands_sep"])) { $strThousandSeparator = $arrLocaleInfo["thousands_sep"]; } } $strThousandSeparator = $blnShowThousandSeparator ? $strThousandSeparator : ""; $strReturn = number_format($fltValue, $intMaxDecimal, $strDecimalPoint, $strThousandSeparator); return Sanitize::toXhtml($strReturn); }