| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | public static function do($string, $locale = null) |
||
| 8 | { |
||
| 9 | //var_dump($string); exit; |
||
| 10 | if ($locale) { |
||
| 11 | setlocale(LC_TIME, self::convertLocale($locale)); |
||
| 12 | } |
||
| 13 | |||
| 14 | //$string = preg_replace('/date\([\'"]?([a-z% ]+)[\'"]?\)/i', |
||
| 15 | // strftime(strpos('\1', '%') ? '\1': '%\1'), $string); |
||
| 16 | $string = preg_replace('/date\([\'"]?%?Y[\'"]?\)/i', strftime('%Y'), $string); |
||
| 17 | $string = preg_replace('/date\([\'"]?%?(B|M)[\'"]?\)/i', strftime('%B'), $string); |
||
| 18 | $string = preg_replace('/date\([\'"]?%?A[\'"]?\)/i', strftime('%A'), $string); |
||
| 19 | $string = preg_replace('/date\([\'"]?%?e[\'"]?\)/i', strftime('%e'), $string); |
||
| 20 | |||
| 21 | return $string; |
||
| 22 | } |
||
| 37 |