OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
email
/
vendor
/
aws
/
aws-sdk-php
/
build
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/10/2024 05:23:06 AM
rwxr-xr-x
📄
Burgomaster.php
13.48 KB
07/10/2024 05:22:17 AM
rw-r--r--
📄
ClassAnnotationUpdater.php
3.3 KB
07/10/2024 05:22:17 AM
rw-r--r--
📄
ClientAnnotator.php
4.57 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
JsonCompiler.php
2.48 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
PhpFileLinterTrait.php
1.44 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
ServiceBuilder.php
1.85 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
annotate-client-locator.php
1.04 KB
07/10/2024 05:22:17 AM
rw-r--r--
📄
annotate-clients.php
2.74 KB
07/10/2024 05:22:17 AM
rw-r--r--
📄
aws-clear-cache.php
91 bytes
07/10/2024 05:22:17 AM
rw-r--r--
📄
build-manifest.php
3.57 KB
07/10/2024 05:22:17 AM
rw-r--r--
📄
build-redirect-map.php
343 bytes
07/10/2024 05:22:17 AM
rw-r--r--
📄
build-service.php
1015 bytes
07/10/2024 05:22:17 AM
rw-r--r--
📁
changelog
-
07/10/2024 05:23:06 AM
rwxr-xr-x
📄
compile-json.php
447 bytes
07/10/2024 05:22:18 AM
rw-r--r--
📁
docs
-
07/10/2024 05:28:28 AM
rwxr-xr-x
📄
docs.php
1.72 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
gh-release.php
6.01 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
normalize-docs-files.php
7.74 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
option-docs.php
1.21 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
packager.php
2.2 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
phar-test-runner.php
161 bytes
07/10/2024 05:22:18 AM
rw-r--r--
📄
remove-method-annotations.php
1.4 KB
07/10/2024 05:22:18 AM
rw-r--r--
📄
test-phar.php
1.05 KB
07/10/2024 05:22:18 AM
rw-r--r--
Editing: JsonCompiler.php
Close
<?php class JsonCompiler { use PhpFileLinterTrait; private static $tokensToReplace = [ '(' => '__OPEN_PARENTHESIS__', ')' => '__CLOSE_PARENTHESIS__', ]; /** @var string */ private $path; public function __construct($path) { if (!file_exists($path)) { throw new InvalidArgumentException("No JSON file found at $path"); } $this->path = realpath($path); } public function compile($outputPath) { $backup = $this->readPhpFile($outputPath); $this->writeFile($outputPath, $this->getTranspiledPhp()); if (!$this->lintFile($outputPath)) { $this->writeFile($outputPath, $backup); trigger_error( "Unable to compile {$this->path} to valid PHP", E_USER_WARNING ); } } private function getTranspiledPhp() { // Use var_export as a starting point. $code = var_export($this->getDecodedData(), true); // Convert "array()" to "[]". $code = str_replace('array (', '[', $code); $code = str_replace(')', ']', $code); // Removing trailing whitespace. $code = preg_replace('/\s+$/m', '', $code); // Move arrays to the same line. $code = preg_replace('/=>\s*\n\s*\[/', '=> [', $code); // Get rid of numbered array indexes. $code = preg_replace('/(\s*)(\d+ => )/', '$1', $code); // Make empty arrays span only a single line. $code = preg_replace('/=>\s*\[\n\s*\]/', '=> []', $code); // Minify the PHP file $code = preg_replace('/\s+/', ' ', str_replace("\n", '', $code)); $originalPath = preg_replace('/^.+?(?=\/src\/data\/)/', '', $this->path); return <<<EOPHP <?php // This file was auto-generated from sdk-root$originalPath return $code; EOPHP; } private function getDecodedData() { return json_decode( strtr(file_get_contents($this->path), self::$tokensToReplace), true ); } private function readPhpFile($path) { return file_exists($path) ? file_get_contents($path) : '<?php return [];'; } private function writeFile($path, $contents) { return file_put_contents( $path, strtr($contents, array_flip(self::$tokensToReplace)), LOCK_EX ); } }