From 887965e856131e68ccb2778242b3176819980c3d Mon Sep 17 00:00:00 2001 From: ponddeja <35944403+ponddeja@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:23:08 +0700 Subject: [PATCH 1/3] Add link install the WP Rollback plugin --- includes/Admin/PluginsPage.php | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/includes/Admin/PluginsPage.php b/includes/Admin/PluginsPage.php index 295a49e0..11d28c2f 100644 --- a/includes/Admin/PluginsPage.php +++ b/includes/Admin/PluginsPage.php @@ -21,6 +21,7 @@ class PluginsPage { public function __construct() { add_filter( 'plugin_action_links_' . reepay()->get_setting( 'plugin_basename' ), array( $this, 'add_action_links' ) ); add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 ); + add_filter( 'plugin_row_meta', array( $this, 'rollback_link' ), 20, 2 ); } /** @@ -59,4 +60,55 @@ public function add_plugin_row_meta( $links, $file ): array { return $links; } + + /** + * Show Rollback plugin install, activate URL + * + * @param mixed $links Plugin Row Meta. + * @param mixed $file Plugin Base file. + * + * @return links + */ + public function rollback_link( $links, $file ): array { + if ( reepay()->get_setting( 'plugin_basename' ) === $file ) { + $rollback_link = null; + $plugin_file_path = WP_PLUGIN_DIR . '/wp-rollback/wp-rollback.php'; + if ( !file_exists( $plugin_file_path ) ) { + /** + * Generate install WP-Rollback plguin URL + */ + error_log('Install link'); + $action = 'install-plugin'; + $slug = 'wp-rollback'; + $url = wp_nonce_url( + add_query_arg( + array( + 'action' => $action, + 'plugin' => $slug + ), + admin_url( 'update.php' ) + ), + $action.'_'.$slug + ); + $rollback_link = "" . esc_html__( 'Rollback using WP Rollback', 'reepay-checkout-gateway' ) . ''; + } elseif (!in_array('wp-rollback/wp-rollback.php', apply_filters('active_plugins', get_option('active_plugins')))){ + /** + * Generate activate WP-Rollback plguin URL + */ + $path = 'wp-rollback/wp-rollback.php'; + $url = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$path), 'activate-plugin_'.$path); + $rollback_link = "" . esc_html__( 'Activate Rollback', 'reepay-checkout-gateway' ) . ''; + } + + if($rollback_link){ + array_push( + $links, + $rollback_link + ); + } + + } + + return $links; + } } From d4aeed34ebe999242a338927513733c0046bbe68 Mon Sep 17 00:00:00 2001 From: ponddeja <35944403+ponddeja@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:23:31 +0700 Subject: [PATCH 2/3] Update version 1.7.4 --- Readme.txt | 7 ++++--- reepay-woocommerce-payment.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Readme.txt b/Readme.txt index 2f0bc84a..657fe634 100755 --- a/Readme.txt +++ b/Readme.txt @@ -1,14 +1,14 @@ === Official Billwerk+ Payments Gateway === Contributors: reepaydenmark,aaitse -Tags: payment, billwerk+, reepay, subscription, visa, mastercard, dankort, mobilepay, woocommerce +Tags: billwerk+, visa, mastercard, dankort, mobilepay Requires at least: 4.0 Tested up to: 6.5.3 Requires PHP: 7.4 +Stable tag: 1.7.4 License: GPL License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html -Accept Visa, MasterCard, Dankort, MobilePay, American Express, Diners Club and more directly on your store with the Billwerk+ Payment Gateway for WooCommerce. -The Billwerk+ Payments plugin extends WooCommerce allowing you to take payments on your store via Billwerk+ Payments\'s API. +Accept Visa, MasterCard, Dankort, MobilePay, American Express, Diners Club and more directly on your store with the Billwerk+ Payment Gateway. == Description == Accept Visa, MasterCard, Dankort, MobilePay, American Express, Diners Club and more directly on your store with the Billwerk+ Payment Gateway for WooCommerce. @@ -18,6 +18,7 @@ The Billwerk+ Payments plugin extends WooCommerce allowing you to take payments See installation guide right here: https://docu.billwerk.plus/help/en/apps/woocommerce/setup-woocommerce-plugin.html == Changelog == +v 1.7.4 - Add link install the WP Rollback plugin v 1.7.3 - Logo fixes, WP last support, Order text clear v 1.7.2 - Fixes, refactor, tests v 1.7.1 - New methods add, WPML detect language support, change order calculation diff --git a/reepay-woocommerce-payment.php b/reepay-woocommerce-payment.php index ac64a3d8..665676e3 100755 --- a/reepay-woocommerce-payment.php +++ b/reepay-woocommerce-payment.php @@ -4,7 +4,7 @@ * Description: Get a plug-n-play payment solution for WooCommerce, that is easy to use, highly secure and is built to maximize the potential of your e-commerce. * Author: Billwerk+ * Author URI: http://billwerk.plus - * Version: 1.7.3 + * Version: 1.7.4 * Text Domain: reepay-checkout-gateway * Domain Path: /languages * WC requires at least: 3.0.0 From e82ef929e13cff427c951ac6173bb67a7256601f Mon Sep 17 00:00:00 2001 From: ZenTBelL Date: Mon, 17 Jun 2024 14:56:20 +0700 Subject: [PATCH 3/3] fix code standarts --- includes/Admin/PluginsPage.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/includes/Admin/PluginsPage.php b/includes/Admin/PluginsPage.php index 11d28c2f..6e78d6ee 100644 --- a/includes/Admin/PluginsPage.php +++ b/includes/Admin/PluginsPage.php @@ -66,47 +66,45 @@ public function add_plugin_row_meta( $links, $file ): array { * * @param mixed $links Plugin Row Meta. * @param mixed $file Plugin Base file. - * + * * @return links */ public function rollback_link( $links, $file ): array { if ( reepay()->get_setting( 'plugin_basename' ) === $file ) { - $rollback_link = null; + $rollback_link = null; $plugin_file_path = WP_PLUGIN_DIR . '/wp-rollback/wp-rollback.php'; - if ( !file_exists( $plugin_file_path ) ) { + if ( ! file_exists( $plugin_file_path ) ) { /** * Generate install WP-Rollback plguin URL */ - error_log('Install link'); - $action = 'install-plugin'; - $slug = 'wp-rollback'; - $url = wp_nonce_url( + $action = 'install-plugin'; + $slug = 'wp-rollback'; + $url = wp_nonce_url( add_query_arg( array( 'action' => $action, - 'plugin' => $slug + 'plugin' => $slug, ), admin_url( 'update.php' ) ), - $action.'_'.$slug + $action . '_' . $slug ); $rollback_link = "" . esc_html__( 'Rollback using WP Rollback', 'reepay-checkout-gateway' ) . ''; - } elseif (!in_array('wp-rollback/wp-rollback.php', apply_filters('active_plugins', get_option('active_plugins')))){ + } elseif ( ! in_array( 'wp-rollback/wp-rollback.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) { /** * Generate activate WP-Rollback plguin URL */ - $path = 'wp-rollback/wp-rollback.php'; - $url = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$path), 'activate-plugin_'.$path); + $path = 'wp-rollback/wp-rollback.php'; + $url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $path ), 'activate-plugin_' . $path ); $rollback_link = "" . esc_html__( 'Activate Rollback', 'reepay-checkout-gateway' ) . ''; } - if($rollback_link){ + if ( $rollback_link ) { array_push( $links, $rollback_link ); } - } return $links;