SproutCMS

This is the code documentation for the SproutCMS project

class Json

Methods for handling JSON output, usually for AJAX responses

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-22
**/
class NewClassName extends Json {
    
    /**
    * Sends a JSON message which has the success field set to zero
    * and the specified message in the message field.
    * 
    * If $message is an Exception object, the message will be extracted
    * and if on the test server, a stacktrace is included as well.
    * 
    * This method halts execution
    **/
    public function error ($message) {
        // Method code goes here
    }
    
    /**
    * Sends a JSON confirmation response, and then terminates.
    * 
    * The returned data will have the key 'success' =&gt; 1 added.
    * If no data is provided, the returned JSON will only contain the 'success' key.
    * 
    * This method halts execution
    **/
    public function confirm ($data) {
        // Method code goes here
    }
    
    /**
    * Outputs the JSON data (encoded) + correct mime type, then stops script execution
    **/
    public function out (mixed $data, int $options) {
        // Method code goes here
    }
    
}
?>