Changeset 2314

Show
Ignore:
Timestamp:
12/18/10 21:03:07 (17 months ago)
Author:
petsagouris
Message:

[Branch 1.5] Code care on functions directory files.

Location:
branches/1.5/functions
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/1.5/functions/funcs.arrays.php

    r2270 r2314  
    218218        return $ret; 
    219219} 
    220  
    221 ?> 
  • branches/1.5/functions/funcs.files.php

    r2115 r2314  
    3636{ 
    3737        $filenames = array(); 
    38         $directory = new DirectoryIterator($folder); 
    39         foreach( $directory as $file ) { 
     38        foreach( new DirectoryIterator($folder) as $file ) { 
    4039                if( !$file->isDot() && ($file->getFilename() != '.svn') ) { 
    41                         $filename = ($type === 'full') ? $folder.($file->getFilename()) : $file->getFilename(); 
    42                         array_push($filenames, $file->getFilename()); 
     40                        $filenames[] = (($type === 'full') ? $folder : '').$file->getFilename(); 
    4341                } 
    4442        } 
     
    5654{ 
    5755        $stripped = array(); 
    58  
    5956        foreach( $fileNames as $fileName ) { 
    60                 array_push($stripped, stripFileExtension($fileName)); 
     57                $stripped[] = stripFileExtension($fileName); 
    6158        } 
    6259        return $stripped; 
     
    8582{ 
    8683        if( is_numeric($filesize) ) { 
    87                 $decr = 1024; 
    8884                $step = 0; 
    8985                $prefix = array('Byte', 'KB', 'MB', 'GB', 'TB', 'PB'); 
    9086 
    91                 while( ($filesize / $decr) > 0.9 ) { 
    92                         $filesize = $filesize / $decr; 
     87                while( ($filesize / 1024) > 0.9 ) { 
     88                        $filesize = $filesize / 1024; 
    9389                        $step++; 
    9490                } 
     
    9692                return round($filesize, 2).' '.$prefix[$step]; 
    9793        } 
    98         return 'Error displaying filesize'; 
     94        trigger_error('Error displaying filesize', E_USER_NOTICE); 
    9995} 
    10096 
     
    118114        return $h; 
    119115} 
    120 ?> 
  • branches/1.5/functions/funcs.strings.php

    r2253 r2314  
    169169        //From Wordpress and http://www.bernzilla.com/item.php?id=1007 
    170170        $output = sanitize_title_with_dashes($output); 
    171         $output = urldecode($output); 
    172171 
    173172        if ($output) { 
  • branches/1.5/functions/funcs.times.php

    r2101 r2314  
    3939        $timestart = microtime(TRUE); 
    4040        return TRUE; 
    41  
    4241} 
    4342 
     
    143142{ 
    144143        $block = ($block * 60) * 60; // change into seconds 
    145         $time_now = time(); 
    146         $start_of_current_block = floor($time_now / $block); 
     144        $start_of_current_block = floor(time() / $block); 
    147145        $start_of_current_block *= $block; 
    148146 
     
    152150 
    153151} 
    154 ?>