Xataface
2.0alpha2
Xataface Application Framework
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
Dataface
JSON.php
Go to the documentation of this file.
1
<?php
2
class
JSON
{
3
4
public
static
function
notice
($msg){
5
return
self::json
(array(
'notice'
=>$msg,
'success'
=>0,
'msg'
=>$msg));
6
}
7
8
public
static
function
warning
($msg){
9
return
self::json
(array(
'warning'
=>$msg,
'success'
=>0,
'msg'
=>$msg));
10
}
11
12
public
static
function
error
($msg){
13
return
self::json
(array(
'error'
=>$msg,
'success'
=>0,
'msg'
=>$msg));
14
}
15
16
public
static
function
json
($arr){
17
import
(
'Services/JSON.php'
);
18
$json =
new
Services_JSON();
19
return
$json->encode($arr);
20
/*
21
if ( is_array($arr) ){
22
$out = array();
23
foreach ( $arr as $key=>$val){
24
$out[] = "'".addslashes($key)."': ".JSON::json($val);
25
}
26
return "{".implode(', ', $out)."}";
27
} else if ( is_int($arr) || is_float($arr) ){
28
return $arr;
29
} else if ( is_bool($arr) ){
30
return ( $arr?'1':'0');
31
} else {
32
return "'".addslashes($arr)."'";
33
}
34
*/
35
}
36
}
Generated on Fri Mar 22 2013 09:40:34 for Xataface by
1.8.1.2