mirror of
https://git.wownero.com/wownero/wownerowp.git
synced 2024-08-15 01:03:16 +00:00
initial
This commit is contained in:
parent
ad6fe196a6
commit
76318e09e4
32 changed files with 825 additions and 797 deletions
|
@ -1,19 +1,19 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (c) 2018, Ryo Currency Project
|
||||
* Admin interface for Monero gateway
|
||||
* Admin interface for Wownero gateway
|
||||
* Authors: mosu-forge
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
require_once('class-monero-admin-payments-list.php');
|
||||
require_once('class-wownero-admin-payments-list.php');
|
||||
|
||||
if (class_exists('Monero_Admin_Interface', false)) {
|
||||
return new Monero_Admin_Interface();
|
||||
if (class_exists('Wownero_Admin_Interface', false)) {
|
||||
return new Wownero_Admin_Interface();
|
||||
}
|
||||
|
||||
class Monero_Admin_Interface {
|
||||
class Wownero_Admin_Interface {
|
||||
|
||||
public function __construct() {
|
||||
add_action('add_meta_boxes', array($this, 'meta_boxes'));
|
||||
|
@ -26,8 +26,8 @@ class Monero_Admin_Interface {
|
|||
*/
|
||||
public function meta_boxes() {
|
||||
add_meta_box(
|
||||
'monero_admin_order_details',
|
||||
__('Monero Gateway','monero_gateway'),
|
||||
'wownero_admin_order_details',
|
||||
__('Wownero Gateway','wownero_gateway'),
|
||||
array($this, 'meta_box_order_details'),
|
||||
'shop_order',
|
||||
'normal',
|
||||
|
@ -39,7 +39,7 @@ class Monero_Admin_Interface {
|
|||
* Meta box for order page
|
||||
*/
|
||||
public function meta_box_order_details($order) {
|
||||
Monero_Gateway::admin_order_page($order);
|
||||
Wownero_Gateway::admin_order_page($order);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,30 +47,30 @@ class Monero_Admin_Interface {
|
|||
*/
|
||||
public function admin_menu() {
|
||||
add_menu_page(
|
||||
__('Monero', 'monero_gateway'),
|
||||
__('Monero', 'monero_gateway'),
|
||||
__('Wownero', 'wownero_gateway'),
|
||||
__('Wownero', 'wownero_gateway'),
|
||||
'manage_woocommerce',
|
||||
'monero_gateway',
|
||||
'wownero_gateway',
|
||||
array($this, 'orders_page'),
|
||||
MONERO_GATEWAY_PLUGIN_URL.'/assets/images/monero-icon-admin.png',
|
||||
MONERO_GATEWAY_PLUGIN_URL.'/assets/images/wownero-icon-admin.png',
|
||||
56 // Position on menu, woocommerce has 55.5, products has 55.6
|
||||
);
|
||||
|
||||
add_submenu_page(
|
||||
'monero_gateway',
|
||||
__('Payments', 'monero_gateway'),
|
||||
__('Payments', 'monero_gateway'),
|
||||
'wownero_gateway',
|
||||
__('Payments', 'wownero_gateway'),
|
||||
__('Payments', 'wownero_gateway'),
|
||||
'manage_woocommerce',
|
||||
'monero_gateway_payments',
|
||||
'wownero_gateway_payments',
|
||||
array($this, 'payments_page')
|
||||
);
|
||||
|
||||
$settings_page = add_submenu_page(
|
||||
'monero_gateway',
|
||||
__('Settings', 'monero_gateway'),
|
||||
__('Settings', 'monero_gateway'),
|
||||
'wownero_gateway',
|
||||
__('Settings', 'wownero_gateway'),
|
||||
__('Settings', 'wownero_gateway'),
|
||||
'manage_options',
|
||||
'monero_gateway_settings',
|
||||
'wownero_gateway_settings',
|
||||
array($this, 'settings_page')
|
||||
);
|
||||
add_action('load-'.$settings_page, array($this, 'settings_page_init'));
|
||||
|
@ -81,22 +81,22 @@ class Monero_Admin_Interface {
|
|||
*/
|
||||
public function admin_menu_update() {
|
||||
global $submenu;
|
||||
if (isset($submenu['monero_gateway'])) {
|
||||
unset($submenu['monero_gateway'][0]);
|
||||
if (isset($submenu['wownero_gateway'])) {
|
||||
unset($submenu['wownero_gateway'][0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monero payments page
|
||||
* Wownero payments page
|
||||
*/
|
||||
public function payments_page() {
|
||||
$payments_list = new Monero_Admin_Payments_List();
|
||||
$payments_list = new Wownero_Admin_Payments_List();
|
||||
$payments_list->prepare_items();
|
||||
$payments_list->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Monero settings page
|
||||
* Wownero settings page
|
||||
*/
|
||||
public function settings_page() {
|
||||
WC_Admin_Settings::output();
|
||||
|
@ -105,7 +105,7 @@ class Monero_Admin_Interface {
|
|||
public function settings_page_init() {
|
||||
global $current_tab, $current_section;
|
||||
|
||||
$current_section = 'monero_gateway';
|
||||
$current_section = 'wownero_gateway';
|
||||
$current_tab = 'checkout';
|
||||
|
||||
// Include settings pages.
|
||||
|
@ -130,4 +130,4 @@ class Monero_Admin_Interface {
|
|||
|
||||
}
|
||||
|
||||
return new Monero_Admin_Interface();
|
||||
return new Wownero_Admin_Interface();
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (c) 2018, Ryo Currency Project
|
||||
* Admin interface for Monero gateway
|
||||
* Admin interface for Wownero gateway
|
||||
* Authors: mosu-forge
|
||||
*/
|
||||
|
||||
|
@ -9,7 +9,7 @@ if(!class_exists('WP_List_Table')) {
|
|||
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
||||
}
|
||||
|
||||
class Monero_Admin_Payments_List extends WP_List_Table {
|
||||
class Wownero_Admin_Payments_List extends WP_List_Table {
|
||||
|
||||
function __construct() {
|
||||
parent::__construct(array(
|
||||
|
@ -54,8 +54,8 @@ class Monero_Admin_Payments_List extends WP_List_Table {
|
|||
} else {
|
||||
$tab_info['all']['active'] = 'class="current" aria-current="page"';
|
||||
}
|
||||
if(Monero_Gateway::get_confirm_type() == 'monero-wallet-rpc') {
|
||||
$balance = Monero_Gateway::admin_balance_info();
|
||||
if(Wownero_Gateway::get_confirm_type() == 'wownero-wallet-rpc') {
|
||||
$balance = Wownero_Gateway::admin_balance_info();
|
||||
$balance_info = <<<HTML
|
||||
<div style="border:1px solid #ddd;padding:5px 10px;">
|
||||
Wallet height: {$balance['height']}</br>
|
||||
|
@ -69,37 +69,37 @@ HTML;
|
|||
}
|
||||
echo <<<HTML
|
||||
<div class="wrap">
|
||||
<h1 class="wp-heading-inline">Monero Payments</h1>
|
||||
<h1 class="wp-heading-inline">Wownero Payments</h1>
|
||||
$balance_info
|
||||
<hr class="wp-header-end">
|
||||
<ul class="subsubsub">
|
||||
<li>
|
||||
<a href="?page=monero_gateway_payments&type=all" {$tab_info['all']['active']}>
|
||||
<a href="?page=wownero_gateway_payments&type=all" {$tab_info['all']['active']}>
|
||||
All <span class="count">({$tab_info['all']['count']})</span>
|
||||
</a> |
|
||||
</li>
|
||||
<li style="display:none">
|
||||
<a href="?page=monero_gateway_payments&type=pending" {$tab_info['pending']['active']}>
|
||||
<a href="?page=wownero_gateway_payments&type=pending" {$tab_info['pending']['active']}>
|
||||
Pending <span class="count">({$tab_info['pending']['count']})</span>
|
||||
</a> |
|
||||
</li>
|
||||
<li>
|
||||
<a href="?page=monero_gateway_payments&type=paid" {$tab_info['paid']['active']}>
|
||||
<a href="?page=wownero_gateway_payments&type=paid" {$tab_info['paid']['active']}>
|
||||
Received <span class="count">({$tab_info['paid']['count']})</span>
|
||||
</a> |
|
||||
</li>
|
||||
<li>
|
||||
<a href="?page=monero_gateway_payments&type=confirmed" {$tab_info['confirmed']['active']}>
|
||||
<a href="?page=wownero_gateway_payments&type=confirmed" {$tab_info['confirmed']['active']}>
|
||||
Confirmed <span class="count">({$tab_info['confirmed']['count']})</span>
|
||||
</a> |
|
||||
</li>
|
||||
<li>
|
||||
<a href="?page=monero_gateway_payments&type=expired" {$tab_info['expired']['active']}>
|
||||
<a href="?page=wownero_gateway_payments&type=expired" {$tab_info['expired']['active']}>
|
||||
Expired <span class="count">({$tab_info['expired']['count']})</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form id="monero-payments-filter" method="get" style="display:none">
|
||||
<form id="wownero-payments-filter" method="get" style="display:none">
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="post-search-input">Search payments:</label>
|
||||
<input type="search" id="post-search-input" name="s" value="">
|
||||
|
@ -107,7 +107,7 @@ HTML;
|
|||
</p>
|
||||
$hidden_fields
|
||||
</form>
|
||||
<h2 class="screen-reader-text">Monero Payments List</h2>
|
||||
<h2 class="screen-reader-text">Wownero Payments List</h2>
|
||||
<style>
|
||||
#col_order_id { width: 150px; }
|
||||
#col_payment_id { width: 150px; }
|
||||
|
@ -145,7 +145,7 @@ HTML;
|
|||
echo $item->height;
|
||||
break;
|
||||
case 'col_amount':
|
||||
echo Monero_Gateway::format_monero($item->amount).' Monero';
|
||||
echo Wownero_Gateway::format_wownero($item->amount).' Wownero';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ HTML;
|
|||
}
|
||||
|
||||
public function no_items() {
|
||||
esc_html_e('No Monero payments found', 'monero_gateway');
|
||||
esc_html_e('No Wownero payments found', 'wownero_gateway');
|
||||
}
|
||||
|
||||
protected function get_filter_vars() {
|
||||
|
@ -212,8 +212,8 @@ HTML;
|
|||
|
||||
protected function get_item_count($type) {
|
||||
global $wpdb;
|
||||
$table_name_1 = $wpdb->prefix.'monero_gateway_quotes';
|
||||
$table_name_2 = $wpdb->prefix.'monero_gateway_quotes_txids';
|
||||
$table_name_1 = $wpdb->prefix.'wownero_gateway_quotes';
|
||||
$table_name_2 = $wpdb->prefix.'wownero_gateway_quotes_txids';
|
||||
$query_where = ' WHERE 1=1 '.$this->get_clause_type($type);
|
||||
$query = "SELECT COUNT(*) AS count FROM {$table_name_2} t2 LEFT JOIN $table_name_1 t1 ON t2.payment_id = t1.payment_id {$query_where}";
|
||||
$item_count = $wpdb->get_var($query);
|
||||
|
@ -249,8 +249,8 @@ HTML;
|
|||
$this->items = array();
|
||||
$filters = $this->get_filter_vars();
|
||||
|
||||
$table_name_1 = $wpdb->prefix.'monero_gateway_quotes';
|
||||
$table_name_2 = $wpdb->prefix.'monero_gateway_quotes_txids';
|
||||
$table_name_1 = $wpdb->prefix.'wownero_gateway_quotes';
|
||||
$table_name_2 = $wpdb->prefix.'wownero_gateway_quotes_txids';
|
||||
|
||||
$query_where = ' WHERE 1=1 ';
|
||||
|
|
@ -4,111 +4,111 @@ defined( 'ABSPATH' ) || exit;
|
|||
|
||||
return array(
|
||||
'enabled' => array(
|
||||
'title' => __('Enable / Disable', 'monero_gateway'),
|
||||
'label' => __('Enable this payment gateway', 'monero_gateway'),
|
||||
'title' => __('Enable / Disable', 'wownero_gateway'),
|
||||
'label' => __('Enable this payment gateway', 'wownero_gateway'),
|
||||
'type' => 'checkbox',
|
||||
'default' => 'no'
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __('Title', 'monero_gateway'),
|
||||
'title' => __('Title', 'wownero_gateway'),
|
||||
'type' => 'text',
|
||||
'desc_tip' => __('Payment title the customer will see during the checkout process.', 'monero_gateway'),
|
||||
'default' => __('Monero Gateway', 'monero_gateway')
|
||||
'desc_tip' => __('Payment title the customer will see during the checkout process.', 'wownero_gateway'),
|
||||
'default' => __('Wownero Gateway', 'wownero_gateway')
|
||||
),
|
||||
'description' => array(
|
||||
'title' => __('Description', 'monero_gateway'),
|
||||
'title' => __('Description', 'wownero_gateway'),
|
||||
'type' => 'textarea',
|
||||
'desc_tip' => __('Payment description the customer will see during the checkout process.', 'monero_gateway'),
|
||||
'default' => __('Pay securely using Monero. You will be provided payment details after checkout.', 'monero_gateway')
|
||||
'desc_tip' => __('Payment description the customer will see during the checkout process.', 'wownero_gateway'),
|
||||
'default' => __('Pay securely using Wownero. You will be provided payment details after checkout.', 'wownero_gateway')
|
||||
),
|
||||
'discount' => array(
|
||||
'title' => __('Discount for using Monero', 'monero_gateway'),
|
||||
'desc_tip' => __('Provide a discount to your customers for making a private payment with Monero', 'monero_gateway'),
|
||||
'description' => __('Enter a percentage discount (i.e. 5 for 5%) or leave this empty if you do not wish to provide a discount', 'monero_gateway'),
|
||||
'title' => __('Discount for using Wownero', 'wownero_gateway'),
|
||||
'desc_tip' => __('Provide a discount to your customers for making a private payment with Wownero', 'wownero_gateway'),
|
||||
'description' => __('Enter a percentage discount (i.e. 5 for 5%) or leave this empty if you do not wish to provide a discount', 'wownero_gateway'),
|
||||
'type' => __('number'),
|
||||
'default' => '0'
|
||||
),
|
||||
'valid_time' => array(
|
||||
'title' => __('Order valid time', 'monero_gateway'),
|
||||
'desc_tip' => __('Amount of time order is valid before expiring', 'monero_gateway'),
|
||||
'description' => __('Enter the number of seconds that the funds must be received in after order is placed. 3600 seconds = 1 hour', 'monero_gateway'),
|
||||
'title' => __('Order valid time', 'wownero_gateway'),
|
||||
'desc_tip' => __('Amount of time order is valid before expiring', 'wownero_gateway'),
|
||||
'description' => __('Enter the number of seconds that the funds must be received in after order is placed. 3600 seconds = 1 hour', 'wownero_gateway'),
|
||||
'type' => __('number'),
|
||||
'default' => '3600'
|
||||
),
|
||||
'confirms' => array(
|
||||
'title' => __('Number of confirmations', 'monero_gateway'),
|
||||
'desc_tip' => __('Number of confirms a transaction must have to be valid', 'monero_gateway'),
|
||||
'description' => __('Enter the number of confirms that transactions must have. Enter 0 to zero-confim. Each confirm will take approximately four minutes', 'monero_gateway'),
|
||||
'title' => __('Number of confirmations', 'wownero_gateway'),
|
||||
'desc_tip' => __('Number of confirms a transaction must have to be valid', 'wownero_gateway'),
|
||||
'description' => __('Enter the number of confirms that transactions must have. Enter 0 to zero-confim. Each confirm will take approximately four minutes', 'wownero_gateway'),
|
||||
'type' => __('number'),
|
||||
'default' => '5'
|
||||
),
|
||||
'confirm_type' => array(
|
||||
'title' => __('Confirmation Type', 'monero_gateway'),
|
||||
'desc_tip' => __('Select the method for confirming transactions', 'monero_gateway'),
|
||||
'description' => __('Select the method for confirming transactions', 'monero_gateway'),
|
||||
'title' => __('Confirmation Type', 'wownero_gateway'),
|
||||
'desc_tip' => __('Select the method for confirming transactions', 'wownero_gateway'),
|
||||
'description' => __('Select the method for confirming transactions', 'wownero_gateway'),
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'viewkey' => __('viewkey', 'monero_gateway'),
|
||||
'monero-wallet-rpc' => __('monero-wallet-rpc', 'monero_gateway')
|
||||
'viewkey' => __('viewkey', 'wownero_gateway'),
|
||||
'wownero-wallet-rpc' => __('wownero-wallet-rpc', 'wownero_gateway')
|
||||
),
|
||||
'default' => 'viewkey'
|
||||
),
|
||||
'monero_address' => array(
|
||||
'title' => __('Monero Address', 'monero_gateway'),
|
||||
'wownero_address' => array(
|
||||
'title' => __('Wownero Address', 'wownero_gateway'),
|
||||
'label' => __('Useful for people that have not a daemon online'),
|
||||
'type' => 'text',
|
||||
'desc_tip' => __('Monero Wallet Address (MoneroL)', 'monero_gateway')
|
||||
'desc_tip' => __('Wownero Wallet Address (Wownero)', 'wownero_gateway')
|
||||
),
|
||||
'viewkey' => array(
|
||||
'title' => __('Secret Viewkey', 'monero_gateway'),
|
||||
'title' => __('Secret Viewkey', 'wownero_gateway'),
|
||||
'label' => __('Secret Viewkey'),
|
||||
'type' => 'text',
|
||||
'desc_tip' => __('Your secret Viewkey', 'monero_gateway')
|
||||
'desc_tip' => __('Your secret Viewkey', 'wownero_gateway')
|
||||
),
|
||||
'daemon_host' => array(
|
||||
'title' => __('Monero wallet RPC Host/IP', 'monero_gateway'),
|
||||
'title' => __('Wownero wallet RPC Host/IP', 'wownero_gateway'),
|
||||
'type' => 'text',
|
||||
'desc_tip' => __('This is the Daemon Host/IP to authorize the payment with', 'monero_gateway'),
|
||||
'desc_tip' => __('This is the Daemon Host/IP to authorize the payment with', 'wownero_gateway'),
|
||||
'default' => '127.0.0.1',
|
||||
),
|
||||
'daemon_port' => array(
|
||||
'title' => __('Monero wallet RPC port', 'monero_gateway'),
|
||||
'title' => __('Wownero wallet RPC port', 'wownero_gateway'),
|
||||
'type' => __('number'),
|
||||
'desc_tip' => __('This is the Wallet RPC port to authorize the payment with', 'monero_gateway'),
|
||||
'desc_tip' => __('This is the Wallet RPC port to authorize the payment with', 'wownero_gateway'),
|
||||
'default' => '18080',
|
||||
),
|
||||
'testnet' => array(
|
||||
'title' => __(' Testnet', 'monero_gateway'),
|
||||
'label' => __(' Check this if you are using testnet ', 'monero_gateway'),
|
||||
'title' => __(' Testnet', 'wownero_gateway'),
|
||||
'label' => __(' Check this if you are using testnet ', 'wownero_gateway'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Advanced usage only', 'monero_gateway'),
|
||||
'description' => __('Advanced usage only', 'wownero_gateway'),
|
||||
'default' => 'no'
|
||||
),
|
||||
'onion_service' => array(
|
||||
'title' => __(' SSL warnings ', 'monero_gateway'),
|
||||
'label' => __(' Check to Silence SSL warnings', 'monero_gateway'),
|
||||
'title' => __(' SSL warnings ', 'wownero_gateway'),
|
||||
'label' => __(' Check to Silence SSL warnings', 'wownero_gateway'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Check this box if you are running on an Onion Service (Suppress SSL errors)', 'monero_gateway'),
|
||||
'description' => __('Check this box if you are running on an Onion Service (Suppress SSL errors)', 'wownero_gateway'),
|
||||
'default' => 'no'
|
||||
),
|
||||
'show_qr' => array(
|
||||
'title' => __('Show QR Code', 'monero_gateway'),
|
||||
'label' => __('Show QR Code', 'monero_gateway'),
|
||||
'title' => __('Show QR Code', 'wownero_gateway'),
|
||||
'label' => __('Show QR Code', 'wownero_gateway'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Enable this to show a QR code after checkout with payment details.'),
|
||||
'default' => 'no'
|
||||
),
|
||||
'use_monero_price' => array(
|
||||
'title' => __('Show Prices in Monero', 'monero_gateway'),
|
||||
'label' => __('Show Prices in Monero', 'monero_gateway'),
|
||||
'use_wownero_price' => array(
|
||||
'title' => __('Show Prices in Wownero', 'wownero_gateway'),
|
||||
'label' => __('Show Prices in Wownero', 'wownero_gateway'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Enable this to convert ALL prices on the frontend to Monero (experimental)'),
|
||||
'description' => __('Enable this to convert ALL prices on the frontend to Wownero (experimental)'),
|
||||
'default' => 'no'
|
||||
),
|
||||
'use_monero_price_decimals' => array(
|
||||
'title' => __('Display Decimals', 'monero_gateway'),
|
||||
'use_wownero_price_decimals' => array(
|
||||
'title' => __('Display Decimals', 'wownero_gateway'),
|
||||
'type' => __('number'),
|
||||
'description' => __('Number of decimal places to display on frontend. Upon checkout exact price will be displayed.'),
|
||||
'default' => 12,
|
||||
'default' => 11,
|
||||
),
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue