Changeset 2423
- Timestamp:
- 07/01/10 22:58:02 (13 years ago)
- Location:
- plugins/cleanConfig
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/cleanConfig/_define.php
r2402 r2423 29 29 /* Description */ "Delete blog and global settings", 30 30 /* Author */ "Moe (http://gniark.net/)", 31 /* Version */ "1.4 ",31 /* Version */ "1.4.1", 32 32 /* Permissions */ null 33 33 ); -
plugins/cleanConfig/inc/lib.cleanconfig.php
r2402 r2423 31 31 { 32 32 global $core; 33 34 $set =& $core->blog->settings; 33 35 34 36 if ($limit == 'blog') 35 37 { 36 # Settings compatibility test 37 if (version_compare(DC_VERSION,'2.2-alpha1','>=')) { 38 $core->blog->settings->{$namespace}->drop($setting); 39 } else { 40 $core->blog->settings->drop($setting); 41 } 38 $set->{$namespace}->drop($setting); 42 39 } 43 40 elseif ($limit == 'global') … … 59 56 { 60 57 global $core; 58 59 $set =& $core->blog->settings; 61 60 62 61 $str = '<p>'.__('Use carefully. Only settings related to plugins can be deleted.').'</p>'."\n"; … … 71 70 72 71 $table->part('body'); 73 74 $settings = array();75 76 # limit to blog77 if ($limit == 'blog')78 {79 $dump = $core->blog->settings->dumpSettings();80 }81 # global82 else83 {84 $dump = $core->blog->settings->dumpGlobalSettings();85 }86 87 foreach ($dump as $k => $v) {88 $settings[$v['ns']][$k] = $v;89 }90 72 91 ksort($settings);92 73 $namespaces = $set->dumpNamespaces(); 74 93 75 # number of settings 94 76 $i = 0; 95 foreach ($settings as $k => $v) 77 78 # Parse all the namespaces 79 foreach (array_keys($namespaces) as $null => $ns) 96 80 { 81 # only settings related to plugins 82 if (($ns == 'system') OR ($ns == 'widgets')) {continue;} 83 84 # limit to blog 85 if ($limit == 'blog') 86 { 87 $dump = $set->{$ns}->dumpSettings(); 88 } 89 # global 90 else 91 { 92 $dump = $set->{$ns}->dumpGlobalSettings(); 93 } 94 97 95 # echo namespace 98 96 $echo_ns = false; 99 # only settings related to plugins100 if (($k != 'system') AND ($k != 'widgets'))97 98 foreach ($dump as $name => $v) 101 99 { 102 ksort($v); 103 foreach ($v as $k => $v) 100 # hide global settings on blog settings 101 if ((($limit == 'global') AND ($v['global'])) 102 OR (($limit == 'blog') AND (!$v['global']))) 104 103 { 105 # hide deleted settings106 if (! ((!empty($_POST['settings'])) AND (in_array($k,$_POST['settings']))))104 # echo namespace 105 if (!$echo_ns) 107 106 { 108 # hide global settings on blog settings 109 if ((($limit == 'global') AND ($v['global'])) OR (($limit == 'blog') AND (!$v['global']))) 110 { 111 $table->row(); 112 # echo namespace 113 if (!$echo_ns) 114 { 115 $table->row(); 116 $table->cell(__('namespace:'). 117 ' <strong>'.$v['ns'].'</strong>', 118 'class="ns-name" colspan="5"'); 119 $echo_ns = true; 120 } 121 122 $id = html::escapeHTML($v['ns'].'|'.$k); 123 $table->row('class="line"'); 124 $table->cell(form::checkbox(array('settings[]',$id), 125 $id,false,$v['ns'])); 126 $table->cell('<label for="'.$id.'">'.$k.'</label>'); 127 # boolean 128 if (($v['type']) == 'boolean') 129 { 130 $value = ($v['value']) ? 'true' : 'false'; 131 } 132 #other types 133 else 134 { 135 $value = form::field(html::escapeHTML($k.'_field'),40, 136 null,html::escapeHTML($v['value']),null,null,null, 137 'readonly="readonly"'); 138 } 139 $table->cell($value); 140 $table->cell($v['type']); 141 $table->cell($v['label'],'class="maximal"'); 142 143 $i++; 144 } 107 $table->row(); 108 $table->cell(__('namespace:'). 109 ' <strong>'.$v['ns'].'</strong>', 110 'class="ns-name" colspan="5"'); 111 $echo_ns = true; 145 112 } 113 114 $id = html::escapeHTML($v['ns'].'|'.$name); 115 $table->row('class="line"'); 116 $table->cell(form::checkbox(array('settings[]',$id), 117 $id,false,$v['ns'])); 118 $table->cell('<label for="'.$id.'">'.$name.'</label>'); 119 # boolean 120 if (($v['type']) == 'boolean') 121 { 122 $value = ($v['value']) ? 'true' : 'false'; 123 } 124 # other types 125 else 126 { 127 $value = form::field(html::escapeHTML($ns.'_field'),40, 128 null,html::escapeHTML($v['value']),null,null,null, 129 'readonly="readonly"'); 130 } 131 $table->cell($value); 132 $table->cell($v['type']); 133 $table->cell($v['label'],'class="maximal"'); 134 135 $i++; 146 136 } 147 137 } … … 159 149 $str .= ('<p class="checkboxes-helpers"></p>'. 160 150 '<p>'.form::hidden(array('limit',$limit),$limit). 161 '<input type="submit" name="delete" value="'.__('Delete selected settings').'" /></p>'."\n". 162 '<p>'.$core->formNonce().'</p>'); 151 '<p>'.$core->formNonce().'</p>'. 152 '<input type="submit" name="delete" value="'. 153 __('Delete selected settings').'" /></p>'); 163 154 } 164 155 $str .= '</form>'."\n";
Note: See TracChangeset
for help on using the changeset viewer.