fixed typos

This commit is contained in:
Steffen Vogel 2010-09-05 22:15:41 +02:00
parent d225ba4f44
commit f9a0ff56e0
4 changed files with 26 additions and 7 deletions

View file

@ -75,12 +75,12 @@ class JSON extends \ArrayObject {
}
/**
* Formats json with indents and new lines
* Formats JSON with indents and new lines
*
* @param string $json
* @param string $indent
* @param string $newLine
* @return string the formatted json
* @return string the formatted JSON
*/
protected static function format($json, $indent = "\t", $newLine = "\n") {
$formatted = '';

View file

@ -34,24 +34,29 @@ use Volkszaehler\Model;
* @author Steffen Vogel <info@steffenvogel.de>
*/
class JSON extends View {
/**
* @var array holds the JSON data in an array
*/
protected $json;
/**
* @var string padding function name or NULL if disabled
*/
protected $padding = FALSE;
/**
* constructor
*/
public function __construct(HTTP\Request $request, HTTP\Response $response) {
public function __construct(HTTP\Request $request, HTTP\Response $response, $padding = FALSE) {
parent::__construct($request, $response);
$this->json = new Util\JSON();
$this->json['source'] = 'volkszaehler.org';
$this->json['version'] = VZ_VERSION;
$this->response->setHeader('Content-type', 'application/json');
$this->setPadding($padding);
$this->padding = $this->request->getParameter('padding');
$this->response->setHeader('Content-type', 'application/json');
}
public function addChannel(Model\Channel $channel, array $data = NULL) {

View file

@ -283,5 +283,19 @@
"name" : "photo:url",
"type" : "string",
"pattern" : "" // TODO add pattern
},
{
"name" : "cuuid",
"type" : "string",
"max" : 37
},
{
"name" : "port",
"type" : "string",
"max" : 6
},
{
"name" : "active",
"type" : "boolean"
}
]

View file

@ -1,6 +1,6 @@
<?php
/**
* Simple test for jquery, ajax and json padding
* Simple test for jquery, ajax and JSON padding
*
* @package tests
* @copyright Copyright (c) 2010, The volkszaehler.org project