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


PHP Asset::init方法代码示例

本文整理汇总了PHP中Asset::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::init方法的具体用法?PHP Asset::init怎么用?PHP Asset::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Asset的用法示例。


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

示例1: redirect

<?php

require_once 'init.php';
// Redirect user to login page if not logged in
if (!User::is_logged_in()) {
    redirect();
}
$user = new User($_SESSION['user_id']);
// Require admin access:
if (!$user->is_admin()) {
    redirect();
}
$assets_ids = Asset::get_assets();
$assets = array();
foreach ($assets_ids as $asset_id) {
    $asset = Asset::init($asset_id, $config['asset'][$asset_id]['properties']);
    $short_name = $config['asset'][$asset_id]['properties']['short_name'];
    $class = 'CryptoNote_Wallet_' . $asset->short_name;
    if (!class_exists($class)) {
        $class = 'CryptoNote_Wallet';
    }
    $wallet = new $class($config['asset'][$asset_id]['wallet_host'], $config['asset'][$asset_id]['wallet_port']);
    $class = 'CryptoNote_Daemon_' . $asset->short_name;
    if (!class_exists($class)) {
        $class = 'CryptoNote_Daemon';
    }
    $daemon = new $class($config['asset'][$asset_id]['daemon_host'], $config['asset'][$asset_id]['daemon_port']);
    $assets[] = array('id' => $asset_id, 'config' => $config['asset'][$asset_id], 'class' => $asset, 'wallet' => $wallet, 'daemon' => $daemon, 'wallet_ready' => $wallet->is_responding());
}
include 'views/admin/dashboard.php';
开发者ID:MalMen,项目名称:xmr-integration,代码行数:30,代码来源:admin.php

示例2: User

<?php

require_once 'init.php';
if (User::is_logged_in()) {
    $user = new User($_SESSION['user_id']);
    $asset = Asset::init(XMR, $config['asset'][XMR]['properties']);
    $asset_config = $config['asset'][XMR];
    $asset_id = $asset->get_id();
    $user_id = $user->id();
    $payment_id = null;
    $balance = null;
    $balance = $asset->get_balance($user);
    $payment_id = $asset->get_payment_id($user);
    // If payment id was not found, create one
    if (!$payment_id or isset($_POST['new_payment_id'])) {
        $asset->create_payment_id($user);
        refresh();
    }
    if (isset($_POST['withdraw_xmr'])) {
        $amount = trim($_POST['xmr_amount']);
        // Prepare POST data
        $post = array('address' => trim($_POST['xmr_address']), 'payment_id' => trim($_POST['xmr_payment_id']), 'amount' => $amount, 'mixin' => filter_var($_POST['xmr_mixin'], FILTER_VALIDATE_INT, array('options' => array('default' => $asset_config['default_mixin'], 'min_range' => $asset_config['min_mixin'], 'max_range' => $asset_config['max_mixin']))), 'receivable_amount' => bc::op($amount, '-', $asset_config['withdraw_fee']), 'asset_id' => $asset->id);
        if (!csrf_check($_POST['csrf_token'])) {
            $error->set('xmr_address', 'Invalid CSRF, session expired. Please refresh.');
        }
        if (!$asset->valid_address($post['address'])) {
            $error->set('xmr_address', 'Please enter a valid XMR Address');
        }
        if (!$asset->valid_payment_id($post['payment_id'])) {
            $error->set('xmr_payment_id', 'Please enter a valid Payment ID (64 characters, alpha-numeric string) or leave the field empty to send without payment id');
        }
开发者ID:songproducer,项目名称:xmr-integration,代码行数:31,代码来源:index.php

示例3: init

 protected function init(&$data)
 {
     parent::init($data);
     $this->assetRefs += array('parent');
     $this->propMap['asset_genre'] = array('parent' => 'genre_parent', 'title' => 'genre_title', 'description' => 'genre_description');
 }
开发者ID:nevali,项目名称:assets,代码行数:6,代码来源:genre.php

示例4: init

 protected function init(&$data)
 {
     parent::init($data);
     $this->assetRefs += array('source', 'origSource');
     $this->propMap['asset_video'] = array('source' => 'video_source', 'origSource' => 'video_orig_source', 'title' => 'video_title', 'lossy' => 'video_lossy', 'type' => 'video_type', 'copyright' => 'video_copyright', 'license' => 'video_license', 'width' => 'video_xres', 'height' => 'video_yres', 'depth' => 'video_depth', 'chroma' => 'video_chroma', 'fps' => 'video_fps', 'frames' => 'video_frames', 'seqformat' => 'video_seqformat');
 }
开发者ID:nevali,项目名称:assets,代码行数:6,代码来源:video.php

示例5: init

 protected function init(&$data)
 {
     parent::init($data);
     $this->assetRefs += array('source', 'origSource');
     $this->propMap['asset_picture'] = array('source' => 'picture_source', 'origSource' => 'picture_orig_source', 'title' => 'picture_title', 'lossy' => 'picture_lossy', 'type' => 'picture_type', 'copyright' => 'picture_copyright', 'license' => 'picture_license', 'width' => 'picture_xres', 'height' => 'picture_yres', 'depth' => 'picture_depth', 'chroma' => 'picture_chroma', 'filename' => 'picture_filename');
 }
开发者ID:nevali,项目名称:assets,代码行数:6,代码来源:picture.php


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