libSmalldb
v0.3
|
Static Public Member Functions | |
static | template_format ($template, $values, $escaping_function= 'htmlspecialchars') |
static | filename_format ($template, $values) |
static | write_json_file ($filename, $json_array, array $whitelist=null, $json_options=null) |
Encode array to JSON using json_encode, but insert PHP snippet to protect sensitive data. More... | |
static | parse_json_file ($filename) |
JSON version of parse_ini_file(). More... | |
|
static |
|
static |
Encode array to JSON using json_encode, but insert PHP snippet to protect sensitive data.
If $filename is set, JSON will be written to given file. Otherwise you are expected to store returned string into *.json.php file.
Stop snippet: When JSON file is evaluated as PHP, stop snippet will interrupt evaluation without breaking JSON syntax, only underscore key is appended (and overwritten if exists).
To make sure that whitelisted keys does not contain PHP tags, all occurrences of '<?' are replaced with '<_?' in whitelisted values.
Default $json_options are:
Options JSON_HEX_TAG and JSON_HEX_APOS are disabled, becouse they break PHP snippet.
|
static |
JSON version of parse_ini_file().
Throws JsonException on error.