/** * Clear all I18n module cache. * * @static * @access public * @return boolean Returns information whether the language cache has been cleared. * @since 1.0.5-dev * @version 1.2.0-dev */ public static function clearCache() { static::$cachedData = NULL; $output = Cache::clearGroupCache('i18n'); return $output; }
/** * empty out the cache completely * * this is mostly provided for unit testing purposes * * @return void */ protected static function resetCache() { static::$cachedData = []; }
public static function data($pathKey = NULL, $pathDefault = NULL, $order = NULL, $forced = FALSE) { $order = Helpers_Text::trimAsNULL(NULL === $order ? $order = static::config('request.data.order') : $order); $data = []; if (NULL !== $order) { isset(static::$cachedData) or static::$cachedData = []; if ($forced || !isset(static::$cachedData[$order])) { for ($idx = 0; $idx < strlen($order); $idx++) { switch (strtoupper($order[$idx])) { case 'G': $data = Kohana_Helpers_Arr::merge($data, static::current()->query()); break; case 'P': $data = Kohana_Helpers_Arr::merge($data, static::getBodyData()); break; case 'H': $data = Kohana_Helpers_Arr::merge($data, static::current()->headers()); break; } } static::$cachedData[$order] = $data; } } if (is_array($pathKey)) { $result = []; foreach ($pathKey as $key) { $result[$key] = Kohana_Helpers_Arr::path($data, $pathKey, $pathDefault); } } elseif (is_scalar($pathKey)) { $result = Kohana_Helpers_Arr::path($data, $pathKey, $pathDefault); } else { $result = $data; } return $result; }