$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/LocalScanner.php
<?php
/**
 * Local Scanner class.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\Translate;

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

/**
 * Scans installed plugins and themes for translation data.
 */
final class LocalScanner {

	/**
	 * Get all installed plugin slugs with display names.
	 *
	 * @return array<string, string> Slug => Name.
	 */
	public static function get_installed_plugins(): array {
		if ( ! function_exists( 'get_plugins' ) ) {
			require_once ABSPATH . 'wp-admin/includes/plugin.php';
		}

		$plugins = get_plugins();
		$result  = array();

		foreach ( $plugins as $file => $data ) {
			$slug = self::extract_plugin_slug( $file );

			if ( ! empty( $slug ) ) {
				$result[ $slug ] = $data['Name'] ?? $slug;
			}
		}

		return $result;
	}

	/**
	 * Get all installed theme slugs with display names.
	 *
	 * @return array<string, string> Slug => Name.
	 */
	public static function get_installed_themes(): array {
		$themes = wp_get_themes();
		$result = array();

		foreach ( $themes as $slug => $theme ) {
			$result[ $slug ] = $theme->get( 'Name' );
		}

		return $result;
	}

	/**
	 * Get the local .mo file SHA for comparison.
	 *
	 * @param string $slug   Plugin or theme slug.
	 * @param string $type   Type: 'plugin' or 'theme'.
	 * @param string $locale Locale code.
	 * @return string|null Git-compatible SHA or null if not found.
	 */
	public static function get_local_sha( string $slug, string $type, string $locale ): ?string {
		$path = self::get_local_mo_path( $slug, $type, $locale );

		if ( ! file_exists( $path ) ) {
			return null;
		}

		$content = file_get_contents( $path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents

		if ( false === $content ) {
			return null;
		}

		return self::git_blob_sha( $content );
	}

	/**
	 * Get the PO-Revision-Date from a local .po file.
	 *
	 * @param string $slug   Plugin or theme slug.
	 * @param string $type   Type: 'plugin' or 'theme'.
	 * @param string $locale Locale code.
	 * @return string Date string or empty.
	 */
	public static function get_local_date( string $slug, string $type, string $locale ): string {
		$dir  = 'theme' === $type ? 'themes' : 'plugins';
		$path = WP_LANG_DIR . '/' . $dir . '/' . $slug . '-' . $locale . '.po';

		if ( ! file_exists( $path ) ) {
			return '';
		}

		$content = file_get_contents( $path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents

		if ( false === $content ) {
			return '';
		}

		if ( preg_match( '/PO-Revision-Date:\s*(.+?)\\\\n/', $content, $matches ) ) {
			return trim( $matches[1] );
		}

		return '';
	}

	/**
	 * Get the full path to a local .mo file.
	 *
	 * @param string $slug   Plugin or theme slug.
	 * @param string $type   Type: 'plugin' or 'theme'.
	 * @param string $locale Locale code.
	 * @return string Full file path.
	 */
	public static function get_local_mo_path( string $slug, string $type, string $locale ): string {
		$dir = 'theme' === $type ? 'themes' : 'plugins';
		return WP_LANG_DIR . '/' . $dir . '/' . $slug . '-' . $locale . '.mo';
	}

	/**
	 * Calculate a git blob SHA from file content.
	 *
	 * @param string $content File content.
	 * @return string SHA hash.
	 */
	public static function git_blob_sha( string $content ): string {
		return sha1( 'blob ' . strlen( $content ) . "\0" . $content );
	}

	/**
	 * Extract the plugin slug from a plugin file path.
	 *
	 * @param string $file Plugin file path (e.g. "akismet/akismet.php").
	 * @return string Plugin slug.
	 */
	private static function extract_plugin_slug( string $file ): string {
		if ( str_contains( $file, '/' ) ) {
			return dirname( $file );
		}

		return pathinfo( $file, PATHINFO_FILENAME );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit