/** * Set the cache handler * @param array $options */ private function set_cache(array $options) { // set the cache instance $this->cache = Cache::get_instance('default', $options); }
/** * Retrieves and parse the language strings from the l10n string files * Sets the strings on cache * @param string $controller * @param string $method * @param array $strings_paths * @return array */ private static function get_strings($controller, $method, array $strings_paths) { $global_strings = []; $controller_strings = []; $method_strings = []; foreach ($strings_paths as $strings_path) { // get the strings data $strings_data = parse_ini_file($strings_path, true); if ($strings_data) { // set the global, controller and method strings $global_strings = array_merge($global_strings, self::get_section_strings($strings_data, 'global')); $controller_strings = array_merge($controller_strings, self::get_section_strings($strings_data, $controller)); $method_strings = array_merge($method_strings, self::get_section_strings($strings_data, $controller . '-' . $method)); } } // merge the strings content $strings = array_merge($global_strings, $controller_strings, $method_strings); // set the strings in cache Cache::get_instance()->set(self::$cache_key, $strings); return $strings; }