예제 #1
0
function get_external_apis()
{
    $external_apis_addresses = array();
    foreach (Currencies::getBalanceCurrencies() as $key) {
        $currency = Currencies::getInstance($key);
        if ($currency->getExplorerURL()) {
            $link = link_to($currency->getExplorerURL(), $currency->getExplorerName());
        } else {
            $link = htmlspecialchars($currency->getExplorerName());
        }
        $external_apis_addresses["address_" . $key] = array('link' => $link, 'package' => Currencies::getDefiningPackage($key));
    }
    $external_apis_blockcounts = array();
    foreach (Currencies::getBlockCurrencies() as $key) {
        $currency = Currencies::getInstance($key);
        if ($currency->getExplorerURL()) {
            $link = link_to($currency->getExplorerURL(), $currency->getExplorerName());
        } else {
            $link = htmlspecialchars($currency->getExplorerName());
        }
        $external_apis_blockcounts["blockcount_" . $key] = array('link' => $link, 'package' => Currencies::getDefiningPackage($key));
    }
    $exchange_tickers = array();
    foreach (Exchanges::getAllInstances() as $key => $exchange) {
        if (in_array($key, Exchanges::getDisabled())) {
            // do not list disabled exchanges
            continue;
        }
        $link = link_to($exchange->getURL(), $exchange->getName());
        $exchange_tickers["ticker_" . $key] = array('link' => $link, 'package' => Exchanges::getDefiningPackage($key));
    }
    $mining_pools = array();
    $exchange_wallets = array();
    foreach (Accounts::getKeys() as $key) {
        if (in_array($key, Accounts::getDisabled())) {
            // do not list disabled accounts
            continue;
        }
        $instance = Accounts::getInstance($key);
        if (in_array($key, Accounts::getMiners())) {
            // a miner
            $mining_pools["account_" . $key] = array('link' => link_to($instance->getURL(), $instance->getName()), 'package' => Accounts::getDefiningPackage($key));
        } else {
            // otherwise, assume exchange wallet
            $exchange_wallets["account_" . $key] = array('link' => link_to($instance->getURL(), $instance->getName()), 'package' => Accounts::getDefiningPackage($key));
        }
    }
    $external_apis = array("Address balances" => $external_apis_addresses, "Block counts" => $external_apis_blockcounts, "Mining pool wallets" => $mining_pools, "Exchange wallets" => $exchange_wallets, "Exchange tickers" => $exchange_tickers, "Security exchanges" => array('securities_796' => '<a href="https://796.com">796 Xchange</a>', 'ticker_crypto-trade' => '<a href="https://crypto-trade.com">Crypto-Trade</a>', 'securities_cryptostocks' => '<a href="http://cryptostocks.com">Cryptostocks</a>', 'securities_havelock' => '<a href="https://www.havelockinvestments.com">Havelock Investments</a>', 'securities_update_cryptostocks' => '<a href="http://cryptostocks.com">Cryptostocks</a> Securities list', 'securities_update_havelock' => '<a href="https://www.havelockinvestments.com">Havelock Investments</a> Securities list', 'securities_update_litecoininvest' => '<a href="https://litecoininvest.com">Litecoininvest</a> Securities list', 'cryptostocks' => '<a href="http://cryptostocks.com">Cryptostocks</a>', 'havelock' => '<a href="https://www.havelockinvestments.com">Havelock Investments</a>', 'litecoininvest' => '<a href="https://litecoininvest.com">Litecoininvest</a>'), "Individual securities" => array('individual_crypto-trade' => '<a href="https://crypto-trade.com">Crypto-Trade</a>', 'individual_cryptostocks' => '<a href="http://cryptostocks.com">Cryptostocks</a>', 'individual_havelock' => '<a href="https://www.havelockinvestments.com">Havelock Investments</a>', 'individual_litecoininvest' => '<a href="https://litecoininvest.com">Litecoininvest</a>'), "Other" => array('outstanding' => '<a href="' . htmlspecialchars(url_for('premium')) . '">Premium account</a> processing'));
    // convert to new format
    foreach ($external_apis as $group => $data) {
        foreach ($data as $key => $value) {
            if (!is_array($value)) {
                $external_apis[$group][$key] = array('link' => $value);
            }
        }
    }
    return $external_apis;
}