Changeset 5963


Ignore:
Timestamp:
01/24/12 23:55:50 (4 months ago)
Author:
vain
Message:
  • fixed iterateDir() and added more parameters for better reuse
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/viewhelper/theme.core.php

    r5878 r5963  
    323323    { 
    324324        $themes = array(); 
    325          
     325 
    326326        $themes = array_merge( 
    327327            self::iterateDir(ROOT_THEMES_FRONTEND, 'frontend'), 
     
    332332    } 
    333333 
    334     protected static function iterateDir($dir, $type) 
     334    /** 
     335     * Iterates over a theme dir (backend / frontend) and fetches some data. 
     336     * 
     337     * @param string $dir ROOT_THEMES_FRONTEND, ROOT_THEMES_BACKEND 
     338     * @param string $type 'frontend' or 'backend' 
     339     * @param boolean $only_index_name 
     340     * @return string 
     341     */ 
     342    protected static function iterateDir($dir, $type, $only_index_name = true) 
    335343    { 
    336344        $dirs = ''; 
     
    347355                $i++; 
    348356 
    349                 # add fullpath 
    350                 $themes[$i]['path'] = $dir->getPathName(); 
    351  
    352                 # add dirname 
    353                 $themes[$i]['name'] = (string) $dir; 
    354  
    355                 # set frontend as type 
    356                 $themes[$i]['type']    = $type; 
     357                if($only_index_name === false) 
     358                { 
     359                    # add fullpath 
     360                    $themes[$i]['path'] = $dir->getPathName(); 
     361 
     362                    # set frontend as type 
     363                    $themes[$i]['type']    = $type; 
     364 
     365                    # add dirname 
     366                    $themes[$i]['name'] = $type . DS .  (string) $dir; 
     367                } 
     368                else 
     369                { 
     370                    # add dirname 
     371                    $themes[$i] = $type . DS . (string) $dir; 
     372                } 
     373 
     374 
    357375            } 
    358376        } 
Note: See TracChangeset for help on using the changeset viewer.