403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.191.102.140
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/task/7779/cwd/plugins/give/src/Framework/WordPressLibraries/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/give/src/Framework/WordPressLibraries/WPAsyncRequest.php
<?php

namespace Give\Framework\WordPressLibraries;

/**
 * This is a fork of WP_Async_Request that adds GiveWP namespaces to prevent conflicts with other plugins.
 *
 * IMPORTANT: Developers, please be aware that the usage of WPAsyncRequest and WPBackgroundProcess is discouraged as they are included only for legacy purposes.
 * Instead, it is strongly recommended to use Action Scheduler for any asynchronous processing needs.
 * Action Scheduler is available, provides a more efficient solution, and is the preferred choice for new development.
 *
 * @since 2.32.0
 */
abstract class WPAsyncRequest
{

    /**
     * Prefix
     *
     * (default value: 'wp')
     *
     * @var string
     * @access protected
     */
    protected $prefix = 'wp';

    /**
     * Action
     *
     * (default value: 'async_request')
     *
     * @var string
     * @access protected
     */
    protected $action = 'async_request';

    /**
     * Identifier
     *
     * @var mixed
     * @access protected
     */
    protected $identifier;

    /**
     * Data
     *
     * (default value: array())
     *
     * @var array
     * @access protected
     */
    protected $data = [];

    /**
     * Initiate new async request
     */
    public function __construct()
    {
        $this->identifier = $this->prefix . '_' . $this->action;

        add_action('wp_ajax_' . $this->identifier, [$this, 'maybe_handle']);
        add_action('wp_ajax_nopriv_' . $this->identifier, [$this, 'maybe_handle']);
    }

    /**
     * Set data used during the request
     *
     * @param array $data Data.
     *
     * @return $this
     */
    public function data($data)
    {
        $this->data = $data;

        return $this;
    }

    /**
     * Dispatch the async request
     *
     * @return array|WP_Error
     */
    public function dispatch()
    {
        $url = add_query_arg($this->get_query_args(), $this->get_query_url());
        $args = $this->get_post_args();

        return wp_remote_post(esc_url_raw($url), $args);
    }

    /**
     * Get query args
     *
     * @return array
     */
    protected function get_query_args()
    {
        if (property_exists($this, 'query_args')) {
            return $this->query_args;
        }

        return [
            'action' => $this->identifier,
            'nonce' => wp_create_nonce($this->identifier),
        ];
    }

    /**
     * Get query URL
     *
     * @return string
     */
    protected function get_query_url()
    {
        if (property_exists($this, 'query_url')) {
            return $this->query_url;
        }

        return admin_url('admin-ajax.php');
    }

    /**
     * Get post args
     *
     * @return array
     */
    protected function get_post_args()
    {
        if (property_exists($this, 'post_args')) {
            return $this->post_args;
        }

        return [
            'timeout' => 0.01,
            'blocking' => false,
            'body' => $this->data,
            'cookies' => $_COOKIE,
            'sslverify' => apply_filters('https_local_ssl_verify', false),
        ];
    }

    /**
     * Maybe handle
     *
     * Check for correct nonce and pass to handler.
     */
    public function maybe_handle()
    {
        // Don't lock up other requests while processing
        session_write_close();

        check_ajax_referer($this->identifier, 'nonce');

        $this->handle();

        wp_die();
    }

    /**
     * Handle
     *
     * Override this method to perform any actions required
     * during the async request.
     */
    abstract protected function handle();

}

Youez - 2016 - github.com/yon3zu
LinuXploit