Changeset 2598

Show
Ignore:
Timestamp:
04/28/08 15:41:39 (4 months ago)
Author:
Geert
Message:

Fixing accidental overwrite in r2593

Location:
trunk/system
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/helpers/arr.php

    r2593 r2598  
    1313 
    1414    /** 
     15     * Return a callback array from a string, eg: limit[10,20] would become 
     16     * array('limit', array('10', '20')) 
     17     * 
     18     * @param   string  callback string 
     19     * @return  array 
     20     */ 
     21    public function callback_string($str) 
     22    { 
     23        // command[param,param] 
     24        if (preg_match('/([^\[]*+)\[(.+)\]/', (string) $str, $match)) 
     25        { 
     26            // command 
     27            $command = $match[1]; 
     28 
     29            // param,param 
     30            $params = preg_split('/(?<!\\\\),/', $match[2]); 
     31            $params = str_replace('\,', ',', $params); 
     32        } 
     33        else 
     34        { 
     35            // command 
     36            $command = $str; 
     37 
     38            // No params 
     39            $params = NULL; 
     40        } 
     41 
     42        return array($command, $params); 
     43    } 
     44 
     45    /** 
    1546     * Rotates a 2D array clockwise. 
    1647     * Example, turns a 2x3 array into a 3x2 array. 
     
    5283 
    5384        return $val; 
     85    } 
     86 
     87     
     88    /** 
     89     * Extract one or more keys from an array. Each key given after the first 
     90     * argument (the array) will be extracted. Keys that do not exist in the 
     91     * search array will be NULL in the extracted data. 
     92     * 
     93     * @param   array   array to search 
     94     * @param   string  key name 
     95     * @return  array 
     96     */ 
     97    public function extract(array $search, $keys) 
     98    { 
     99        // Get the keys, removing the $search array 
     100        $keys = array_slice(func_get_args(), 1); 
     101 
     102        $found = array(); 
     103        foreach ($keys as $key) 
     104        { 
     105            if (isset($search[$key])) 
     106            { 
     107                $found[$key] = $search[$key]; 
     108            } 
     109            else 
     110            { 
     111                $found[$key] = NULL; 
     112            } 
     113        } 
     114 
     115        return $found; 
    54116    } 
    55117 
  • trunk/system/libraries/Calendar_Event.php

    r2347 r2598  
    253253        // Reduce the timestamp by one week for each loop. This has the added 
    254254        // benefit of preventing an infinite loop. 
    255         while($timestamp -= 604800) 
     255        while ($timestamp -= 604800) 
    256256        { 
    257257            if (date('m', $timestamp) !== $month) 
  • trunk/system/libraries/Router.php

    r2593 r2598  
    108108                    if (is_file($path.$search.'/'.$segment.EXT)) 
    109109                    { 
    110                         self::$directory  = $path.$search.'/'; 
     110                        self::$directory       = $path.$search.'/'; 
    111111                        self::$controller_path = $controller_path; 
    112                         self::$controller = $segment; 
    113                         self::$method     = isset(self::$rsegments[$key + 1]) ? self::$rsegments[$key + 1] : 'index'; 
    114                         self::$arguments  = isset(self::$rsegments[$key + 2]) ? array_slice(self::$rsegments, $key + 2) : array(); 
     112                        self::$controller      = $segment; 
     113                        self::$method          = isset(self::$rsegments[$key + 1]) ? self::$rsegments[$key + 1] : 'index'; 
     114                        self::$arguments       = isset(self::$rsegments[$key + 2]) ? array_slice(self::$rsegments, $key + 2) : array(); 
    115115 
    116116                        // Stop searching, two levels 
  • trunk/system/libraries/drivers/Cache/Sqlite.php

    r2430 r2598  
    137137        { 
    138138            $array = array(); 
    139             while($row = $query->fetchObject()) 
     139            while ($row = $query->fetchObject()) 
    140140            { 
    141141                // Add each id to the array