Example #1
0
 /**
  * Get a readable amount
  * @param integer $decimals
  * @return string
  */
 public function getHumanAmount($decimals = 2, $user_currency_symbol = true)
 {
     $currency_code = $this->getCurrency();
     $currency = new StripeCurrencies($currency_code);
     if ($currency_symbol = $currency->getCurrencySymbol()) {
         $currency_code = $currency_symbol;
     }
     $amount = number_format($this->getAmount($decimals), $decimals, self::SEPARATOR_DECIMAL, self::SEPARATOR_MILLE);
     return elgg_echo('stripe:output:price', array($amount, $currency_code));
 }
Example #2
0
<?php

/**
 * Display a dropdown of currencies
 *
 * @uses string $vars['name'] Name of the input
 * @uses string $vars['value'] Currency code
 * @uses array $vars['options'] An array of available currencies
 */
$entity = elgg_extract('entity', $vars);
$currencies = $vars['options'];
unset($vars['options']);
$vars['options_values'] = array();
$currencies = StripeCurrencies::getCurrencies();
foreach ($currencies as $currency_code => $options) {
    $vars['options_values'][$currency_code] = $currency_code;
}
echo elgg_view('input/dropdown', $vars);