|
Revision 2333, 367 bytes
(checked in by bchoate, 19 months ago)
|
|
Adding 'numify' modifier. BugId:79765. Optimized counts gathered for Categories tag. Fix for 'g' modifier with regex_replace modifier.
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. |
|---|
| 3 | # This program is distributed under the terms of the |
|---|
| 4 | # GNU General Public License, version 2. |
|---|
| 5 | # |
|---|
| 6 | # $Id$ |
|---|
| 7 | |
|---|
| 8 | function smarty_modifier_numify($text, $attr = ',') { |
|---|
| 9 | if ($attr == "1") $attr = ','; |
|---|
| 10 | return preg_replace('/(^[â+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/', '\\1' . $attr, $text); |
|---|
| 11 | } |
|---|