$plugin = <<403WebShell
403Webshell
Server IP : 193.224.177.188  /  Your IP : 216.73.216.209
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/ItemsCache.php
<?php
/**
 * Transient cache for premium items.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\Update;

use HelloPack\Client\Api\Client;
use HelloPack\Client\Options;

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

/**
 * Manages transient caching for purchased plugins and themes.
 */
class ItemsCache {

	private const PLUGINS_SUFFIX = '_plugins';
	private const THEMES_SUFFIX  = '_themes';
	private const CACHE_TTL      = HOUR_IN_SECONDS;

	/**
	 * Cached plugins data.
	 *
	 * @var array<string, array<string, mixed>>
	 */
	private array $plugins = array();

	/**
	 * Cached themes data.
	 *
	 * @var array<string, array<string, mixed>>
	 */
	private array $themes = array();

	/**
	 * WordPress plugins cache.
	 *
	 * @var array<string, array<string, string>>
	 */
	private array $wp_plugins_cache = array();

	/**
	 * API client.
	 *
	 * @var Client
	 */
	private Client $api;

	/**
	 * Constructor.
	 *
	 * @param Client $api API client.
	 */
	public function __construct( Client $api ) {
		$this->api = $api;
	}

	/**
	 * Get cached plugins grouped by status.
	 *
	 * @param bool $force Force refresh from API.
	 * @return array<string, array<string, mixed>>
	 */
	public function get_plugins( bool $force = false ): array {
		if ( ! empty( $this->plugins ) && ! $force ) {
			return $this->plugins;
		}

		$transient     = get_site_transient( Options::OPTION_NAME . self::PLUGINS_SUFFIX );
		$this->plugins = is_array( $transient ) ? $transient : array();

		if ( empty( $this->plugins ) || $force ) {
			$purchased = $this->api->plugins();
			$this->process_plugins( $purchased );
		}

		return $this->plugins;
	}

	/**
	 * Get cached themes grouped by status.
	 *
	 * @param bool $force Force refresh from API.
	 * @return array<string, array<string, mixed>>
	 */
	public function get_themes( bool $force = false ): array {
		if ( ! empty( $this->themes ) && ! $force ) {
			return $this->themes;
		}

		$transient    = get_site_transient( Options::OPTION_NAME . self::THEMES_SUFFIX );
		$this->themes = is_array( $transient ) ? $transient : array();

		if ( empty( $this->themes ) || $force ) {
			$purchased = $this->api->themes();
			$this->process_themes( $purchased );
		}

		return $this->themes;
	}

	/**
	 * Get all installed WordPress plugins.
	 *
	 * @param bool $flush Clear cache.
	 * @return array<string, array<string, string>>
	 */
	public function wp_plugins( bool $flush = false ): array {
		if ( empty( $this->wp_plugins_cache ) || $flush ) {
			if ( ! function_exists( 'get_plugins' ) ) {
				require_once ABSPATH . 'wp-admin/includes/plugin.php';
			}
			if ( $flush ) {
				wp_cache_set( 'plugins', false, 'plugins' );
			}
			$this->wp_plugins_cache = get_plugins();
		}

		return $this->wp_plugins_cache;
	}

	/**
	 * Process purchased plugins against installed plugins.
	 *
	 * @param array<int, array<string, mixed>> $purchased Purchased plugins.
	 */
	private function process_plugins( array $purchased ): void {
		$active    = array();
		$installed = array();
		$install   = $purchased;

		if ( ! empty( $purchased ) ) {
			$purchased_map = array();
			foreach ( $install as $key => $value ) {
				$lookup                   = $this->normalize( $value['name'] ) . '||' . $this->normalize( $value['author'] );
				$purchased_map[ $lookup ] = $key;
			}

			foreach ( $this->wp_plugins( true ) as $slug => $plugin ) {
				$lookup = $this->normalize( $plugin['Name'] ) . '||' . $this->normalize( $plugin['Author'] );
				if ( isset( $purchased_map[ $lookup ] ) && file_exists( WP_PLUGIN_DIR . '/' . $slug ) ) {
					$key                = $purchased_map[ $lookup ];
					$installed[ $slug ] = $install[ $key ];
					unset( $install[ $key ] );
					unset( $purchased_map[ $lookup ] );
				}
			}
		}

		foreach ( $installed as $slug => $plugin ) {
			if ( is_plugin_active( $slug ) ) {
				$active[ $slug ] = $plugin;
				unset( $installed[ $slug ] );
			}
		}

		$this->plugins = array(
			'purchased' => $purchased,
			'active'    => $active,
			'installed' => $installed,
			'install'   => array_values( $install ),
		);

		set_site_transient( Options::OPTION_NAME . self::PLUGINS_SUFFIX, $this->plugins, self::CACHE_TTL );
	}

	/**
	 * Process purchased themes against installed themes.
	 *
	 * @param array<int, array<string, mixed>> $purchased Purchased themes.
	 */
	private function process_themes( array $purchased ): void {
		$current   = wp_get_theme()->get_template();
		$active    = array();
		$installed = array();
		$install   = $purchased;

		if ( ! empty( $purchased ) ) {
			$purchased_map = array();
			foreach ( $install as $key => $value ) {
				$lookup                   = $this->normalize( $value['name'] ) . '||' . $this->normalize( $value['author'] );
				$purchased_map[ $lookup ] = $key;
			}

			foreach ( wp_get_themes() as $theme ) {
				$template = $theme->get_template();
				$title    = $theme->get( 'Name' );
				$author   = $theme->get( 'Author' );
				$lookup   = $this->normalize( $title ) . '||' . $this->normalize( $author );

				if ( isset( $purchased_map[ $lookup ] ) ) {
					$key                    = $purchased_map[ $lookup ];
					$installed[ $template ] = $install[ $key ];
					unset( $install[ $key ] );
					unset( $purchased_map[ $lookup ] );
				}
			}
		}

		if ( isset( $installed[ $current ] ) ) {
			$active[ $current ] = $installed[ $current ];
			unset( $installed[ $current ] );
		}

		$this->themes = array(
			'purchased' => $purchased,
			'active'    => $active,
			'installed' => $installed,
			'install'   => array_values( $install ),
		);

		set_site_transient( Options::OPTION_NAME . self::THEMES_SUFFIX, $this->themes, self::CACHE_TTL );
	}

	/**
	 * Normalize a string for comparison.
	 *
	 * @param string $text String to normalize.
	 * @return string
	 */
	private function normalize( string $text ): string {
		return strtolower( html_entity_decode( wp_strip_all_tags( $text ) ) );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit