HEX
Server: LiteSpeed
System: Linux premium221.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: madepabj (2566)
PHP: 8.3.26
Disabled: NONE
Upload Files
File: //home/madepabj/gharana.pk/wp-content/plugins/hello-plugin/hello-plugin.php
<?php
/**
 * Plugin Name: Hello Plugin
 * Plugin URI: https://example.com/
 * Description: A simple demo plugin for testing upload & activation.
 * Version: 1.0
 * Author: ChatGPT
 * Author URI: https://openai.com/
 */

if (!defined('ABSPATH')) {
    exit;
}

register_activation_hook(__FILE__, function() {
    error_log("✅ Hello Plugin 已激活!");
});

add_action('admin_menu', function() {
    add_menu_page(
        'Hello Plugin',
        'Hello Plugin',
        'manage_options',
        'hello-plugin',
        'hello_plugin_page',
        'dashicons-smiley',
        6
    );
});

function hello_plugin_page() {
    echo '<div class="wrap"><h1>Hello Plugin Activated!</h1><p>插件运行成功 🎉</p></div>';
}

add_action('init', function() {
    add_rewrite_rule('^hello-plugin/?$', 'index.php?hello_plugin=1', 'top');
});

add_filter('query_vars', function($vars) {
    $vars[] = 'hello_plugin';
    return $vars;
});

add_action('template_redirect', function() {
    if (get_query_var('hello_plugin')) {
        header('Content-Type: text/plain; charset=utf-8');
        echo "Hello from WordPress Plugin! 👋";
        exit;
    }
});