Revision 1375 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?php/** Smarty plugin*-------------------------------------------------------------* File: modifier.money_format.php* Type: modifier* Name: money_format* Version: 1.0* Date: Feb 8th, 2003* Purpose: pass value to PHP money_format() and return result* Install: Drop into the plugin directory.* Author: Michael L. Fladischer <mfladischer@abis.co.at>*-------------------------------------------------------------*/function smarty_modifier_money_format_red( $string, $places = 2, $locale ="de_DE", $onlySymbol = false, $incSymbol = true, $shortSymbol = false ){if ( !$locale ){$locale = "de_DE";}setlocale( LC_MONETARY, $locale );if ( $onlySymbol === true ){$erg = money_format( "%.0i", $string );preg_match_all( "/[A-Z]/", $erg, $erg );$erg = implode( "", $erg[0] );}else{if ( $incSymbol === true ){$erg = money_format( "%.{$places}i", $string );}else{$erg = money_format( "%!.{$places}i", $string );}}if ( $shortSymbol === true || $onlySymbol === true ){preg_match_all( "/[A-Z]/", $erg, $symArr );$symbol = implode( "", $symArr[0] );switch ( $symbol ){case "EUR":$erg = str_replace( "EUR", "€", $erg );break;case "USD":$erg = str_replace( "USD", "$", $erg );}}return $erg;}/* vim: set expandtab: */?>