[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/template/smarty/plugins/ -> modifier.round.php (source)

   1  <?php 
   2  /** 
   3   * Smarty Modifier round 
   4   * $round The number we're trying to round (don't try this with strings!!)
   5   * $locale An optional Locale object that will be used to localize the strings to be displayed.
   6   * If none is specified, the default locale will be used.
   7   */ 
   8  function smarty_modifier_round($size,$locale = null) 
   9  {
  10      // load the default locale if none provided
  11      if( $locale == null ) {
  12          lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
  13          $locale =& Locales::getLocale();
  14      }
  15      
  16      if ($size < pow(2,10)) return( $size." ".$locale->tr("bytes"));
  17      if ($size >= pow(2,10) && $size < pow(2,20)) return( round($size / pow(2,10), 0)." ".$locale->tr("kb"));
  18      if ($size >= pow(2,20) && $size < pow(2,30)) return( round($size /pow(2,20), 1)." ".$locale->tr("mb"));
  19      if ($size > pow(2,30)) return( round($size / pow(2,30), 2)." ".$locale->tr("gb"));
  20  } 
  21  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics