feat(ui): add dashboard shortcut to plugin action links and row meta

This commit is contained in:
idtemankampus-creator
2026-09-18 13:10:04 +07:00
parent cabda4a9da
commit 7269718665
+16 -2
View File
@@ -3,7 +3,7 @@
* Plugin Name: DummyLab Dummy Post & Content Generator * Plugin Name: DummyLab Dummy Post & Content Generator
* Plugin URI: https://apps.masbudi.my.id/dummylab-wp * Plugin URI: https://apps.masbudi.my.id/dummylab-wp
* Description: Advanced dummy content generator for WordPress development with safety controls and bulk purge features. * Description: Advanced dummy content generator for WordPress development with safety controls and bulk purge features.
* Version: 1.5.0 * Version: 1.5.1
* Author: masbudikusuma * Author: masbudikusuma
* Author URI: https://masbudi.my.id * Author URI: https://masbudi.my.id
* Donate link: https://donate.masbudi.my.id/dummylab-wp * Donate link: https://donate.masbudi.my.id/dummylab-wp
@@ -36,6 +36,7 @@ class DummyLab {
add_filter('all_plugins', [$this, 'dynamic_plugin_description']); add_filter('all_plugins', [$this, 'dynamic_plugin_description']);
add_filter('plugin_row_meta', [$this, 'add_plugin_row_meta'], 10, 2); add_filter('plugin_row_meta', [$this, 'add_plugin_row_meta'], 10, 2);
add_filter('plugin_action_links_' . plugin_basename(__FILE__), [$this, 'add_plugin_action_links']);
} }
public static function activate_plugin() { public static function activate_plugin() {
@@ -65,15 +66,28 @@ class DummyLab {
return $all_plugins; return $all_plugins;
} }
// Menambahkan shortcut link di bagian Meta (sebelah Donate)
public function add_plugin_row_meta($links, $file) { public function add_plugin_row_meta($links, $file) {
if ($file === plugin_basename(__FILE__)) { if ($file === plugin_basename(__FILE__)) {
$locale = get_locale(); $locale = get_locale();
$dash_label = (strpos($locale, 'id') === 0) ? '🚀 Buka Dashboard' : '🚀 Open Dashboard';
$donate_label = (strpos($locale, 'id') === 0) ? '☕ Donasi' : '☕ Donate'; $donate_label = (strpos($locale, 'id') === 0) ? '☕ Donasi' : '☕ Donate';
$links[] = '<a href="' . esc_url(admin_url('tools.php?page=dummylab')) . '" style="font-weight: 600; color: #2271b1;">' . $dash_label . '</a>';
$links[] = '<a href="https://donate.masbudi.my.id/dummylab-wp" target="_blank" style="color: #b35900; font-weight: 600;">' . $donate_label . '</a>'; $links[] = '<a href="https://donate.masbudi.my.id/dummylab-wp" target="_blank" style="color: #b35900; font-weight: 600;">' . $donate_label . '</a>';
} }
return $links; return $links;
} }
// Menambahkan shortcut link di bagian Action Links (sebelah Deactivate)
public function add_plugin_action_links($links) {
$locale = get_locale();
$label = (strpos($locale, 'id') === 0) ? 'Dashboard' : 'Dashboard';
$settings_link = '<a href="' . esc_url(admin_url('tools.php?page=dummylab')) . '"><strong>' . $label . '</strong></a>';
array_unshift($links, $settings_link);
return $links;
}
public function add_admin_menu() { public function add_admin_menu() {
add_management_page( add_management_page(
'DummyLab Generator', 'DummyLab Generator',
@@ -170,7 +184,7 @@ class DummyLab {
<div class="dummylab-wrap"> <div class="dummylab-wrap">
<div class="dummylab-header"> <div class="dummylab-header">
<div> <div>
<h1>🧪 DummyLab <span style="font-size: 14px; font-weight: 400; color: #646970;">v1.5.0</span></h1> <h1>🧪 DummyLab <span style="font-size: 14px; font-weight: 400; color: #646970;">v1.5.1</span></h1>
<p><?php echo $t['created_by']; ?> <a href="https://masbudi.my.id" target="_blank" style="text-decoration: none; font-weight: 600; color: #2271b1;">masbudikusuma</a> &bull; <a href="https://apps.masbudi.my.id/dummylab-wp" target="_blank" style="text-decoration: none; color: #2271b1;"><?php echo $t['plugin_doc']; ?></a> &bull; <a href="https://donate.masbudi.my.id/dummylab-wp" target="_blank" style="text-decoration: none; font-weight: 600; color: #b35900;">☕ <?php echo $t['link_donate']; ?></a></p> <p><?php echo $t['created_by']; ?> <a href="https://masbudi.my.id" target="_blank" style="text-decoration: none; font-weight: 600; color: #2271b1;">masbudikusuma</a> &bull; <a href="https://apps.masbudi.my.id/dummylab-wp" target="_blank" style="text-decoration: none; color: #2271b1;"><?php echo $t['plugin_doc']; ?></a> &bull; <a href="https://donate.masbudi.my.id/dummylab-wp" target="_blank" style="text-decoration: none; font-weight: 600; color: #b35900;">☕ <?php echo $t['link_donate']; ?></a></p>
</div> </div>
<div class="dummylab-lang-switch"> <div class="dummylab-lang-switch">