function testGenerate()
 {
     $templates = array('currencies_list' => array(), 'currencies_inline' => array(), 'fiat_currencies_list' => array(), 'fiat_currencies_inline' => array(), 'crypto_currencies_list' => array(), 'crypto_currencies_inline' => array(), 'commodity_currencies_list' => array(), 'commodity_currencies_inline' => array(), 'exchange_wallets_list' => array(), 'mining_pools_list' => array(), 'securities_list' => array(), 'exchange_list' => array());
     foreach (get_all_currencies() as $cur) {
         $templates['currencies_list'][] = "  * " . get_currency_name($cur);
         $templates['currencies_inline'][] = get_currency_abbr($cur);
     }
     foreach (get_all_fiat_currencies() as $cur) {
         $templates['fiat_currencies_list'][] = "  * " . get_currency_name($cur);
         $templates['fiat_currencies_inline'][] = get_currency_abbr($cur);
     }
     foreach (get_all_cryptocurrencies() as $cur) {
         $templates['crypto_currencies_list'][] = "  * " . get_currency_name($cur);
         $templates['crypto_currencies_inline'][] = get_currency_abbr($cur);
     }
     foreach (get_all_commodity_currencies() as $cur) {
         $templates['commodity_currencies_list'][] = "  * " . get_currency_name($cur);
         $templates['commodity_currencies_inline'][] = get_currency_abbr($cur);
     }
     $grouped = account_data_grouped();
     foreach ($grouped['Exchanges'] as $key => $data) {
         if (!$data['disabled']) {
             $templates['exchange_wallets_list'][] = "  * " . get_exchange_name($key);
         }
     }
     foreach ($grouped['Mining pools'] as $key => $data) {
         if (!$data['disabled']) {
             $templates['mining_pools_list'][] = "  * " . get_exchange_name($key);
         }
     }
     foreach ($grouped['Securities'] as $key => $data) {
         if (!$data['disabled']) {
             $templates['securities_list'][] = "  * " . get_exchange_name($key);
         }
     }
     foreach (get_exchange_pairs() as $key => $pairs) {
         $templates['exchange_list'][] = "  * " . get_exchange_name($key);
     }
     $templates['currencies_list'] = implode("\n", array_unique($templates['currencies_list']));
     $templates['fiat_currencies_list'] = implode("\n", array_unique($templates['fiat_currencies_list']));
     $templates['crypto_currencies_list'] = implode("\n", array_unique($templates['crypto_currencies_list']));
     $templates['commodity_currencies_list'] = implode("\n", array_unique($templates['commodity_currencies_list']));
     $templates['exchange_wallets_list'] = implode("\n", array_unique($templates['exchange_wallets_list']));
     $templates['mining_pools_list'] = implode("\n", array_unique($templates['mining_pools_list']));
     $templates['securities_list'] = implode("\n", array_unique($templates['securities_list']));
     $templates['exchange_list'] = implode("\n", array_unique($templates['exchange_list']));
     $templates['currencies_inline'] = implode(", ", array_unique($templates['currencies_inline']));
     $templates['fiat_currencies_inline'] = implode(", ", array_unique($templates['fiat_currencies_inline']));
     $templates['crypto_currencies_inline'] = implode(", ", array_unique($templates['crypto_currencies_inline']));
     $templates['commodity_currencies_inline'] = implode(", ", array_unique($templates['commodity_currencies_inline']));
     // load the template
     $input = file_get_contents(__DIR__ . "/../README.template.md");
     foreach ($templates as $key => $value) {
         $input = str_replace('{$' . $key . '}', $value, $input);
     }
     // write it out
     file_put_contents(__DIR__ . "/../README.md", $input);
 }
<?php

/**
 * Process selected currencies and redirect to the next wizard page if successful.
 */
require_login();
$user = get_user(user_id());
require_user($user);
$errors = array();
$messages = array();
// get all of our limits
$accounts = user_limits_summary(user_id());
$currencies = require_post("currencies", array());
$exchanges = require_post("exchanges", array());
$cryptos = get_all_cryptocurrencies();
$fiats = get_all_fiat_currencies();
$commodities = get_all_commodity_currencies();
// go through all fiat currencies and, if no exchange is selected, select a default one
foreach ($fiats as $c) {
    if (in_array($c, $currencies)) {
        $found = false;
        foreach ($exchanges as $e) {
            $prefix = "summary_" . $c . "_";
            if (substr($e, 0, strlen($prefix)) == $prefix) {
                // found one
                $found = true;
            }
        }
        if (!$found) {
            $exchanges[] = "summary_" . $c . "_" . get_default_currency_exchange($c);
        }
<h2>Overview</h2>

<p>
	We want to add support for as many fiat currencies as we can to
	<a href="http://openclerk.org" target="_blank">Openclerk</a> (the underlying open source project),
	with priority on fiat currencies that are in highest demand.
</p>

<p>
	Currently <?php 
echo htmlspecialchars(get_site_config('site_name'));
?>
 supports the <?php 
$result = array();
foreach (get_all_fiat_currencies() as $c) {
    $result[] = "<span class=\"currency_name_" . htmlspecialchars($c) . "\">" . htmlspecialchars(get_currency_name($c)) . "</span>" . (in_array($c, get_new_supported_currencies()) ? " <span class=\"new\">" . ht("new") . "</span>" : "");
}
echo implode_english($result);
?>
 fiat currencies.
</p>

<h2>Requesting a new fiat currency</h2>

<p>
	If you would like Openclerk to support a new fiat currency, please let us know through one of the following methods:
</p>

<?php 
require_template('inline_contact');
?>
Exemple #4
0
 function testAllCurrenciesComplete()
 {
     $this->assertSame(array(), array_diff(get_all_currencies(), get_all_fiat_currencies(), get_all_cryptocurrencies(), get_all_commodity_currencies()));
 }
Exemple #5
0
function get_total_conversion_summary_types()
{
    global $global_get_total_conversion_summary_types;
    if ($global_get_total_conversion_summary_types == null) {
        $summary_types = array();
        // add fiat pairs automatically
        foreach (get_exchange_pairs() as $exchange => $pairs) {
            foreach ($pairs as $pair) {
                if ($pair[1] == 'btc') {
                    // fiat currency
                    $summary_types[$pair[0] . '_' . $exchange] = array('currency' => $pair[0], 'title' => get_currency_name($pair[0]) . ' (converted through ' . get_exchange_name($exchange) . ')', 'short_title' => get_currency_abbr($pair[0]) . ' (' . get_exchange_name($exchange) . ')', 'exchange' => $exchange);
                }
            }
        }
        // and also all average pairs for all fiats
        // (if there is a result in the ticker_recent)
        foreach (get_all_fiat_currencies() as $cur) {
            $exchange = "average";
            $q = db()->prepare("SELECT * FROM ticker_recent WHERE currency1=? AND currency2=? AND exchange=? LIMIT 1");
            $q->execute(array($cur, 'btc', 'average'));
            if ($q->fetch()) {
                $summary_types[$cur . '_' . $exchange] = array('currency' => $cur, 'title' => get_currency_name($cur) . ' (converted using market average)', 'short_title' => get_currency_abbr($cur) . ' (market average)', 'exchange' => $exchange);
            }
        }
        // sort by currency order, then title
        uasort($summary_types, 'sort_get_total_conversion_summary_types');
        $global_get_total_conversion_summary_types = $summary_types;
    }
    return $global_get_total_conversion_summary_types;
}