Skip to content

Commit 3ee39f9

Browse files
author
Edwin Westerhoud
committed
Added Settings link on installed plugins page.
1 parent bf33da1 commit 3ee39f9

4 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/class-tiny-plugin.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public function admin_init() {
5454
add_action('wp_ajax_tiny_compress_image', $this->get_method('compress_image'));
5555
add_action('admin_action_tiny_bulk_compress', $this->get_method('bulk_compress'));
5656
add_action('admin_enqueue_scripts', $this->get_method('enqueue_scripts'));
57+
$plugin = plugin_basename(dirname(dirname(__FILE__)) . '/tiny-compress-images.php');
58+
add_filter("plugin_action_links_$plugin", $this->get_method('add_plugin_links'));
5759
}
5860

5961
public function admin_menu() {
@@ -64,6 +66,12 @@ public function admin_menu() {
6466

6567
}
6668

69+
public function add_plugin_links($current_links) {
70+
$additional[] = sprintf('<a href="options-media.php#%s">%s</a>', self::NAME,
71+
self::translate_escape('Settings'));
72+
return array_merge($additional, $current_links);
73+
}
74+
6775
public function enqueue_scripts($hook) {
6876
wp_enqueue_style(self::NAME .'_admin', plugins_url('/styles/admin.css', __FILE__),
6977
array(), self::plugin_version());
38 Bytes
Binary file not shown.

src/languages/tiny-compress-images-nl_NL.po

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,6 @@ msgstr "Navigeer niet van deze pagina want daardoor stopt het proces"
186186

187187
msgid "You will be notified via this page when the processing is done"
188188
msgstr "Je wordt genotificeerd op deze pagina bij voltooing"
189+
190+
msgid "Settings"
191+
msgstr "Instellingen"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
require_once(dirname(__FILE__) . "/IntegrationTestCase.php");
4+
5+
class PluginIntegrationTest extends IntegrationTestCase {
6+
7+
public function setUp() {
8+
parent::setUp();
9+
self::$driver->get(wordpress('/wp-admin/plugins.php'));
10+
}
11+
12+
public function tearDown() {
13+
clear_settings();
14+
}
15+
16+
public function testTitlePresence()
17+
{
18+
$element = self::$driver->findElements(WebDriverBy::xpath('//*[@id="compress-jpeg-png-images"]//a[text()="Settings"]'));
19+
$this->assertStringEndsWith('options-media.php#tiny-compress-images', $element[0]->getAttribute('href'));
20+
}
21+
}

0 commit comments

Comments
 (0)