Skip to content

Commit

Permalink
plugins page links
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepm committed Dec 26, 2019
1 parent 8629db7 commit d4ffddc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
34 changes: 34 additions & 0 deletions class-wp-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/**
Expand Down Expand Up @@ -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( '<a href="https://translate.wordpress.org/projects/wp-plugins/wp-proxy" target="_blank" rel="noopener">%s</a>', __( '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( '<a href="%s">%s</a>', esc_url( $url ), __( 'Settings' ) );
$links[] = $settings_link;
}
}
return $links;
}

/**
* Check URL
*
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion wp-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,6 +15,7 @@
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'WP_PROXY_PLUGIN_NAME', basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
require_once 'class-wp-proxy.php';

/**
Expand Down

0 comments on commit d4ffddc

Please sign in to comment.