1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: /**
13: * Xoops locale
14: *
15: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
16: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
17: * @package kernel
18: * @since 2.3.0
19: * @author Taiwen Jiang <phppp@users.sourceforge.net>
20: * @todo To be handled by i18n/l10n
21: */
22: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
23:
24: setlocale(LC_ALL, 'en_US');
25:
26: // !!IMPORTANT!! insert '\' before any char among reserved chars: "a","A","B","c","d","D","e","F","g","G","h","H","i","I","j","l","L","m","M","n","O","r","s","S","t","T","U","w","W","Y","y","z","Z"
27: // insert double '\' before 't','r','n'
28: define('_TODAY', "\T\o\d\a\y G:i");
29: define('_YESTERDAY', "\Y\\e\s\\t\\e\\r\d\a\y G:i");
30: define('_MONTHDAY', 'n/j G:i');
31: define('_YEARMONTHDAY', 'Y/n/j G:i');
32: define('_ELAPSE', '%s ago');
33: define('_TIMEFORMAT_DESC', "Valid formats: \"s\" - " . _SHORTDATESTRING . "; \"m\" - " . _MEDIUMDATESTRING . "; \"l\" - " . _DATESTRING . ';<br>' . "\"c\" or \"custom\" - format determined according to interval to present; \"e\" - Elapsed; \"mysql\" - Y-m-d H:i:s;<br>" . "specified string - Refer to <a href=\"http://php.net/manual/en/function.date.php\" rel=\"external\">PHP manual</a>.");
34:
35: if (!class_exists('XoopsLocalAbstract')) {
36: include_once XOOPS_ROOT_PATH . '/class/xoopslocal.php';
37: }
38:
39: /**
40: * A Xoops Local
41: *
42: * @package kernel
43: * @subpackage Language
44: *
45: * @author Taiwen Jiang <phppp@users.sourceforge.net>
46: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
47: */
48: class XoopsLocal extends XoopsLocalAbstract
49: {
50: /**
51: * Number Formats
52: *
53: * @param unknown_type $number
54: * @return unknown
55: */
56: public function number_format($number)
57: {
58: return number_format($number, 2, '.', ',');
59: }
60:
61: /**
62: * Money Format
63: *
64: * @param string $format
65: * @param string $number
66: * @return money format
67: */
68: public function money_format($format, $number)
69: {
70: setlocale(LC_MONETARY, 'en_US');
71:
72: return money_format($format, $number);
73: }
74: }
75: