Lines Matching +full:restore +full:- +full:keys
13 …var $_format = 'php'; // format of the config file, supported formats - php (overridden b…
14 …var $_heading = ''; // heading string written at top of config file - don't include com…
32 msg('No configuration metadata found at - '.htmlspecialchars($datafile),-1);
37 if (isset($config['varname'])) $this->_name = $config['varname'];
38 if (isset($config['format'])) $this->_format = $config['format'];
39 if (isset($config['heading'])) $this->_heading = $config['heading'];
41 if (isset($file['default'])) $this->_default_file = $file['default'];
42 if (isset($file['local'])) $this->_local_file = $file['local'];
43 if (isset($file['protected'])) $this->_protected_file = $file['protected'];
45 $this->locked = $this->_is_locked();
47 $this->_metadata = array_merge($meta, $this->get_plugintpl_metadata($conf['template']));
49 $this->retrieve_settings();
55 if (!$this->_loaded) {
56 …$default = array_merge($this->_read_config($this->_default_file), $this->get_plugintpl_default($co…
57 $local = $this->_read_config($this->_local_file);
58 $protected = $this->_read_config($this->_protected_file);
60 …$keys = array_merge(array_keys($this->_metadata),array_keys($default), array_keys($local), array_k…
61 $keys = array_unique($keys);
63 foreach ($keys as $key) {
64 if (isset($this->_metadata[$key])) {
65 $class = $this->_metadata[$key][0];
68 $param = $this->_metadata[$key];
75 $this->setting[$key] = new $class($key,$param);
76 $this->setting[$key]->initialize($default[$key],$local[$key],$protected[$key]);
79 $this->_loaded = true;
85 if ($this->locked) return false;
87 $file = eval('return '.$this->_local_file.';');
96 @rename($file.'.bak', $file); // problem opening, restore the backup
100 if (empty($header)) $header = $this->_heading;
102 $out = $this->_out_header($id,$header);
104 foreach ($this->setting as $setting) {
105 $out .= $setting->out($this->_name, $this->_format);
108 $out .= $this->_out_footer();
125 if ($this->_format == 'php') {
128 $pattern = '/\$'.$this->_name.'\[[\'"]([^=]+)[\'"]\] ?= ?(.*?);/';
135 // FIXME ... for now merge multi-dimensional array indices using ____
151 if ($this->_format == 'php') {
155 " * Auto-generated by ".$id." plugin \n".
166 if ($this->_format == 'php') {
167 if ($this->_protected_file) {
168 $out .= "\n@include(".$this->_protected_file.");\n";
170 $out .= "\n// end auto-generated content\n";
179 if (!$this->_local_file) return true;
181 $local = eval('return '.$this->_local_file.';');
203 $tmp = $this->_flatten($value,$prefix.$key.CM_KEYMARKER);
293 $this->_key = $key;
297 $this->$property = $value;
306 if (isset($default)) $this->_default = $default;
307 if (isset($local)) $this->_local = $local;
308 if (isset($protected)) $this->_protected = $protected;
319 if ($this->is_protected()) return false;
321 $value = is_null($this->_local) ? $this->_default : $this->_local;
324 if ($this->_pattern && !preg_match($this->_pattern,$input)) {
325 $this->_error = true;
326 $this->_input = $input;
330 $this->_local = $input;
341 if ($this->is_protected()) {
342 $value = $this->_protected;
345 if ($echo && $this->_error) {
346 $value = $this->_input;
348 $value = is_null($this->_local) ? $this->_default : $this->_local;
352 $key = htmlspecialchars($this->_key);
355 $label = '<label for="config__'.$key.'">'.$this->prompt($plugin).'</label>';
365 if ($this->is_protected()) return '';
366 if (is_null($this->_local) || ($this->_default == $this->_local)) return '';
375 $out = '$'.$var."['".$this->_out_key()."'] = '".strtr($this->_local, $tr)."';\n";
382 $prompt = $plugin->getLang($this->_key);
383 if (!$prompt) $prompt = htmlspecialchars(str_replace(array('____','_'),' ',$this->_key));
387 function is_protected() { return !is_null($this->_protected); }
388 function is_default() { return !$this->is_protected() && is_null($this->_local); }
389 function error() { return $this->_error; }
391 function _out_key() { return str_replace(CM_KEYMARKER,"']['",$this->_key); }
446 $idx = $i-1;
447 while(($idx>=0) && ($s{$idx} == '\\')) $idx--;
448 return (($i - $idx + 1) % 2);
474 $i = strpos($contents, $c_close, $i+$c_open_len)+strlen($c_close)-1;