Changeset 2663:8dd9be9b33c1 for plugins/themeEditor/class.themeEditor.php
- Timestamp:
- 02/14/14 22:05:36 (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/themeEditor/class.themeEditor.php
r2651 r2663 158 158 } 159 159 160 public function deletableFile($type,$f) 161 { 162 if ($type != 'tpl') { 163 // Only tpl files may be deleted 164 return false; 165 } 166 167 $files = $this->getFilesFromType($type); 168 if (isset($files[$f])) { 169 $dest = $this->getDestinationFile($type,$f); 170 if ($dest) { 171 if (file_exists($dest) && is_writable($dest)) { 172 // Is there a model (parent theme or template set) ? 173 if (isset($this->tpl_model[$f])) { 174 return true; 175 } 176 } 177 } 178 } 179 return false; 180 } 181 182 public function deleteFile($type,$f) 183 { 184 if ($type != 'tpl') { 185 // Only tpl files may be deleted 186 return; 187 } 188 189 $files = $this->getFilesFromType($type); 190 if (!isset($files[$f])) { 191 throw new Exception(__('File does not exist.')); 192 } 193 194 try 195 { 196 $dest = $this->getDestinationFile($type,$f); 197 if ($dest) { 198 // File exists and may be deleted 199 unlink($dest); 200 201 // Updating template files list 202 $this->findTemplates(); 203 } 204 } 205 catch (Exception $e) 206 { 207 throw new Exception(sprintf(__('Unable to delete file %s. Please check your theme files and folders permissions.'),$f)); 208 } 209 } 210 160 211 protected function getDestinationFile($type,$f) 161 212 { … … 235 286 $this->tpl = array_merge( 236 287 $this->getFilesInDir($this->tplset_theme), 237 $this->getFilesInDir($this->parent_theme.'/tpl'), 238 $this->getFilesInDir($this->user_theme.'/tpl') 288 $this->getFilesInDir($this->parent_theme.'/tpl') 239 289 ); 290 $this->tpl_model = $this->tpl; 291 292 $this->tpl = array_merge($this->tpl,$this->getFilesInDir($this->user_theme.'/tpl')); 240 293 241 294 # Then we look in 'default-templates' plugins directory … … 243 296 foreach ($plugins as $p) { 244 297 $this->tpl = array_merge($this->getFilesInDir($p['root'].'/default-templates'),$this->tpl); 298 $this->tpl_model = array_merge($this->getFilesInDir($p['root'].'/default-templates'),$this->tpl_model); 245 299 } 246 300
Note: See TracChangeset
for help on using the changeset viewer.