Changeset 2598
- Timestamp:
- 04/28/08 15:41:39 (4 months ago)
- Location:
- trunk/system
- Files:
-
- 4 modified
-
helpers/arr.php (modified) (2 diffs)
-
libraries/Calendar_Event.php (modified) (1 diff)
-
libraries/Router.php (modified) (1 diff)
-
libraries/drivers/Cache/Sqlite.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/helpers/arr.php
r2593 r2598 13 13 14 14 /** 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 /** 15 46 * Rotates a 2D array clockwise. 16 47 * Example, turns a 2x3 array into a 3x2 array. … … 52 83 53 84 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; 54 116 } 55 117 -
trunk/system/libraries/Calendar_Event.php
r2347 r2598 253 253 // Reduce the timestamp by one week for each loop. This has the added 254 254 // benefit of preventing an infinite loop. 255 while ($timestamp -= 604800)255 while ($timestamp -= 604800) 256 256 { 257 257 if (date('m', $timestamp) !== $month) -
trunk/system/libraries/Router.php
r2593 r2598 108 108 if (is_file($path.$search.'/'.$segment.EXT)) 109 109 { 110 self::$directory = $path.$search.'/';110 self::$directory = $path.$search.'/'; 111 111 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(); 115 115 116 116 // Stop searching, two levels -
trunk/system/libraries/drivers/Cache/Sqlite.php
r2430 r2598 137 137 { 138 138 $array = array(); 139 while ($row = $query->fetchObject())139 while ($row = $query->fetchObject()) 140 140 { 141 141 // Add each id to the array
