Dotclear


Ignore:
Timestamp:
03/08/18 17:58:39 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting (PSR-2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/maintenance/inc/tasks/class.dc.maintenance.ziptheme.php

    r2044 r3730  
    1010# 
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    12 if (!defined('DC_RC_PATH')) { return; } 
     12if (!defined('DC_RC_PATH')) {return;} 
    1313 
    1414class dcMaintenanceZiptheme extends dcMaintenanceTask 
    1515{ 
    16      protected $perm = 'admin'; 
    17      protected $blog = true; 
    18      protected $tab = 'backup'; 
    19      protected $group = 'zipblog'; 
     16    protected $perm = 'admin'; 
     17    protected $blog = true; 
     18    protected $tab  = 'backup'; 
     19    protected $group = 'zipblog'; 
    2020 
    21      protected function init() 
    22      { 
    23           $this->task = __('Download active theme of current blog'); 
     21    protected function init() 
     22    { 
     23        $this->task = __('Download active theme of current blog'); 
    2424 
    25           $this->description = __('It may be useful to backup the active theme before any change or update. This compress theme folder into a single zip file.'); 
    26      } 
     25        $this->description = __('It may be useful to backup the active theme before any change or update. This compress theme folder into a single zip file.'); 
     26    } 
    2727 
    28      public function execute() 
    29      { 
    30           // Get theme path 
    31           $path = $this->core->blog->themes_path; 
    32           $theme =$this->core->blog->settings->system->theme; 
    33           $dir = path::real($path.'/'.$theme); 
    34           if (empty($path) || empty($theme) || !is_dir($dir)) { 
    35                return false; 
    36           } 
     28    public function execute() 
     29    { 
     30        // Get theme path 
     31        $path = $this->core->blog->themes_path; 
     32        $theme = $this->core->blog->settings->system->theme; 
     33        $dir   = path::real($path . '/' . $theme); 
     34        if (empty($path) || empty($theme) || !is_dir($dir)) { 
     35            return false; 
     36        } 
    3737 
    38           // Create zip 
    39           @set_time_limit(300); 
    40           $fp = fopen('php://output', 'wb'); 
    41           $zip = new fileZip($fp); 
    42           $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); 
    43           $zip->addDirectory($dir.'/', '', true); 
     38        // Create zip 
     39        @set_time_limit(300); 
     40        $fp = fopen('php://output', 'wb'); 
     41        $zip = new fileZip($fp); 
     42        $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); 
     43        $zip->addDirectory($dir . '/', '', true); 
    4444 
    45           // Log task execution here as we sent file and stop script 
    46           $this->log(); 
     45        // Log task execution here as we sent file and stop script 
     46        $this->log(); 
    4747 
    48           // Send zip 
    49           header('Content-Disposition: attachment;filename=theme-'.$theme.'.zip'); 
    50           header('Content-Type: application/x-zip'); 
    51           $zip->write(); 
    52           unset($zip); 
    53           exit(1); 
    54      } 
     48        // Send zip 
     49        header('Content-Disposition: attachment;filename=theme-' . $theme . '.zip'); 
     50        header('Content-Type: application/x-zip'); 
     51        $zip->write(); 
     52        unset($zip); 
     53        exit(1); 
     54    } 
    5555} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map