Changeset 2623
- Timestamp:
- 05/05/2008 10:32:08 AM (7 months ago)
- Files:
-
- 1 modified
-
trunk/system/core/Kohana.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/core/Kohana.php
r2621 r2623 820 820 821 821 // Get the line from the language 822 $line = self::key_string($ key, $language);822 $line = self::key_string($language, $key); 823 823 824 824 // Return the key string as fallback … … 876 876 877 877 // Get the line from the language 878 $line = self::key_string($ key, $locale);878 $line = self::key_string($locale, $key); 879 879 880 880 // Return the key string as fallback … … 896 896 * @return void if the key is not found 897 897 */ 898 public static function key_string($ keys, $array)898 public static function key_string($array, $keys) 899 899 { 900 900 // No array to search … … 954 954 public static function key_string_set( & $array, $keys, $fill = NULL) 955 955 { 956 // This must always be an array 957 $array = (array) $array; 956 if (is_object($array) AND ($array instanceof ArrayObject)) 957 { 958 // Copy the array 959 $array_copy = $array->getArrayCopy(); 960 961 // Is an object 962 $array_object = TRUE; 963 } 964 else 965 { 966 if ( ! is_array($array)) 967 { 968 // Must always be an array 969 $array = (array) $array; 970 } 971 972 // Copy is a reference to the array 973 $array_copy =& $array; 974 } 958 975 959 976 if (empty($keys)) … … 964 981 965 982 // Create reference to the array 966 $row =& $array ;983 $row =& $array_copy; 967 984 968 985 for ($i = 0, $end = count($keys) - 1; $i <= $end; $i++) … … 971 988 $key = $keys[$i]; 972 989 973 if ( ! isset($ array[$key]))990 if ( ! isset($row[$key])) 974 991 { 975 992 if (isset($keys[$i + 1])) … … 992 1009 // Go down a level, creating a new row reference 993 1010 $row =& $row[$key]; 1011 } 1012 1013 if (isset($array_object)) 1014 { 1015 // Swap the array back in 1016 $array->exchangeArray($array_copy); 994 1017 } 995 1018 }
