Ejemplo n.º 1
0
 /**
   Read the settings from ini.php and return
   an equivalent JSON string
 */
 public static function convertIniPhpToJson()
 {
     $php = dirname(__FILE__) . '/../../ini.php';
     $php = self::readIniPhp();
     $json = array();
     foreach ($php as $key => $val) {
         $json[$key] = $val;
     }
     return JsonLib::prettyJSON(json_encode($json));
 }
Ejemplo n.º 2
0
 /**
   Remove a value from ini.json
   Called by confRemove() if ini.json exists.
   Should not be called directly.
   @param $key string key
   @return boolean success
 */
 private static function jsonConfRemove($key)
 {
     $ini_json = dirname(__FILE__) . '/../ini.json';
     if (!is_writable($ini_json)) {
         return false;
     }
     $json = json_decode(file_get_contents($ini_json), true);
     if (!is_array($json)) {
         return false;
     }
     unset($json[$key]);
     $saved = file_put_contents($ini_json, JsonLib::prettyJSON(json_encode($json)));
     return $saved === false ? false : true;
 }