roundcubemail/program/lib/Roundcube/rcube_output.php
public static function json_serialize($input, $pretty = false, $inline = true)
    {
        // The input need to be valid UTF-8 to use with json_encode()
        $input   = rcube_charset::clean($input);
        $options = 0;

        // JSON_HEX_TAG is needed for inlining JSON inside of the <script> tag
        // if input contains a html tag it will cause issues (#6207)
        if ($inline) {
            $options |= JSON_HEX_TAG;
        }

        if ($pretty) {
            $options |= JSON_PRETTY_PRINT;
        }

        // sometimes even using rcube_charset::clean() the input contains invalid UTF-8 sequences
        // that's why we have @ here
        return @json_encode($input, $options);
    }
public static function json_serialize($input, $pretty = false, $inline = true)
    {
        // The input need to be valid UTF-8 to use with json_encode()
        $input   = rcube_charset::clean($input);
        $options = 0;

        // JSON_HEX_TAG is needed for inlining JSON inside of the <script> tag
        // if input contains a html tag it will cause issues (#6207)
        if ($inline) {
            $options |= JSON_HEX_TAG;
        }

        if ($pretty) {
            $options |= JSON_PRETTY_PRINT;
        }

        // sometimes even using rcube_charset::clean() the input contains invalid UTF-8 sequences
        // that's why we have @ here
        return @json_encode($input, $options);
    }
public static function json_serialize ( $ input , $ pretty = false , $ inline = true ) { // The input need to be valid UTF-8 to use with json_encode() $ input = rcube_charset :: clean ( $ input ) ; $ options = 0 ; // JSON_HEX_TAG is needed for inlining JSON inside of the <script> tag // if input contains a html tag it will cause issues (#6207) if ( $ inline ) { $ options |= JSON_HEX_TAG ; } if ( $ pretty ) { $ options |= JSON_PRETTY_PRINT ; } // sometimes even using rcube_charset::clean() the input contains invalid UTF-8 sequences // that's why we have @ here return @ json_encode ( $ input , $ options ) ; }
Convert a variable into a javascript object notation

@param mixed   $input  Input value
@param boolean $pretty Enable JSON formatting
@param boolean $inline Enable inline mode (generates output safe for use inside HTML)

@return string Serialized JSON string
Convert a variable into a javascript object notation