$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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/www/wp-content/plugins/hellopack-client/includes/Options.php
<?php
/**
 * Options handler.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client;

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

/**
 * Multisite-aware options manager.
 */
class Options {

	/**
	 * Option name in the database.
	 */
	public const OPTION_NAME = 'hellopack_client';

	/**
	 * Status option name.
	 */
	public const STATUS_OPTION = 'hellopack_client-status';

	/**
	 * Default option values.
	 *
	 * @return array<string, mixed>
	 */
	public static function get_defaults(): array {
		return array(
			'token'  => '',
			'status' => 'inactive',
		);
	}

	/**
	 * Get all options.
	 *
	 * @return array<string, mixed>
	 */
	public static function get_all(): array {
		if ( HELLOPACK_CLIENT_NETWORK_ACTIVATED ) {
			return (array) get_site_option( self::OPTION_NAME, array() );
		}

		return (array) get_option( self::OPTION_NAME, array() );
	}

	/**
	 * Get a single option value.
	 *
	 * @param string $key          Option key.
	 * @param mixed  $fallback_val Default value.
	 * @return mixed
	 */
	public static function get( string $key, mixed $fallback_val = '' ): mixed {
		if ( 'token' === $key && defined( 'HELLOPACK_CLIENT_API_TOKEN' ) ) {
			return (string) HELLOPACK_CLIENT_API_TOKEN;
		}

		$options = self::get_all();

		return $options[ $key ] ?? $fallback_val;
	}

	/**
	 * Whether the API token is defined via the HELLOPACK_CLIENT_API_TOKEN constant.
	 *
	 * @return bool
	 */
	public static function is_token_from_constant(): bool {
		return defined( 'HELLOPACK_CLIENT_API_TOKEN' ) && '' !== HELLOPACK_CLIENT_API_TOKEN;
	}

	/**
	 * Set a single option value.
	 *
	 * @param string $key   Option key.
	 * @param mixed  $value Option value.
	 */
	public static function set( string $key, mixed $value ): void {
		$options         = self::get_all();
		$options[ $key ] = is_string( $value ) ? sanitize_text_field( $value ) : $value;
		self::save( $options );
	}

	/**
	 * Save all options.
	 *
	 * @param array<string, mixed> $options Options array.
	 */
	public static function save( array $options ): void {
		if ( HELLOPACK_CLIENT_NETWORK_ACTIVATED ) {
			update_site_option( self::OPTION_NAME, $options );
		} else {
			update_option( self::OPTION_NAME, $options, true );
		}
	}

	/**
	 * Option name for module on/off settings.
	 */
	public const MODULE_SETTINGS_OPTION = 'hellopack_modules_settings';

	/**
	 * Get module on/off settings.
	 *
	 * Network-level when network activated: whether HelloPack manages a
	 * plugin's licence is a rule for the whole network, not a per-site choice.
	 * Existing per-site settings on the main site are carried over once.
	 *
	 * @return array<string, mixed>
	 */
	public static function get_module_settings(): array {
		if ( ! HELLOPACK_CLIENT_NETWORK_ACTIVATED ) {
			$settings = get_option( self::MODULE_SETTINGS_OPTION, array() );
			return is_array( $settings ) ? $settings : array();
		}

		$settings = get_site_option( self::MODULE_SETTINGS_OPTION, false );

		if ( false === $settings ) {
			$settings = get_blog_option( get_main_site_id(), self::MODULE_SETTINGS_OPTION, array() );
			update_site_option( self::MODULE_SETTINGS_OPTION, is_array( $settings ) ? $settings : array() );
		}

		return is_array( $settings ) ? $settings : array();
	}

	/**
	 * Save module on/off settings.
	 *
	 * @param array<string, mixed> $settings Settings array.
	 */
	public static function save_module_settings( array $settings ): void {
		if ( HELLOPACK_CLIENT_NETWORK_ACTIVATED ) {
			update_site_option( self::MODULE_SETTINGS_OPTION, $settings );
		} else {
			update_option( self::MODULE_SETTINGS_OPTION, $settings );
		}
	}

	/**
	 * Get the site domain including port and path (for subdirectory installs).
	 *
	 * @return string e.g. "example.com", "example.com:8080", "example.com/hu"
	 */
	public static function get_domain(): string {
		$home_url = HELLOPACK_CLIENT_NETWORK_ACTIVATED ? network_home_url() : home_url();
		$domain   = (string) wp_parse_url( $home_url, PHP_URL_HOST );
		$port     = wp_parse_url( $home_url, PHP_URL_PORT );
		$path     = wp_parse_url( $home_url, PHP_URL_PATH );

		if ( $port ) {
			$domain .= ':' . $port;
		}

		if ( $path && '/' !== $path ) {
			$domain .= rtrim( $path, '/' );
		}

		return $domain;
	}

	/**
	 * Mask a token for safe display.
	 *
	 * @param string $token Raw token.
	 * @return string
	 */
	public static function mask_token( string $token ): string {
		if ( strlen( $token ) < 12 ) {
			return str_repeat( '*', strlen( $token ) );
		}

		return substr( $token, 0, 6 ) . '--------' . substr( $token, -6 );
	}

	/**
	 * Clear all HelloPack-related transients.
	 */
	public static function clear_all_transients(): void {
		delete_site_transient( self::OPTION_NAME . '_plugins' );
		delete_site_transient( self::OPTION_NAME . '_themes' );
		delete_site_transient( 'update_plugins' );
		delete_site_transient( 'update_themes' );
		delete_transient( 'hellopack_cron_check' );
		delete_transient( 'hellopack_last_auth_check' );
		delete_transient( 'hellopack_reauth_retry_count' );
	}

	/**
	 * Get license status.
	 *
	 * @return string 'active' or 'inactive'.
	 */
	public static function get_status(): string {
		if ( HELLOPACK_CLIENT_NETWORK_ACTIVATED ) {
			return (string) get_site_option( self::STATUS_OPTION, 'inactive' );
		}

		return (string) get_option( self::STATUS_OPTION, 'inactive' );
	}

	/**
	 * Set license status.
	 *
	 * @param string $status 'active' or 'inactive'.
	 */
	public static function set_status( string $status ): void {
		if ( HELLOPACK_CLIENT_NETWORK_ACTIVATED ) {
			update_site_option( self::STATUS_OPTION, $status );
		} else {
			update_option( self::STATUS_OPTION, $status );
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit