// Given an array of key=>value mappings, save that data to the configuration file function hello_world_save_config($config = array()) { $file = HELLO_WORLD_CONFIGFILE; $contents = json_encode($config); // Encodes the array into a valid JSON string return file_put_contents($file, $contents); // Saves the JSON string into the configuration JSON file } // Load plugin configuration from the JSON file as an array function hello_world_get_config() { $file = HELLO_WORLD_CONFIGFILE; $contents = file_get_contents($file); $json = json_decode($contents); // Decodes the string $config = (array) $json; // Converts the object into a PHP array return $config; }