Changeset 5971


Ignore:
Timestamp:
01/25/12 01:56:27 (4 months ago)
Author:
vain
Message:
  • some cleanups for the comments
  • renamed getCompactHeader() to getCssFileHeader()
  • renamed read_properties() to readCssBuilderIni()
  • added @generated phpdoc tag to the header text of the autogenerated files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/tools/cssbuilder.core.php

    r5899 r5971  
    4343 * into one file, the "import.css". If you include "import.css" in your Theme you laying 
    4444 * a solid base for your own CSS style modifications on top of our CSS Framework. 
    45  * Plus, you might still modify the Clansuite CSS Framework Core to your intents.  
     45 * Plus, you might still modify the Clansuite CSS Framework Core to your intents. 
    4646 * 
    4747 * Basic Usage: 
     
    145145        // initializing 
    146146        $config = Clansuite_CMS::getClansuiteConfig(); 
     147 
    147148        self::setFrontendPath(ROOT_THEMES_FRONTEND); 
    148149        self::setBackendPath(ROOT_THEMES_BACKEND); 
     
    158159    { 
    159160 
    160         #----------------------------------------------------------------------------------------------------------------- 
    161         # Prepare 
    162         #----------------------------------------------------------------------------------------------------------------- 
     161        /** 
     162         * Configuration 
     163         */ 
    163164        $config = self::getConfiguration(); 
    164165 
    165166        $coreadditionalFiles = $themeadditionalFiles = $themeBackadditionalFiles = array(); 
    166167 
     168        # build browser specific configuration filename 
    167169        $browser = $config['browsers']; 
    168170        $postfix = $browser[$index]['postfix']; 
     
    175177        // Read Core INI-File 
    176178        $coreINI = ROOT_THEMES_CORE . 'css' . DS . 'csfw' . DS . $builderINI; 
    177         $coreInfo = $this->read_properties($coreINI); 
     179        $coreInfo = $this->readCssBuilderIni($coreINI); 
    178180        $coreCssName = $coreInfo['cssname'] . $postfix . '.css'; 
    179181 
     
    189191        $core_compact = $this->getCoreCompactHeader($coreInfo); 
    190192 
    191         /* ----- prepare frontend theme ----- */ 
     193        /** 
     194         * prepare frontend theme 
     195         */ 
    192196        if(true === $config['compileThemeFrontend']) 
    193197        { 
     
    200204            // Read INI-File 
    201205            $themeINI = $config['themeFrontendPath'] . DS . $config['themeFrontend'] . DS . 'css' . DS . $builderINI; 
    202             $themeInfo = $this->read_properties($themeINI); 
     206            $themeInfo = $this->readCssBuilderIni($themeINI); 
    203207            $themeInfo['path'] = str_replace("{theme}", $config['themeFrontend'], $themeInfo['path']); 
    204208 
     
    217221        #Clansuite_Debug::printR( $themeFiles ); 
    218222 
    219         /* ----- prepare backend theme ----- */ 
     223        /** 
     224         * prepare backend theme 
     225         */ 
    220226        if(true === $config['compileThemeBackend']) 
    221227        { 
     
    227233            // Read INI-File 
    228234            $themeBackINI = $config['themeBackendPath'] . DS . $config['themeBackend'] . DS . 'css' . DS . $builderINI; 
    229             $themeBackInfo = $this->read_properties($themeBackINI); 
     235            $themeBackInfo = $this->readCssBuilderIni($themeBackINI); 
    230236            $themeBackInfo['path'] = str_replace("{theme}", $config['themeBackend'], $themeBackInfo['path']); 
    231237 
     
    243249        } 
    244250 
    245         $_compact = $this->getCompactHeader($browser[$index]['description']); 
     251        $_compact = $this->getCssFileHeader($browser[$index]['description']); 
    246252        $html = ''; 
    247253 
    248         #----------------------------------------------------------------------------------------------------------------- 
    249         # Build Core CSS 
    250         #----------------------------------------------------------------------------------------------------------------- 
     254        /** 
     255         * Build Core CSS 
     256         */ 
    251257        if(true === $config['compileCore']) 
    252258        { 
     
    268274        } 
    269275 
    270         #----------------------------------------------------------------------------------------------------------------- 
    271         # Build Frontend Theme CSS 
    272         #----------------------------------------------------------------------------------------------------------------- 
     276        /** 
     277         * Build Frontend Theme CSS 
     278         */ 
    273279        /** 
    274280         * create Info + compiled frontend theme stylesheet 
     
    320326        } 
    321327 
    322         #----------------------------------------------------------------------------------------------------------------- 
    323         # Build Backend Theme CSS 
    324         #----------------------------------------------------------------------------------------------------------------- 
     328        /** 
     329         *  Build Backend Theme CSS 
     330         */ 
     331 
    325332        /** 
    326333         * create Info + compiled backend theme stylesheet 
     
    376383 
    377384    /** 
    378      * ------------------------------------------------------------------------------------------------- 
    379      * read_core_definition 
    380      * ------------------------------------------------------------------------------------------------- 
    381      */ 
    382     protected function read_properties($inifile) 
     385     * Reads the ini file 
     386     * 
     387     * @return array ini array 
     388     */ 
     389    protected function readCssBuilderIni($inifile) 
    383390    { 
    384391        $iniArray = parse_ini_file($inifile); 
     
    388395        $search = array(' ', "\t", "\r\n", "\r", CR); 
    389396        $replace = array('', '', '', '', '', ''); 
    390                $iniArray['files'] = str_replace( $search, $replace, $iniArray['files']); 
     397            $iniArray['files'] = str_replace( $search, $replace, $iniArray['files']); 
    391398 
    392399        if(mb_substr($iniArray['files'], strlen($iniArray['files']) - 1) == ',') 
     
    394401            $iniArray['files'] = mb_substr($iniArray['files'], 0, strlen($iniArray['files']) - 1); 
    395402        } 
     403 
    396404        return $iniArray; 
    397405    } 
    398406 
    399     protected function getCompactHeader($browserInfo = '') 
    400     { 
    401         $compact  = ''; 
    402         $compact  = '/**' . CR; 
    403         $compact .= ' * This file has been auto-generated by the Clansuite CSS Framework.' . CR; 
    404         $compact .= ' * Its a compilation of several css files. Do not edit manually. Use CssBuilder!' . CR; 
    405         $compact .= ' * Last Update:  ' . date('Y-m-d H:i:s', time()) . CR; 
    406         $compact .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
    407         $compact .= ' * CSS2 Framework (CSFW)' . CR; 
    408         $compact .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
    409         $compact .= ' * @author       Paul Brand <info@isp-tenerife.net>' . CR; 
    410         $compact .= ' * @package      CSFW' . CR; 
    411         $compact .= ' * @subpackage   Core' . CR; 
    412         $compact .= ' * @version      1.0' . CR; 
    413         $compact .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
    414         $compact .= ' * @description  Created for - ' . $browserInfo . CR; 
    415         $compact .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
    416         $compact .= ' */' . CR; 
    417         $compact .= CR; 
    418         $compact .= '@charset "UTF-8";'; 
    419         $compact .= CR; 
    420         $compact .= CR; 
    421  
    422         return $compact; 
    423     } 
    424  
     407    /** 
     408     * Returns the header text for the css file. 
     409     * 
     410     * @param string $browserInfo Name of the browser this css file is written for. 
     411     * @return string Header text for the css file. 
     412     */ 
     413    protected function getCssFileHeader($browserInfo = '') 
     414    { 
     415        $header  = ''; 
     416        $header  = '/**' . CR; 
     417        $header .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
     418        $header .= ' * Clansuite CSS Framework' . CR; 
     419        $header .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
     420        $header .= ' * This file has been auto-generated by the Clansuite CSS Framework.' . CR; 
     421        $header .= ' * Its a compilation of several css files. Do not edit manually. Use the CssBuilder!' . CR; 
     422        $header .= ' * Last Update:  ' . date('Y-m-d H:i:s', time()) . CR; 
     423        $header .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
     424        $header .= ' * @author       Paul Brand <info@isp-tenerife.net>' . CR; 
     425        $header .= ' * @package      CSFW' . CR; 
     426        $header .= ' * @subpackage   Core' . CR; 
     427        $header .= ' * @version      1.0' . CR; 
     428        $header .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
     429        $header .= ' * @description  Created for - ' . $browserInfo . CR; 
     430        $header .= ' * ---------------------------------------------------------------------------------------------------' . CR; 
     431        $header .= ' * @generated' . CR; 
     432        $header .= ' */' . CR; 
     433        $header .= CR; 
     434        $header .= '@charset "UTF-8";'; 
     435        $header .= CR; 
     436        $header .= CR; 
     437 
     438        return $header; 
     439    } 
     440 
     441    /** 
     442     * Returns the header text for the core css file. 
     443     * 
     444     * @param array $coreInfo Array version information about this class. 
     445     * @return string Header text for the core css file. 
     446     */ 
    425447    protected function getCoreCompactHeader($coreInfo = '') 
    426448    { 
    427         $core_compact  = ''; 
    428         $core_compact  = '/**' . CR; 
    429         $core_compact .= ' * This file has been auto-generated by the Clansuite CSS Framework.' . CR; 
    430         $core_compact .= ' * Its a compilation of several css files. Do not edit manually. Use CssBuilder!' . CR; 
    431         $core_compact .= ' * Last Update:  ' . date('Y-m-d H:i:s', time()) . CR; 
    432         $core_compact .= ' * ----------------------------------------------------------------------------------------------' . CR; 
    433         $core_compact .= ' * Framework:    ' . $coreInfo['framework'] . CR; 
    434         $core_compact .= ' * Description:  ' . $coreInfo['description'] . CR; 
    435         $core_compact .= ' * Author:       ' . $coreInfo['author'] . CR; 
    436         $core_compact .= ' * Version:      ' . $coreInfo['version'] . CR; 
    437         $core_compact .= ' * Version-Date: ' . $coreInfo['date'] . CR; 
    438         $core_compact .= ' * ----------------------------------------------------------------------------------------------' . CR; 
    439         $core_compact .= ' */' . CR; 
    440  
    441         return $core_compact; 
    442     } 
    443  
     449        $header  = ''; 
     450        $header  = '/**' . CR; 
     451        $header .= ' * This file has been auto-generated by the Clansuite CSS Framework.' . CR; 
     452        $header .= ' * Its a compilation of several css files. Do not edit manually. Use the CssBuilder!' . CR; 
     453        $header .= ' * Last Update:  ' . date('Y-m-d H:i:s', time()) . CR; 
     454        $header .= ' * ----------------------------------------------------------------------------------------------' . CR; 
     455        $header .= ' * Framework:    ' . $coreInfo['framework'] . CR; 
     456        $header .= ' * Description:  ' . $coreInfo['description'] . CR; 
     457        $header .= ' * Author:       ' . $coreInfo['author'] . CR; 
     458        $header .= ' * Version:      ' . $coreInfo['version'] . CR; 
     459        $header .= ' * Version-Date: ' . $coreInfo['date'] . CR; 
     460        $header .= ' * ----------------------------------------------------------------------------------------------' . CR; 
     461        $header .= ' * @generated' . CR; 
     462        $header .= ' */' . CR; 
     463 
     464        return $header; 
     465    } 
     466 
     467    /** 
     468     * Returns the header text for the theme css file. 
     469     * 
     470     * @param array $themeInfo Array with version information about the theme. 
     471     * @return string Header text for the theme css file. 
     472     */ 
    444473    protected function getThemeCompactHeader($themeInfo = '') 
    445474    { 
    446         $theme_compact  = ''; 
    447         $theme_compact  = '/**' . CR; 
    448         $theme_compact .= ' * This file has been auto-generated by the Clansuite CSS Framework.' . CR; 
    449         $theme_compact .= ' * Its a compilation of several css files. Do not edit manually. Use CssBuilder!' . CR; 
    450         $theme_compact .= ' * Last Update:  ' . date('Y-m-d H:i:s', time()) . CR; 
    451         $theme_compact .= ' * ---------------------------------------------------------------------------------------------' . CR; 
    452         $theme_compact .= ' * Framework:    ' . $themeInfo['framework'] . CR; 
    453         $theme_compact .= ' * Description:  ' . $themeInfo['description'] . CR; 
    454         $theme_compact .= ' * Author:       ' . $themeInfo['author'] . CR; 
    455         $theme_compact .= ' * Version:      ' . $themeInfo['version'] . CR; 
    456         $theme_compact .= ' * Version-Date: ' . $themeInfo['date'] . CR; 
    457         $theme_compact .= ' * ---------------------------------------------------------------------------------------------' . CR; 
    458         $theme_compact .= ' */' . CR; 
    459  
    460         return $theme_compact; 
     475        $header  = ''; 
     476        $header  = '/**' . CR; 
     477        $header .= ' * This file has been auto-generated by the Clansuite CSS Framework.' . CR; 
     478        $header .= ' * Its a compilation of several css files. Do not edit manually. Use CssBuilder!' . CR; 
     479        $header .= ' * Last Update:  ' . date('Y-m-d H:i:s', time()) . CR; 
     480        $header .= ' * ---------------------------------------------------------------------------------------------' . CR; 
     481        $header .= ' * Framework:    ' . $themeInfo['framework'] . CR; 
     482        $header .= ' * Description:  ' . $themeInfo['description'] . CR; 
     483        $header .= ' * Author:       ' . $themeInfo['author'] . CR; 
     484        $header .= ' * Version:      ' . $themeInfo['version'] . CR; 
     485        $header .= ' * Version-Date: ' . $themeInfo['date'] . CR; 
     486        $header .= ' * ---------------------------------------------------------------------------------------------' . CR; 
     487        $header .= ' * @generated' . CR; 
     488        $header .= ' */' . CR; 
     489 
     490        return $header; 
    461491    } 
    462492 
     
    565595                    '$1$2$3', $contents 
    566596            ); 
     597             
    567598            // End the file with a new line. 
    568             $contents = trim($contents); 
    569             $contents .= CR; 
     599            $contents = trim($contents) . CR; 
    570600        } 
    571601 
Note: See TracChangeset for help on using the changeset viewer.