From d4ffddc11b1cc8a9adb4b148c9247ba20b656a78 Mon Sep 17 00:00:00 2001
From: sleepm <1520667045@qq.com>
Date: Fri, 27 Dec 2019 00:30:18 +0800
Subject: [PATCH] plugins page links
---
class-wp-proxy.php | 34 ++++++++++++++++++++++++++++++++++
readme.txt | 2 +-
wp-proxy.php | 3 ++-
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/class-wp-proxy.php b/class-wp-proxy.php
index a68fd0b..8439eac 100644
--- a/class-wp-proxy.php
+++ b/class-wp-proxy.php
@@ -53,6 +53,8 @@ public function __construct() {
}
add_action( 'admin_menu', array( $this, 'options_page' ) );
add_action( 'admin_init', array( $this, 'register_settings' ) );
+ add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_details_links' ), 10, 2 );
}
/**
@@ -138,6 +140,38 @@ public function options_page() {
}
}
+ /**
+ * In plugins page show some links
+ *
+ * @param array $links links.
+ * @param string $file file.
+ * @since 1.3.2
+ */
+ public function plugin_details_links( $links, $file ) {
+ if ( WP_PROXY_PLUGIN_NAME === $file ) {
+ $links[] = sprintf( '%s', __( 'Translations' ) );
+ }
+ return $links;
+ }
+
+ /**
+ * In plugins page show some links
+ *
+ * @param array $links links.
+ * @param string $file file.
+ * @since 1.3.2
+ */
+ public function plugin_action_links( $links, $file ) {
+ if ( current_user_can( 'manage_options' ) ) {
+ if ( WP_PROXY_PLUGIN_NAME === $file ) {
+ $url = admin_url( 'options-general.php?page=wp_proxy' );
+ $settings_link = sprintf( '%s', esc_url( $url ), __( 'Settings' ) );
+ $links[] = $settings_link;
+ }
+ }
+ return $links;
+ }
+
/**
* Check URL
*
diff --git a/readme.txt b/readme.txt
index d93f9fe..c4fe60f 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Donate link: https://xn--vkuk.org/blog/wp-proxy
Tags: proxy
Requires at least: 3.0.1
Tested up to: 5.3.2
-Stable tag: 1.0.0
+Stable tag: 1.3.3
Requires PHP: 5.2.4
License: GPLv2 or later
diff --git a/wp-proxy.php b/wp-proxy.php
index 0c07d4f..9557f84 100644
--- a/wp-proxy.php
+++ b/wp-proxy.php
@@ -3,7 +3,7 @@
* Plugin Name: WP Proxy
* Plugin URI: https://xn--vkuk.org/blog/wp-proxy
* Description: manage proxy for WordPress
- * Version: 1.0.0
+ * Version: 1.3.3
* Author: sleepm
* Text Domain: wp-proxy
* Domain Path: /languages
@@ -15,6 +15,7 @@
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
+define( 'WP_PROXY_PLUGIN_NAME', basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
require_once 'class-wp-proxy.php';
/**