当前位置: 首页>>代码示例>>PHP>>正文


PHP get_all_currencies函数代码示例

本文整理汇总了PHP中get_all_currencies函数的典型用法代码示例。如果您正苦于以下问题:PHP get_all_currencies函数的具体用法?PHP get_all_currencies怎么用?PHP get_all_currencies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_all_currencies函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGenerate

 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);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:58,代码来源:GenerateReadmeTest.php

示例2: testAllExchangeCurrencies

 function testAllExchangeCurrencies()
 {
     foreach (get_exchange_pairs() as $exchange => $pairs) {
         foreach ($pairs as $p) {
             $this->assertTrue(in_array($p[0], get_all_currencies()), "Exchange {$exchange} had invalid currency {$p['0']} in pair {$p['0']}/{$p['1']}");
             $this->assertTrue(in_array($p[1], get_all_currencies()), "Exchange {$exchange} had invalid currency {$p['1']} in pair {$p['0']}/{$p['1']}");
         }
     }
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:9,代码来源:CryptoTest.php

示例3: getJSON

 function getJSON($arguments)
 {
     $result = array();
     foreach (get_all_currencies() as $cur) {
         $instance = \DiscoveredComponents\Currencies::getInstance($cur);
         $result[] = array("code" => $instance->getCode(), "abbr" => $instance->getAbbr(), "name" => $instance->getName(), "cryptocurrency" => $instance->isCryptocurrency(), "fiat" => $instance->isFiat(), "commodity" => $instance->isCommodity());
     }
     return $result;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:9,代码来源:Currencies.php

示例4: getJSON

 function getJSON($arguments)
 {
     // important for url_for() links
     define('FORCE_NO_RELATIVE', true);
     $result = array();
     $result['currencies'] = array();
     foreach (get_all_currencies() as $cur) {
         $result['currencies'][] = array('code' => $cur, 'abbr' => get_currency_abbr($cur), 'name' => get_currency_name($cur), 'fiat' => is_fiat_currency($cur));
     }
     require __DIR__ . "/../../inc/api.php";
     $result['rates'] = api_get_all_rates();
     return $result;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:13,代码来源:Rates.php

示例5: getJSON

 function getJSON($arguments)
 {
     // important for url_for() links
     define('FORCE_NO_RELATIVE', true);
     if (!in_array($arguments['currency1'], get_all_currencies())) {
         throw new \Exception("Invalid currency '" . $arguments['currency1'] . "'");
     }
     if (!in_array($arguments['currency2'], get_all_currencies())) {
         throw new \Exception("Invalid currency '" . $arguments['currency2'] . "'");
     }
     $q = db()->prepare("SELECT * FROM ticker_recent WHERE currency1=? AND currency2=? ORDER BY volume DESC");
     $q->execute(array($arguments['currency1'], $arguments['currency2']));
     $result = array();
     while ($ticker = $q->fetch()) {
         $result[] = array('exchange' => $ticker['exchange'], 'last_trade' => $ticker['last_trade'], 'bid' => $ticker['bid'], 'ask' => $ticker['ask'], "volume" => $ticker['volume'], 'time' => $ticker['created_at'], 'url' => absolute_url(url_for('historical', array('id' => $ticker['exchange'] . "_" . $ticker['currency1'] . $ticker['currency2'] . "_daily"))));
     }
     if (!$result) {
         throw new \Exception("No rates found");
     }
     return $result;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:21,代码来源:Rate.php

示例6: getData

 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     // get all balances
     $balances = get_all_summary_instances($this->getUser());
     $last_updated = find_latest_created_at($balances, "total");
     // and convert them using the most recent rates
     $rates = get_all_recent_rates();
     // create data
     // TODO refactor this into generic any-currency balances
     $data = array();
     if (isset($balances['totalbtc']) && $balances['totalbtc']['balance'] != 0) {
         $columns[] = array('type' => 'number', 'title' => get_currency_abbr('btc'));
         $data[] = graph_number_format(demo_scale($balances['totalbtc']['balance']));
     }
     foreach (get_all_currencies() as $cur) {
         // if the key is a currency, use the same currency colour across all graphs (#293)
         $color = array_search($cur, get_all_currencies());
         if ($cur == 'btc') {
             continue;
         }
         if (!is_fiat_currency($cur) && isset($balances['total' . $cur]) && $balances['total' . $cur]['balance'] != 0 && isset($rates['btc' . $cur])) {
             $columns[] = array('type' => 'number', 'title' => get_currency_abbr($cur), 'color' => $color);
             $data[] = graph_number_format(demo_scale($balances['total' . $cur]['balance'] * $rates['btc' . $cur]['bid']));
         }
         if (is_fiat_currency($cur) && isset($balances['total' . $cur]) && $balances['total' . $cur]['balance'] != 0 && isset($rates[$cur . 'btc']) && $rates[$cur . 'btc']['ask']) {
             $columns[] = array('type' => 'number', 'title' => get_currency_abbr($cur), 'color' => $color);
             $data[] = graph_number_format(demo_scale($balances['total' . $cur]['balance'] / $rates[$cur . 'btc']['ask']));
         }
     }
     // display a helpful message if there's no data
     if (!$data) {
         throw new NoDataGraphException_AddAccountsAddresses();
     }
     // sort data by balance
     arsort($data);
     $data = array(get_currency_abbr('btc') => $data);
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:40,代码来源:EquivalentPieBTC.php

示例7: getData

 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Currency"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Total"));
     // a table of each currency
     // get all balances
     $balances = get_all_summary_instances($this->getUser());
     $summaries = get_all_summary_currencies($this->getUser());
     $currencies = get_all_currencies();
     $last_updated = find_latest_created_at($balances, "total");
     // create data
     $data = array();
     foreach ($currencies as $c) {
         if (isset($summaries[$c])) {
             $balance = isset($balances['total' . $c]) ? $balances['total' . $c]['balance'] : 0;
             $data[] = array("<span title=\"" . htmlspecialchars(get_currency_name($c)) . "\">" . get_currency_abbr($c) . "</span>", currency_format($c, demo_scale($balance), 4));
         }
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'add_more_currencies' => true, 'no_header' => true);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:22,代码来源:BalancesTable.php

示例8: getCompositionSources

 function getCompositionSources($days, $extra_days)
 {
     $sources = array();
     $summary_currencies = get_all_summary_currencies($this->getUser());
     foreach (get_all_currencies() as $cur) {
         if (isset($summary_currencies[$cur])) {
             if ($cur == 'btc') {
                 // we can't LIMIT by days here, because we may have many accounts for one exchange
                 // first get summarised data
                 $sources[] = array('query' => "SELECT *, '{$cur}' AS exchange FROM graph_data_summary WHERE user_id=:user_id AND summary_type='totalbtc'\n            AND data_date > DATE_SUB(NOW(), INTERVAL " . ($days + $extra_days) . " DAY) ORDER BY data_date DESC", 'key' => 'data_date', 'balance_key' => 'balance_closing');
                 // and then get more recent data
                 $sources[] = array('query' => "SELECT *, '{$cur}' AS exchange FROM summary_instances WHERE is_daily_data=1 AND summary_type='totalbtc'\n            AND user_id=:user_id AND created_at >= DATE_SUB(NOW(), INTERVAL " . ($days + $extra_days) . " DAY) ORDER BY created_at DESC", 'key' => 'created_at', 'balance_key' => 'balance');
             } else {
                 // we can't LIMIT by days here, because we may have many accounts for one exchange
                 // first get summarised data
                 $sources[] = array('query' => "SELECT *, '{$cur}' AS exchange FROM graph_data_summary WHERE user_id=:user_id AND summary_type='equivalent_btc_{$cur}'\n            AND data_date > DATE_SUB(NOW(), INTERVAL " . ($days + $extra_days) . " DAY) ORDER BY data_date DESC", 'key' => 'data_date', 'balance_key' => 'balance_closing');
                 // and then get more recent data
                 $sources[] = array('query' => "SELECT *, '{$cur}' AS exchange FROM summary_instances WHERE is_daily_data=1 AND summary_type='equivalent_btc_{$cur}'\n            AND user_id=:user_id AND created_at >= DATE_SUB(NOW(), INTERVAL " . ($days + $extra_days) . " DAY) ORDER BY created_at DESC", 'key' => 'created_at', 'balance_key' => 'balance');
             }
         }
     }
     return $sources;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:23,代码来源:BtcEquivalentGraph.php

示例9: construct_graph_renderer

/**
 * Helper function that converts a {@code graph_type} to a GraphRenderer
 * object, which we can then use to get raw graph data and format it as necessary.
 */
function construct_graph_renderer($graph_type, $arg0, $arg0_resolved)
{
    $bits = explode("_", $graph_type);
    $all_exchanges = get_all_exchanges();
    if (count($bits) == 3) {
        $cur1 = false;
        $cur2 = false;
        if (strlen($bits[1]) == 6) {
            $cur1 = substr($bits[1], 0, 3);
            $cur2 = substr($bits[1], 3);
            $cur1 = in_array($cur1, get_all_currencies()) ? $cur1 : false;
            $cur2 = in_array($cur2, get_all_currencies()) ? $cur2 : false;
        }
        if (strlen($bits[2]) == 6 && !$cur1 && !$cur2) {
            $cur1 = substr($bits[2], 0, 3);
            $cur2 = substr($bits[2], 3);
            $cur1 = in_array($cur1, get_all_currencies()) ? $cur1 : false;
            $cur2 = in_array($cur2, get_all_currencies()) ? $cur2 : false;
        }
        if ($bits[2] == "daily" && $cur1 && $cur2 && isset($all_exchanges[$bits[0]])) {
            return new GraphRenderer_Ticker($bits[0], $cur1, $cur2);
        }
        if ($bits[2] == "markets" && $cur1 && $cur2 && $bits[0] == "average") {
            return new GraphRenderer_AverageMarketData($cur1, $cur2);
        }
        if ($bits[0] == "composition" && in_array($bits[1], get_all_currencies())) {
            switch ($bits[2]) {
                case "pie":
                    return new GraphRenderer_CompositionPie($bits[1]);
                case "table":
                    return new GraphRenderer_CompositionTable($bits[1]);
                case "daily":
                    return new GraphRenderer_CompositionGraph($bits[1]);
                case "stacked":
                    return new GraphRenderer_CompositionStacked($bits[1]);
                case "proportional":
                    return new GraphRenderer_CompositionProportional($bits[1]);
            }
        }
        if ($bits[0] == "total" && in_array($bits[1], get_all_currencies()) && $bits[2] == "daily") {
            return new GraphRenderer_SummaryGraph('total' . $bits[1], $bits[1]);
        }
        if ($bits[0] == "hashrate" && in_array($bits[1], get_all_currencies()) && $bits[2] == "daily") {
            return new GraphRenderer_SummaryGraphHashrate('totalmh_' . $bits[1], $bits[1]);
        }
        if ($bits[0] == "securities" && in_array($bits[2], get_all_currencies())) {
            $renderer = new GraphRenderer_BalancesGraphSecurities('securities_' . $bits[1], $arg0, $bits[2], $arg0_resolved);
            return $renderer;
        }
        if ($bits[0] == "pair" && isset($all_exchanges[$bits[1]]) && $cur1 && $cur2) {
            return new GraphRenderer_ExchangePair($bits[1], $cur1, $cur2);
        }
    }
    // issue #273: fix bitmarket_pl exchange
    if (count($bits) == 4) {
        $cur1 = false;
        $cur2 = false;
        if (strlen($bits[2]) == 6) {
            $cur1 = substr($bits[2], 0, 3);
            $cur2 = substr($bits[2], 3);
            $cur1 = in_array($cur1, get_all_currencies()) ? $cur1 : false;
            $cur2 = in_array($cur2, get_all_currencies()) ? $cur2 : false;
        }
        if ($bits[3] == "daily" && $cur1 && $cur2 && isset($all_exchanges[$bits[0] . "_" . $bits[1]])) {
            return new GraphRenderer_Ticker($bits[0] . "_" . $bits[1], $cur1, $cur2);
        }
    }
    if (count($bits) >= 2) {
        if (substr($bits[0], 0, strlen("all2")) == "all2" || substr($bits[0], 0, strlen("crypto2")) == "crypto2") {
            $cur = substr($bits[0], -3);
            if (in_array($cur, get_all_currencies())) {
                if (count($bits) == 3 && $bits[2] == "daily" && isset($all_exchanges[$bits[1]])) {
                    // e.g. all2nzd_bitnz_daily
                    return new GraphRenderer_SummaryGraphConvertedExchange($bits[0] . "_" . $bits[1], $cur);
                }
                if (count($bits) == 4 && $bits[3] == "daily" && isset($all_exchanges[$bits[1] . "_" . $bits[2]])) {
                    // e.g. all2pln_bitmarket_pl_daily (#273)
                    return new GraphRenderer_SummaryGraphConvertedExchange($bits[0] . "_" . $bits[1] . "_" . $bits[2], $cur);
                }
                if (count($bits) == 2 && $bits[1] == "daily") {
                    // e.g. crypto2ltc_daily
                    return new GraphRenderer_SummaryGraphConvertedCrypto($bits[0], $cur);
                }
            }
        }
    }
    if (count($bits) >= 2 && $bits[0] == "metrics") {
        $possible = GraphRenderer_AdminMetrics::getMetrics();
        $bits_two = explode("_", $graph_type, 2);
        if (isset($possible[$bits_two[1]])) {
            return new GraphRenderer_AdminMetrics($bits_two[1]);
        }
    }
    switch ($graph_type) {
        case "btc_equivalent":
            return new GraphRenderer_EquivalentPieBTC();
//.........这里部分代码省略.........
开发者ID:phpsource,项目名称:openclerk,代码行数:101,代码来源:new.php

示例10: get_all_recent_rates

function get_all_recent_rates()
{
    global $global_all_recent_rates;
    if ($global_all_recent_rates === null) {
        $global_all_recent_rates = array();
        $query = "";
        foreach (get_all_currencies() as $cur) {
            if ($cur == 'btc') {
                continue;
            }
            // we don't provide a 'btcbtc' rate
            $exchange = get_default_currency_exchange($cur);
            $query .= "(currency1 = 'btc' AND currency2 = '{$cur}' AND exchange='{$exchange}') OR";
            $query .= "(currency1 = '{$cur}' AND currency2 = 'btc' AND exchange='{$exchange}') OR";
        }
        $q = db()->prepare("SELECT * FROM ticker_recent WHERE 1 AND ({$query} 0)");
        $q->execute();
        while ($ticker = $q->fetch()) {
            $global_all_recent_rates[$ticker['currency1'] . $ticker['currency2']] = $ticker;
        }
    }
    return $global_all_recent_rates;
}
开发者ID:phpsource,项目名称:openclerk,代码行数:23,代码来源:util.php

示例11: lang_key

                    <h3><?php 
echo lang_key('bank_currency_settings');
?>
</h3>
                    <div class="form-group">
                        <label class="col-sm-3 col-lg-2 control-label"><?php 
echo lang_key('bank_currency');
?>
</label>

                        <div class="col-sm-9 col-md-3 controls">
                               
                            <select name="bank_currency" class="form-control">
                                <?php 
$options = get_all_currencies();
?>

                                <?php 
$bank_currency = isset($settings->bank_currency) ? $settings->bank_currency : '';
?>

                                <?php 
$v = set_value('bank_currency') != '' ? set_value('bank_currency') : $bank_currency;
?>

                                <?php 
$sel = $v == 'use_paypal' ? 'selected="selected"' : '';
?>

                                <option value="use_paypal" <?php 
开发者ID:priyranjansingh,项目名称:classified,代码行数:30,代码来源:settings_view.php

示例12: insert_new_address_balance

    insert_new_address_balance($job, $address, $balance);
} else {
    if ($instance instanceof \Openclerk\Currencies\BlockBalanceableCurrency) {
        // get the most recent block count, to calculate confirmations
        $block = null;
        $q = db()->prepare("SELECT * FROM blockcount_" . $currency . " WHERE is_recent=1");
        $q->execute();
        if ($result = $q->fetch()) {
            $block = $result['blockcount'] - \Openclerk\Config::get($currency . "_confirmations", 6);
        }
        $balance = $instance->getBalanceAtBlock($address['address'], $block, $logger);
        insert_new_address_balance($job, $address, $balance);
    } else {
        // we can't do confirmations or block balances
        $balance = $instance->getBalance($address['address'], $logger);
        insert_new_address_balance($job, $address, $balance);
    }
}
if ($instance instanceof \Openclerk\Currencies\MultiBalanceableCurrency) {
    $balances = $instance->getMultiBalances($address['address'], $logger);
    foreach ($balances as $code => $balance) {
        if (in_array($code, get_all_currencies())) {
            if ($code != $currency) {
                // skip balances we've already inserted for this currency
                insert_new_balance($job, $address, 'ripple', $code, $balance);
            }
        } else {
            $logger->info("Unknown multi currency '{$code}'");
        }
    }
}
开发者ID:phpsource,项目名称:openclerk,代码行数:31,代码来源:discovered.php

示例13: is_valid_currency

function is_valid_currency($c)
{
    return in_array($c, get_all_currencies());
}
开发者ID:phpsource,项目名称:openclerk,代码行数:4,代码来源:crypto.php

示例14: render_sources_graph

/**
 * Renders a collection of $sources with a given set of arguments $args, a user ID $user_id
 * and a heading callback function $get_heading_title.
 *
 * @param $has_subheadings true (default), false (no subheading), 'last_total' (total the most recent data)
 * @param $stacked if true, renders the graph as a stacked graph rather than line graph. defaults to false.
 * @param $make_proportional if true, converts all values to proportional data w.r.t. each date point, up to 100%. defaults to false.
 */
function render_sources_graph($graph, $sources, $args, $user_id, $get_heading_title, $has_subheadings = true, $stacked = false, $make_proportional = false)
{
    $data = array();
    $last_updated = false;
    $days = get_graph_days($graph);
    $extra_days = extra_days_necessary($graph);
    $exchanges_found = array();
    $maximum_balances = array();
    // only used to check for non-zero accounts
    $data_temp = array();
    $hide_missing_data = !require_get("debug_show_missing_data", false);
    $latest = array();
    foreach ($sources as $source) {
        $q = db()->prepare($source['query']);
        $q_args = $args;
        $q_args['user_id'] = $user_id;
        $q->execute($q_args);
        while ($ticker = $q->fetch()) {
            $key = date('Y-m-d', strtotime($ticker[$source['key']]));
            if (!isset($data_temp[$key])) {
                $data_temp[$key] = array();
            }
            if (!isset($data_temp[$key][$ticker['exchange']])) {
                $data_temp[$key][$ticker['exchange']] = 0;
            }
            $data_temp[$key][$ticker['exchange']] += $ticker[$source['balance_key']];
            $last_updated = max($last_updated, strtotime($ticker['created_at']));
            $exchanges_found[$ticker['exchange']] = $ticker['exchange'];
            if (!isset($maximum_balances[$ticker['exchange']])) {
                $maximum_balances[$ticker['exchange']] = 0;
            }
            $maximum_balances[$ticker['exchange']] = max($ticker[$source['balance_key']], $maximum_balances[$ticker['exchange']]);
            if (!isset($latest[$ticker['exchange']])) {
                $latest[$ticker['exchange']] = 0;
            }
            $latest[$ticker['exchange']] = max($latest[$ticker['exchange']], strtotime($ticker[$source['key']]));
        }
    }
    // get rid of any exchange summaries that had zero data
    foreach ($maximum_balances as $key => $balance) {
        if ($balance == 0) {
            foreach ($data_temp as $dt_key => $values) {
                unset($data_temp[$dt_key][$key]);
            }
            unset($exchanges_found[$key]);
        }
    }
    // sort by date so we can get previous dates if necessary for missing data
    ksort($data_temp);
    $data = array();
    // add headings after we know how many exchanges we've found
    $first_heading = array('title' => t("Date"));
    if ($make_proportional) {
        $first_heading['min'] = 0;
        $first_heading['max'] = 100;
    }
    $headings = array($first_heading);
    $i = 0;
    // sort them so they're always in the same order
    ksort($exchanges_found);
    foreach ($exchanges_found as $key => $ignored) {
        $headings[$key] = array('title' => $get_heading_title($key, $args), 'line_width' => 2, 'color' => default_chart_color(in_array(strtolower($key), get_all_currencies()) ? array_search(strtolower($key), get_all_currencies()) : $i++));
    }
    $data[0] = $headings;
    // add '0' for exchanges that we've found at one point, but don't have a data point
    // but reset to '0' for exchanges that are no longer present (i.e. from graph_data_balances archives)
    // this fixes a bug where old securities data is still displayed as present in long historical graphs
    $previous_row = array();
    foreach ($data_temp as $date => $values) {
        $row = array('new Date(' . date('Y, n-1, j', strtotime($date)) . ')');
        foreach ($exchanges_found as $key => $ignored) {
            if (!$hide_missing_data || strtotime($date) <= $latest[$key]) {
                if (!isset($values[$key])) {
                    $row[$key] = graph_number_format(isset($previous_row[$key]) ? $previous_row[$key] : 0);
                } else {
                    $row[$key] = graph_number_format(demo_scale($values[$key]));
                }
            } else {
                $row[$key] = graph_number_format(0);
            }
        }
        if (count($row) > 1) {
            // don't add empty rows
            $data[$date] = $row;
            $previous_row = $row;
        }
    }
    // make proportional?
    if ($make_proportional) {
        $data_temp = array();
        foreach ($data as $row => $columns) {
            $row_temp = array();
//.........这里部分代码省略.........
开发者ID:phpsource,项目名称:openclerk,代码行数:101,代码来源:render.php

示例15: foreach

echo "<th>Exchange</th>";
foreach ($all_currencies as $cur => $ignored) {
    $class = in_array($cur, get_all_currencies()) ? "supported" : "";
    if (require_get("only_supported", false) && !in_array($cur, get_all_currencies())) {
        continue;
    }
    echo "<th class=\"{$class}\">" . htmlspecialchars($cur) . "</th>";
}
echo "</tr>\n";
$exchange_pairs = get_exchange_pairs();
$get_supported_wallets = get_supported_wallets();
foreach ($exchanges as $exchange) {
    echo "<tr>";
    echo "<th>" . htmlspecialchars($exchange->getName()) . "</th>";
    foreach ($all_currencies as $cur => $ignored) {
        if (require_get("only_supported", false) && !in_array($cur, get_all_currencies())) {
            continue;
        }
        $class = isset($matrix[$exchange->getCode()][$cur]) ? "reported" : "";
        // do we have at least one exchange pair for this defined?
        $pair_supported = false;
        foreach ($exchange_pairs[$exchange->getCode()] as $pair) {
            if ($pair[0] == $cur || $pair[1] == $cur) {
                $pair_supported = true;
            }
        }
        if (isset($get_supported_wallets[$exchange->getCode()]) && in_array($cur, $get_supported_wallets[$exchange->getCode()])) {
            $class .= " wallet";
        }
        $class .= $pair_supported ? " supported" : "";
        echo "<td class=\"{$class}\">{$class}</td>";
开发者ID:phpsource,项目名称:openclerk,代码行数:31,代码来源:admin_reported_currencies.php


注:本文中的get_all_currencies函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。