| | 458 | |
| | 459 | function count_format($count, $args) { |
| | 460 | $phrase = ''; |
| | 461 | if ($count == 0) { |
| | 462 | $phrase = array_key_exists('none', $args) ? $args['none'] : |
| | 463 | (array_key_exists('plural', $args) ? $args['plural'] : ''); |
| | 464 | } elseif ($count == 1) { |
| | 465 | $phrase = array_key_exists('singular', $args) ? $args['singular'] : ''; |
| | 466 | } elseif ($count > 1) { |
| | 467 | $phrase = array_key_exists('plural', $args) ? $args['plural'] : ''; |
| | 468 | } |
| | 469 | if ($phrase == '') |
| | 470 | return $count; |
| | 471 | |
| | 472 | // \# of entries: # --> # of entries: 10 |
| | 473 | $phrase = preg_replace('/(?<!\\\\)#/', $count, $phrase); |
| | 474 | $phrase = preg_replace('/\\\\#/', '#', $phrase); |
| | 475 | |
| | 476 | return $phrase; |
| | 477 | } |