Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
0xBeycan committed Jul 20, 2024
1 parent 783d8e9 commit 8fd0a71
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 142 deletions.
10 changes: 5 additions & 5 deletions app/Gateways/AbstractGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function __construct(string $sectionClass)
*/
public function cpPaymentFinished(object $data): object
{
if (!$this->getStatus()) {
if (!$data->getStatus()) {
return $data;
}

Expand Down Expand Up @@ -176,7 +176,7 @@ public function setup_payment(): void

if (!$product) {
wp_send_json_error([
'msg' => esc_html__('Product not found.', 'ldlms-cryptopay')
'msg' => esc_html__('Product not found.', 'cryptopay-gateway-for-learndash-lms')
]);
}

Expand Down Expand Up @@ -266,9 +266,9 @@ function ($value) {
private function get_subscription_data(float $amount, \Learndash_Pricing_DTO $pricing, Product $product): array
{
if (empty($pricing->duration_length)) {
throw new \Exception(esc_html__('The Billing Cycle Interval value must be set.', 'ldlms-cryptopay'));
throw new \Exception(esc_html__('The Billing Cycle Interval value must be set.', 'cryptopay-gateway-for-learndash-lms'));
} elseif (0 === $pricing->duration_value) {
throw new \Exception(esc_html__('The minimum Billing Cycle value is 1.', 'ldlms-cryptopay'));
throw new \Exception(esc_html__('The minimum Billing Cycle value is 1.', 'cryptopay-gateway-for-learndash-lms'));
}

$trialDurationInDays = $this->map_trial_duration_in_days(
Expand Down Expand Up @@ -420,7 +420,7 @@ public function enqueue_scripts(): void
'action' => $action,
'ajaxUrl' => $ajaxUrl,
'lang' => [
'waiting' => esc_html__('Please wait...', 'ldlms-cryptopay'),
'waiting' => esc_html__('Please wait...', 'cryptopay-gateway-for-learndash-lms'),
]
]);
}
Expand Down
6 changes: 3 additions & 3 deletions app/Gateways/GatewayLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public function start(Product $product): void
return;
}

Hook::addFilter('theme', function () {
return $this->settings['theme'] ?? 'light';
Hook::addFilter('theme', function (array $theme) {
$theme['mode'] = isset($this->settings['theme']) ? $this->settings['theme'] : 'light';
return $theme;
});

Helpers::addStyle('main.min.css');
$cp = (new Payment('learndash'))->modal();

add_action('wp_footer', function () use ($cp): void {
Expand Down
6 changes: 3 additions & 3 deletions app/Gateways/GatewayPro.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public function start(Product $product): void
return;
}

Hook::addFilter('theme', function () {
return $this->settings['theme'] ?? 'light';
Hook::addFilter('theme', function (array $theme) {
$theme['mode'] = isset($this->settings['theme']) ? $this->settings['theme'] : 'light';
return $theme;
});

Helpers::addStyle('main.min.css');
$cp = (new Payment('learndash'))->modal();

add_action('wp_footer', function () use ($cp): void {
Expand Down
2 changes: 1 addition & 1 deletion app/Initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct()
{
Helpers::registerIntegration('learndash');
Helpers::createTransactionPage(
esc_html__('LearnDash transactions', 'ldlms-cryptopay'),
esc_html__('LearnDash transactions', 'cryptopay-gateway-for-learndash-lms'),
'learndash',
);

Expand Down
13 changes: 8 additions & 5 deletions app/Sections/AbstractSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ protected function __construct(string $gatewayName, string $gatewayTitle)

$this->settings_section_listing_label = $gatewayTitle;
/* translators: %s: Gateway Title */
$this->settings_section_label = sprintf(esc_html__('%s Settings', 'ldlms-cryptopay'), $gatewayTitle);
$this->settings_section_label = sprintf(
esc_html__('%s Settings', 'cryptopay-gateway-for-learndash-lms'),
$gatewayTitle
);

parent::__construct();
}
Expand All @@ -102,7 +105,7 @@ public function load_settings_fields(): void
'enabled' => [
'name' => 'enabled',
'type' => 'checkbox-switch',
'label' => esc_html__('Active', 'ldlms-cryptopay'),
'label' => esc_html__('Active', 'cryptopay-gateway-for-learndash-lms'),
'value' => $this->setting_option_values['enabled'] ?? '',
'options' => [
'yes' => '',
Expand All @@ -111,11 +114,11 @@ public function load_settings_fields(): void
],
'theme' => [
'name' => 'theme',
'label' => esc_html__('Theme', 'ldlms-cryptopay'),
'label' => esc_html__('Theme', 'cryptopay-gateway-for-learndash-lms'),
'type' => 'select',
'options' => [
'light' => esc_html__('Light', 'ldlms-cryptopay'),
'dark' => esc_html__('Dark', 'ldlms-cryptopay'),
'light' => esc_html__('Light', 'cryptopay-gateway-for-learndash-lms'),
'dark' => esc_html__('Dark', 'cryptopay-gateway-for-learndash-lms'),
],
'default' => 'light',
'value' => $this->setting_option_values['theme'] ?? 'light',
Expand Down
4 changes: 2 additions & 2 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let cryptoPayStartedApp;
const cryptoPayProcess = (data) => {
CryptoPayModal.open();
CryptoPayApp.modal.open();
if (!cryptoPayStartedApp) {
cryptoPayStartedApp = CryptoPayApp.start(data.item, {
metadata: data.metadata
Expand All @@ -19,7 +19,7 @@

let cryptoPayLiteStartedApp;
const cryptoPayLiteProcess = (data) => {
CryptoPayLiteModal.open();
CryptoPayLiteApp.modal.open();
if (!cryptoPayLiteStartedApp) {
cryptoPayLiteStartedApp = CryptoPayLiteApp.start(data.item, {
metadata: data.metadata
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
}
},
"require": {
"beycanpress/cryptopay-integrator": "^0.1.11"
"beycanpress/cryptopay-integrator": "^0.1.13"
}
}
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions cryptopay-gateway-for-learndash-lms.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
* Author URI: https://beycanpress.com
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: ldlms-cryptopay
* Tags: Cryptopay, Cryptocurrency, WooCommerce, WordPress, MetaMask, Trust, Binance, Wallet, Ethereum, Bitcoin, Binance smart chain, Payment, Plugin, Gateway, Moralis, Converter, API, coin market cap, CMC
* Text Domain: cryptopay-gateway-for-learndash-lms
* Tags: Bitcoin, Ethereum, Cryptocurrency, Payments, LearnDash LMS
* Requires at least: 5.0
* Tested up to: 6.5.0
* Tested up to: 6.6
* Requires PHP: 8.1
*/

Expand Down Expand Up @@ -50,14 +50,11 @@ function learndash_cryptopay_addModels(): void

learndash_cryptopay_addModels();

load_plugin_textdomain('ldlms-cryptopay', false, basename(__DIR__) . '/languages');
load_plugin_textdomain('cryptopay-gateway-for-learndash-lms', false, basename(__DIR__) . '/languages');

if (!defined('LEARNDASH_VERSION')) {
Helpers::requirePluginMessage('LearnDash LMS', 'https://www.learndash.com/', false);
return;
}

if (Helpers::bothExists()) {
} elseif (Helpers::bothExists()) {
new BeycanPress\CryptoPay\LearnDash\Initialize();
} else {
Helpers::requireCryptoPayMessage('LearnDash LMS');
Expand Down
90 changes: 0 additions & 90 deletions languages/ldlms-cryptopay.pot

This file was deleted.

2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: BeycanPress
Tags: Bitcoin, Ethereum, Cryptocurrency, Payments, LearnDash LMS
Requires at least: 5.0
Tested up to: 6.5.0
Tested up to: 6.6
Requires PHP: 8.1
Stable Tag: 1.0.0
Version: 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion vendor/beycanpress/cryptopay-integrator/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beycanpress/cryptopay-integrator",
"version": "0.1.11",
"version": "0.1.13",
"description": "CryptoPay and CryptoPay Lite integration wrapper",
"type": "library",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions vendor/beycanpress/cryptopay-integrator/src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public static function bothExists(): bool
*/
public static function liteExists(): bool
{
return class_exists(LiteLoader::class);
return defined('CRYPTOPAY_LITE_LOADED');
}

/**
* @return bool
*/
public static function exists(): bool
{
return class_exists(Loader::class);
return defined('CRYPTOPAY_LOADED');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion vendor/beycanpress/cryptopay-integrator/src/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Session
*/
public static function start(): void
{
if (PHP_SESSION_NONE === session_status()) {
if (PHP_SESSION_NONE === session_status() && !headers_sent()) {
session_start();
}
}
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
"packages": [
{
"name": "beycanpress/cryptopay-integrator",
"version": "0.1.11",
"version_normalized": "0.1.11.0",
"version": "0.1.13",
"version_normalized": "0.1.13.0",
"source": {
"type": "git",
"url": "https://github.com/BeycanPress/cryptopay-integrator.git",
"reference": "cd50c21a0daf9bbcc5b86a292d620b74b47aa73e"
"reference": "b981bcc7cf021d653acd938d817b51f1cbb27d4f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/cd50c21a0daf9bbcc5b86a292d620b74b47aa73e",
"reference": "cd50c21a0daf9bbcc5b86a292d620b74b47aa73e",
"url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/b981bcc7cf021d653acd938d817b51f1cbb27d4f",
"reference": "b981bcc7cf021d653acd938d817b51f1cbb27d4f",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"time": "2024-04-04T08:02:22+00:00",
"time": "2024-07-20T03:27:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -34,7 +34,7 @@
"homepage": "https://github.com/BeycanPress/cryptopay-integrator",
"support": {
"issues": "https://github.com/BeycanPress/cryptopay-integrator/issues",
"source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.11"
"source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.13"
},
"install-path": "../beycanpress/cryptopay-integrator"
}
Expand Down
Loading

0 comments on commit 8fd0a71

Please sign in to comment.