2017-06-18 18:51:12 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
Plugin Name: Monero - WooCommerce Gateway
|
|
|
|
Plugin URI: http://monerointegrations.com
|
|
|
|
Description: Extends WooCommerce by Adding the Monero Gateway
|
|
|
|
Version: 1.0
|
2017-06-25 09:33:15 +00:00
|
|
|
Author: SerHack
|
2017-08-13 13:26:02 +00:00
|
|
|
Author URI: http://monerointegrations.com
|
2017-06-18 18:51:12 +00:00
|
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly
|
|
|
|
}
|
|
|
|
// Include our Gateway Class and register Payment Gateway with WooCommerce
|
|
|
|
add_action( 'plugins_loaded', 'monero_init', 0 );
|
|
|
|
function monero_init() {
|
|
|
|
/* If the class doesn't exist (== WooCommerce isn't installed), return NULL */
|
|
|
|
if ( ! class_exists( 'WC_Payment_Gateway' ) ) return;
|
|
|
|
|
2017-08-13 13:26:02 +00:00
|
|
|
|
2017-06-18 18:51:12 +00:00
|
|
|
/* If we made it this far, then include our Gateway Class */
|
2017-07-14 05:31:25 +00:00
|
|
|
include_once( 'include/monero_payments.php' );
|
2017-06-29 14:42:36 +00:00
|
|
|
require_once( 'library.php');
|
2017-06-18 18:51:12 +00:00
|
|
|
|
|
|
|
// Lets add it too WooCommerce
|
|
|
|
add_filter( 'woocommerce_payment_gateways', 'monero_gateway' );
|
|
|
|
function monero_gateway( $methods ) {
|
|
|
|
$methods[] = 'Monero_Gateway';
|
|
|
|
return $methods;
|
|
|
|
}
|
2017-08-13 13:26:02 +00:00
|
|
|
|
2017-07-26 09:58:47 +00:00
|
|
|
|
2017-07-26 14:12:27 +00:00
|
|
|
|
2017-06-18 18:51:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add custom link
|
|
|
|
* The url will be http://yourworpress/wp-admin/admin.php?=wc-settings&tab=checkout
|
|
|
|
*/
|
|
|
|
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'monero_payment' );
|
|
|
|
function monero_payment( $links ) {
|
|
|
|
$plugin_links = array(
|
|
|
|
'<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout' ) . '">' . __( 'Settings', 'monero_payment' ) . '</a>',
|
|
|
|
);
|
|
|
|
|
|
|
|
return array_merge( $plugin_links, $links );
|
|
|
|
}
|
2017-08-13 12:37:01 +00:00
|
|
|
add_action( 'admin_menu', 'monero_create_menu' );
|
|
|
|
function monero_create_menu(){
|
|
|
|
add_menu_page(
|
|
|
|
__( 'Monero', 'textdomain' ),
|
|
|
|
'Monero',
|
|
|
|
'manage_options',
|
|
|
|
'admin.php?page=wc-settings&tab=checkout§ion=monero_gateway',
|
|
|
|
'',
|
2017-08-13 13:26:02 +00:00
|
|
|
plugins_url( 'monero/assets/icon.png' ),
|
|
|
|
56 // Position on menu, woocommerce has 55.5, products has 55.6
|
2017-08-13 12:37:01 +00:00
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|