Location: PHPKode > scripts > Storage > storage_json.php
<?php
/**
 *  @package storage
 *  @author Domenico Pontari <hide@address.com>
 *  @copyright Copyright (c) 2009, Domenico Pontari
 *  @license http://opensource.org/licenses/bsd-license.php New and Simplified BSD licenses
 *  @version 1.0
 */

require_once ('storage.php');

/**
 *  This class needs JSON PHP module
 *  @package storage
 */
class jsonStorage extends storage {
    function prepareToBeStored ($data) {return json_encode($data);}

    function retrieveFromStorage ($data) {
        $data = json_decode($data);
        if ($data === NULL) trigger_error ('dataStoredAreNotInJSONFormat', E_USER_ERROR);
        return $data;
    }
}

?>
Return current item: Storage