Skip to content

Commit

Permalink
Change plugin folder and file naming to properly reflect WP directory…
Browse files Browse the repository at this point in the history
… slug.
  • Loading branch information
ndeet committed Jul 5, 2021
1 parent 51bf5bc commit 71f7681
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @see https://elementsproject.org/en/doc/0.18.1.11/rpc/
*/
class ElementsClient {
class WCLAElementsClient {

protected $host;

Expand All @@ -14,7 +14,7 @@ class ElementsClient {
protected $args = [];

/**
* ElementsClient constructor.
* WCLAElementsClient constructor.
*
* @param $rpcHost
* @param $rpcUser
Expand Down
2 changes: 1 addition & 1 deletion includes/wcla-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function wcla_plugin_setting_mode() {
echo "<select id='wcla_plugin_setting_mode' name='wcla_plugin_options[wcla_plugin_setting_mode]'>";
foreach ( $items as $id => $value ) {
$selected = ( $selected_option == $id ) ? 'selected="selected"' : '';
echo "<option value='$id' $selected>$value</option>";
echo "<option value='" . esc_attr($id) . "' " . esc_attr($selected) . ">" . esc_attr($value) . "</option>";
}
echo "</select>";
}
Expand Down
26 changes: 12 additions & 14 deletions woocommerce-liquid-assets.php → liquid-assets-for-woocommerce.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?php
/*
Plugin Name: WooCommerce Liquid Assets
Plugin Name: Liquid Assets for WooCommerce
Description: Configure your products to reference Liquid Assets. The plugin will send Liquid Assets (coinos.io and your own Elements RPC node supported) to customers after successful payment.
Version: 1.7
Version: 1.8
Author: Andreas Tasch
Author URI: https://attec.at
License: MIT
Copyright 2021 Andreas Tasch (email : [email protected])
WooCommerce Liquid Assets is free software: you can redistribute it and/or modify
Liquid Assets for WooCommerce is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
WooCommerce Liquid Assets is distributed in the hope that it will be useful,
Liquid Assets for WooCommerce is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the MIT license
along with this WooCommerce Liquid Assets plugin. If not, see https://opensource.org/licenses/MIT.
along with this Liquid Assets for WooCommerce plugin. If not, see https://opensource.org/licenses/MIT.
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -28,7 +28,7 @@

// Includes.
require_once plugin_dir_path(__FILE__) . '/includes/wcla-admin-settings.php';
require_once plugin_dir_path(__FILE__) . '/includes/ElementsClient.php';
require_once plugin_dir_path(__FILE__) . '/includes/WCLAElementsClient.php';

/**
* Display the custom Liquid assets fields.
Expand Down Expand Up @@ -62,10 +62,8 @@ function wcla_create_custom_field() {
*/
function wcla_save_custom_field( $product_id ) {
$product = wc_get_product( $product_id );
$liquid_asset_id = $_POST['liquid_asset_id'] ?? '';
$product->update_meta_data( 'liquid_asset_id', sanitize_text_field( $liquid_asset_id ) );
$liquid_address = $_POST['liquid_address'] ?? '';
$product->update_meta_data( 'liquid_address', sanitize_text_field( $liquid_address ) );
$product->update_meta_data( 'liquid_asset_id', sanitize_text_field( $_POST['liquid_asset_id'] ?? '' ) );
$product->update_meta_data( 'liquid_address', sanitize_text_field( $_POST['liquid_address'] ?? '' ) );
$product->save();
}
add_action( 'woocommerce_process_product_meta', 'wcla_save_custom_field' );
Expand Down Expand Up @@ -210,7 +208,7 @@ function wcla_order_payment_complete( $order_id ) {
if ($status === 'success') {
$msg_asset_sent_status = 'Liquid asset: asset already sent, not sending again.';
} else if ($status === 'error') {
$msg_asset_sent_status = 'Liquid asset: asset sending failed before, not trying again. Please check manually.'
$msg_asset_sent_status = 'Liquid asset: asset sending failed before, not trying again. Please check manually.';
}

$logger->add('liquid-assets', $msg_asset_sent_status);
Expand Down Expand Up @@ -357,14 +355,14 @@ function wcla_coinos_send_liquid_asset( $liquid_address, $asset_id, $quantity )
/**
* Init Elements RPC client.
*
* @return ElementsClient|null
* @return WCLAElementsClient|null
* @throws Exception
*/
function wcla_elements_rpc_init() {
if (!empty($rpc_user = get_option('wcla_plugin_options')['rpc_user'])
&& !empty($rpc_pass = get_option('wcla_plugin_options')['rpc_pass'])
&& !empty($rpc_host = get_option('wcla_plugin_options')['rpc_host'])) {
return new ElementsClient($rpc_host, $rpc_user, $rpc_pass);
return new WCLAElementsClient($rpc_host, $rpc_user, $rpc_pass);
}
return null;
}
Expand Down Expand Up @@ -436,7 +434,7 @@ function wcla_send_admin_mail($message) {
if (!empty($mails = get_option('wcla_plugin_options')['admin_mails'])) {
// Remove whitespaces.
$mails = preg_replace('/\s+/', '', $mails);
return wp_mail( $mails, 'Woocommerce Liquid Assets Plugin', $message);
return wp_mail( $mails, 'Liquid Assets for WooCommerce Plugin', $message);
}
return false;
}
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== WooCommerce Liquid Assets ===
=== Liquid Assets for WooCommerce ===

Contributors: ndeet
Tags: WooCommerce, Liquid Network, Bitcoin, cryptocurrency
Expand Down Expand Up @@ -75,7 +75,7 @@ Make also sure your coinos.io account / Elements node has enough funds of Liquid
= Automatic installation =
This is the easiest option as you can click through everything in the WordPress admin interface. Log in to your WordPress admin panel, navigate to the Plugins menu and click [Add New].

In the search field type "WooCommerce Liquid Assets". You can install it by simply clicking [Install Now]. After clicking that link you will be asked if you're sure you want to install the plugin. Click yes and WordPress will automatically complete the installation. After installation has finished, click the [activate plugin] link.
In the search field type "Liquid Assets for WooCommerce". You can install it by simply clicking [Install Now]. After clicking that link you will be asked if you're sure you want to install the plugin. Click yes and WordPress will automatically complete the installation. After installation has finished, click the [activate plugin] link.

= Manual installation via the WordPress interface =
1. Download the plugin zip file to your computer
Expand Down

0 comments on commit 71f7681

Please sign in to comment.