array-to-csv.php
4 years ago
date-format.php
4 years ago
request.php
4 years ago
security.php
4 years ago
date-format.php
58 lines
| 1 | <?php |
| 2 | |
| 3 | if (!class_exists('IAWP_Date_Format')) { |
| 4 | class IAWP_Date_Format |
| 5 | { |
| 6 | public static function php() |
| 7 | { |
| 8 | return get_option('date_format'); |
| 9 | } |
| 10 | |
| 11 | public static function js() |
| 12 | { |
| 13 | $php_format = self::php(); |
| 14 | $replacements = [ |
| 15 | 'd' => 'DD', |
| 16 | 'D' => 'ddd', |
| 17 | 'j' => 'D', |
| 18 | 'l' => 'dddd', |
| 19 | 'N' => 'E', |
| 20 | 'S' => 'o', |
| 21 | 'w' => 'e', |
| 22 | 'z' => 'DDD', |
| 23 | 'W' => 'W', |
| 24 | 'F' => 'MMMM', |
| 25 | 'm' => 'MM', |
| 26 | 'M' => 'MMM', |
| 27 | 'n' => 'M', |
| 28 | 't' => '', // no equivalent |
| 29 | 'L' => '', // no equivalent |
| 30 | 'o' => 'YYYY', |
| 31 | 'Y' => 'YYYY', |
| 32 | 'y' => 'YY', |
| 33 | 'a' => 'a', |
| 34 | 'A' => 'A', |
| 35 | 'B' => '', // no equivalent |
| 36 | 'g' => 'h', |
| 37 | 'G' => 'H', |
| 38 | 'h' => 'hh', |
| 39 | 'H' => 'HH', |
| 40 | 'i' => 'mm', |
| 41 | 's' => 'ss', |
| 42 | 'u' => 'SSS', |
| 43 | 'e' => 'zz', // deprecated since version 1.6.0 of moment.js |
| 44 | 'I' => '', // no equivalent |
| 45 | 'O' => '', // no equivalent |
| 46 | 'P' => '', // no equivalent |
| 47 | 'T' => '', // no equivalent |
| 48 | 'Z' => '', // no equivalent |
| 49 | 'c' => '', // no equivalent |
| 50 | 'r' => '', // no equivalent |
| 51 | 'U' => 'X', |
| 52 | ]; |
| 53 | |
| 54 | return strtr($php_format, $replacements); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 |