Dotclear

Changeset 386


Ignore:
Timestamp:
04/05/08 03:09:57 (16 years ago)
Author:
Moe
Message:

CompreSS : changed license + added Table (PHP <table> class) + remove multiple spaces when compressing

Location:
plugins/compress
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/compress/_admin.php

    r385 r386  
    1 <?php 
     1<?php  
     2# ***** BEGIN LICENSE BLOCK ***** 
     3# 
     4# This file is part of CompreSS. 
     5# Copyright 2008 Moe (http://gniark.net/) 
     6# 
     7# CompreSS is free software; you can redistribute it and/or modify 
     8# it under the terms of the GNU General Public License as published by 
     9# the Free Software Foundation; either version 3 of the License, or 
     10# (at your option) any later version. 
     11# 
     12# CompreSS is distributed in the hope that it will be useful, 
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     15# GNU General Public License for more details. 
     16# 
     17# You should have received a copy of the GNU General Public License 
     18# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     19# 
     20# Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     21# 
     22# ***** END LICENSE BLOCK ***** 
     23 
    224$_menu['Plugins']->addItem(__('CompreSS'),'plugin.php?p=compress', 
    325     'index.php?pf=compress/icon.png',preg_match('/plugin.php\?p=compress(&.*)?$/', 
  • plugins/compress/_define.php

    r385 r386  
    11<?php  
     2# ***** BEGIN LICENSE BLOCK ***** 
     3# 
     4# This file is part of CompreSS. 
     5# Copyright 2008 Moe (http://gniark.net/) 
     6# 
     7# CompreSS is free software; you can redistribute it and/or modify 
     8# it under the terms of the GNU General Public License as published by 
     9# the Free Software Foundation; either version 3 of the License, or 
     10# (at your option) any later version. 
     11# 
     12# CompreSS is distributed in the hope that it will be useful, 
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     15# GNU General Public License for more details. 
     16# 
     17# You should have received a copy of the GNU General Public License 
     18# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     19# 
     20# Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     21# 
     22# ***** END LICENSE BLOCK ***** 
     23 
    224$this->registerModule( 
    325        /* Name */                      "CompreSS", 
    4         /* Description*/                "Compress CSS", 
     26        /* Description*/                "Compress CSS files", 
    527        /* Author */                    "Moe (http://gniark.net/)", 
    6         /* Version */                   '1.0', 
     28        /* Version */                   '1.0.1', 
    729        /* Permissions */               'admin' 
    830); 
  • plugins/compress/class.compress.php

    r385 r386  
    11<?php  
     2# ***** BEGIN LICENSE BLOCK ***** 
     3# 
     4# This file is part of CompreSS. 
     5# Copyright 2008 Moe (http://gniark.net/) 
     6# 
     7# CompreSS is free software; you can redistribute it and/or modify 
     8# it under the terms of the GNU General Public License as published by 
     9# the Free Software Foundation; either version 3 of the License, or 
     10# (at your option) any later version. 
     11# 
     12# CompreSS is distributed in the hope that it will be useful, 
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     15# GNU General Public License for more details. 
     16# 
     17# You should have received a copy of the GNU General Public License 
     18# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     19# 
     20# Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     21# 
     22# ***** END LICENSE BLOCK ***** 
    223 
    324class compress 
     
    137158               } 
    138159          } 
     160          # remove comments 
    139161          # http://www.webmasterworld.com/forum88/11584.htm 
    140162          if (!$core->blog->settings->compress_keep_comments) 
     
    143165          } 
    144166          $compressed_file_content = preg_replace('/(\t|\r|\n)/', '', $compressed_file_content); 
     167          # remove multiple spaces  
     168          # http://bytes.com/forum/thread160400.html 
     169          $compressed_file_content = preg_replace('` {2,}`', ' ', $compressed_file_content); 
    145170          # '{' => '{' 
    146171          $compressed_file_content = str_replace(array(' { ',' {','{ '),'{', $compressed_file_content); 
     
    263288          { 
    264289               $dir_absolute_path = path::real($theme['root']); 
    265                $dirname = substr(strrchr($dir_absolute_path,'/'),1); 
     290               $dirname = substr($dir_absolute_path,(strrpos($dir_absolute_path,'/')+1));  
     291               $table = new table('class="clear" cellspacing="0" cellpadding="1" summary="CSSs"'); 
    266292               $info = ''; 
    267                echo('<table class="clear" cellspacing="0" cellpadding="1" summary="CSSs">'); 
    268                echo("\t".'<caption>'); 
    269                echo('<h3 class="folder">'); 
    270                echo(__('Theme&nbsp;:').' '.$theme['name']); 
    271293               if ($dirname == 'default') {$info .= ' (<strong>'.__('default theme').'</strong>)';} 
    272294               if ($core->blog->settings->theme == $dirname) {$info .= ' (<strong>'.__('blog theme').'</strong>)';} 
    273                echo($info); 
    274                echo('</h3>'); 
    275                echo('</caption>'."\n"); 
    276                echo("\t".'<thead>'."\n\t".'<tr>'."\n\t\t". 
    277                     '<th>'.__('file').'</th>'."\n\t\t". 
    278                     '<th>'.__('size').'</th>'."\n\t\t". 
    279                     '<th>'.__('actions').'</th>'."\n\t\t". 
    280                     '</tr>'."\n\t".'</thead>'); 
    281                echo("\n\t".'<tbody>'."\n\t\t"); 
     295               $table->caption('<h3 class="folder">'.__('Theme&nbsp;:').' '. 
     296                    $theme['name'].$info.'</h3>'); 
     297               $table->headers(__('file'),__('size'),__('actions')); 
     298               $table->part('body'); 
    282299               $list_files = scandir($dir_absolute_path); 
    283300 
     
    335352 
    336353                         if (!empty($tr_class)) {$tr_class = ' '.$tr_class;} 
    337                          echo("\t\t".'<tr class="line'.$tr_class.'">'); 
     354                         $table->row('class="line'.$tr_class.'"'); 
    338355                         if (!empty($info)) {$info = '<br />'.$info;} 
    339                          echo(self::str2td('<a href="'.$url.'">'.$file.'</a>'.$info,$class)); 
     356                         $table->cell('<a href="'.$url.'">'.$file.'</a>'.$info,'class="'.$class.'"'); 
    340357                         if (!empty($percent)) {$percent = '<br />'.$percent;} 
    341                          echo(self::str2td($filesize.$percent)); 
    342                          echo(self::str2td($actions)); 
    343                          echo("\t\t".'</tr>'."\n"); 
     358                         $table->cell($filesize.$percent); 
     359                         $table->cell($actions); 
     360 
    344361                    } 
    345362               } 
    346                echo("\t".'</tbody>'."\n".'</table>'."\n"); 
     363               echo($table->get()); 
    347364          } 
    348365     } 
  • plugins/compress/index.php

    r385 r386  
    11<?php  
     2# ***** BEGIN LICENSE BLOCK ***** 
     3# 
     4# This file is part of CompreSS. 
     5# Copyright 2008 Moe (http://gniark.net/) 
     6# 
     7# CompreSS is free software; you can redistribute it and/or modify 
     8# it under the terms of the GNU General Public License as published by 
     9# the Free Software Foundation; either version 3 of the License, or 
     10# (at your option) any later version. 
     11# 
     12# CompreSS is distributed in the hope that it will be useful, 
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     15# GNU General Public License for more details. 
     16# 
     17# You should have received a copy of the GNU General Public License 
     18# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     19# 
     20# Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     21# 
     22# ***** END LICENSE BLOCK ***** 
     23 
    224if (!defined('DC_CONTEXT_ADMIN')) { exit; } 
    325 
    426     require_once(dirname(__FILE__).'/class.compress.php'); 
     27     require_once(dirname(__FILE__).'/class.table.php'); 
    528 
    629     $default_tab = 'css_list'; 
     
    167190               <?php echo(__('delete the file and replace the compressed file by the original file if the file is original.')); ?> 
    168191          </p> 
    169           <p>Icon (icon.png) is from <a href="http://www.famfamfam.com/lab/icons/silk/">Silk Icons</a></p> 
    170192     </div> 
    171193 
Note: See TracChangeset for help on using the changeset viewer.

Sites map