PHP Class Pommo_Json, poMMo

This file is part of poMMo (http://www.pommo.org) poMMo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or any later version. poMMo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with program; see the file docs/LICENSE. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Show file Open project: soonick/poMMo Class Usage Examples

Public Properties

Property Type Description
$_failMsg
$_output
$_successMsg

Public Methods

Method Description
__construct ( $toggleEscaping = true )
add ( $key, $value = false ) beware of key conflicts (especially when passing arrays)!
addErr ( $e )
addMsg ( $m )
encode ( $input ) * JSON Encoding Methods authored by Jack Sleight (below); ---------------------------------------------------------------------- Version 0.5 Copyright Jack Sleight - www.reallyshiny.com This script is licensed under the: Creative Commons Attribution-ShareAlike 2.5 License ----------------------------------------------------------------------
escape ( $string )
fail ( $msg = false )
get ( $key, $value, $parent = NULL )
is_assoc ( $array )
loop ( $input, $type )
prefix ( $prefix, &$msg ) NOTE; message is passed by reference (modified via this function).
serve ( $success = true ) return/output the JSON
setFailMsg ( $msg ) sets the default success/failure message
setSuccessMsg ( $msg )
success ( $msg = false )
type ( $key, $value )

Method Details

__construct() public method

public __construct ( $toggleEscaping = true )

add() public method

beware of key conflicts (especially when passing arrays)!
public add ( $key, $value = false )

addErr() public method

public addErr ( $e )

addMsg() public method

public addMsg ( $m )

encode() public method

* JSON Encoding Methods authored by Jack Sleight (below); ---------------------------------------------------------------------- Version 0.5 Copyright Jack Sleight - www.reallyshiny.com This script is licensed under the: Creative Commons Attribution-ShareAlike 2.5 License ----------------------------------------------------------------------
public encode ( $input )

escape() public method

public escape ( $string )

fail() public method

public fail ( $msg = false )

get() public method

public get ( $key, $value, $parent = NULL )

is_assoc() public method

public is_assoc ( $array )

loop() public method

public loop ( $input, $type )

prefix() public method

NOTE; message is passed by reference (modified via this function).
public prefix ( $prefix, &$msg )

serve() public method

return/output the JSON
public serve ( $success = true )

setFailMsg() public method

sets the default success/failure message
public setFailMsg ( $msg )

setSuccessMsg() public method

public setSuccessMsg ( $msg )

success() public method

public success ( $msg = false )

type() public method

public type ( $key, $value )

Property Details

$_failMsg public property

public $_failMsg

$_output public property

public $_output

$_successMsg public property

public $_successMsg