public static function encode($object)
 {
     header("Content-Type:text/plain");
     return PrettyJSON::prettyPrint(CJSON::encode($object));
 }
예제 #2
0
파일: admin.php 프로젝트: Jougito/DynWeb
 public function changeManifest($moduleName, $setting, $newValue)
 {
     requirePermission("editModuleConfigs");
     $filePath = "application/modules/" . $moduleName . "/manifest.json";
     $manifest = json_decode(file_get_contents($filePath), true);
     // Replace the setting with the newValue
     $manifest[$setting] = $newValue;
     $prettyJSON = new PrettyJSON($manifest);
     // Rewrite the file with the new data
     $fileHandle = fopen($filePath, "w");
     fwrite($fileHandle, $prettyJSON->get());
     fclose($fileHandle);
 }
예제 #3
0
<?php

# processing.php
require 'classes/PrettyJSON.php';
$error = '';
$rHtml = '';
if (!isset($_POST['json'])) {
    $error = 'In _POST not found param JSON';
} else {
    $json = (string) $_POST['json'];
    $engine = new PrettyJSON();
    $engine->setJsonText($json);
    if ($engine->isError()) {
        $error = $engine->getError();
    } else {
        $rHtml = $engine->getHtml();
    }
}
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Processing JSON convert result</title>
</head>
<body>
<?php 
if (strlen($error) > 0) {
    ?>
	<div>Error: <?php 
    echo $error;