PluginActionUpgrade.php
989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace AC;
use AC\Type\Url\Site;
use AC\Type\Url\UtmTags;
class PluginActionUpgrade implements Registerable
{
private $plugin;
public function __construct(Entity\Plugin $plugin)
{
$this->plugin = $plugin;
}
public function register(): void
{
add_filter('plugin_action_links', [$this, 'add_settings_link'], 2, 2);
add_filter('network_admin_plugin_action_links', [$this, 'add_settings_link'], 2, 2);
}
public function add_settings_link($links, $file)
{
if ($file === $this->plugin->get_basename()) {
$links[] = sprintf(
'<a href="%s" target="_blank">%s</a>',
esc_url((new UtmTags(new Site(Site::PAGE_ABOUT_PRO), 'upgrade'))->get_url()),
sprintf(
'<span style="font-weight: bold;">%s</span>',
__('Go Pro', 'codepress-admin-columns')
)
);
}
return $links;
}
}