/**
  * Finds a list of all language files for a specific language by
  * searching the application/languages folder as well as all core_module
  * folders for folders matching the language name.
  *
  * @param string $language The language
  *
  * @return array An array of files.
  */
 function list_lang_files($language = 'english')
 {
     $ci =& get_instance();
     $ci->load->helper('file');
     $lang_files = array();
     // Base language files.
     $lang_files['core'] = find_lang_files(APPPATH . 'language/' . $language . '/');
     // Module lang files
     $modules = module_list();
     $custom_modules = module_list(TRUE);
     foreach ($modules as $module) {
         $module_langs = module_files($module, 'language');
         $type = 'core';
         if (isset($module_langs[$module]['language'][$language])) {
             $path = implode('/', array($module, 'language', $language));
             if (in_array($module, $custom_modules)) {
                 $files = find_lang_files(realpath(APPPATH . '../modules/' . $path) . '/');
                 $type = 'custom';
             } else {
                 $files = find_lang_files(APPPATH . 'core_modules/' . $path . '/');
             }
             foreach ($files as $file) {
                 $lang_files[$type][] = $file;
             }
         }
         //end if
     }
     //end foreach
     return $lang_files;
 }
 /**
  * List all language files for the specified language
  *
  * Searches both the admin and main application/languages folder as well as all extension modules
  * for folders matching the language name.
  *
  * @param string $language The language.
  *
  * @return array The filenames.
  */
 function list_lang_files($language = '')
 {
     if (empty($language)) {
         return NULL;
     }
     // Base language files.
     $langFiles = array();
     $langFiles['main'] = find_lang_files(ROOTPATH . MAINDIR . "/language/{$language}/");
     // Build the 'core' and 'custom' module lists.
     $modules = Modules::list_modules();
     foreach ($modules as $module) {
         $moduleLangs = Modules::files($module, 'language');
         if (isset($moduleLangs[$module]['language'][$language])) {
             $path = implode('/', array(Modules::path($module, 'language'), $language));
             $files = find_lang_files($path . '/');
             if (is_array($files)) {
                 foreach ($files as $file) {
                     $langFiles['module'][] = $file;
                 }
             }
         }
     }
     $langFiles['admin'] = find_lang_files(ROOTPATH . ADMINDIR . "/language/{$language}/");
     return $langFiles;
 }
示例#3
0
 /**
  * List all language files for the specified language
  *
  * Searches the application/languages folder as well as all core modules
  * for folders matching the language name.
  *
  * @param string $language The language
  *
  * @return array An array of files.
  */
 function list_lang_files($language = 'english')
 {
     $ci =& get_instance();
     $lang_files = array();
     // Base language files.
     $lang_files['core'] = find_lang_files(APPPATH . "language/{$language}/");
     // Module directories
     $modules = Modules::list_modules();
     // Application Module directories only
     $custom_modules = Modules::list_modules(true);
     foreach ($modules as $module) {
         $module_langs = Modules::files($module, 'language');
         $type = 'core';
         if (isset($module_langs[$module]['language'][$language])) {
             $path = implode('/', array(Modules::path($module, 'language'), $language));
             $files = find_lang_files($path . '/');
             if (in_array($module, $custom_modules)) {
                 $type = 'custom';
             }
             if (is_array($files)) {
                 foreach ($files as $file) {
                     $lang_files[$type][] = $file;
                 }
             }
         }
     }
     return $lang_files;
 }
 /**
  * List all language files for the specified language
  *
  * Searches the application/languages folder as well as all core modules
  * for folders matching the language name.
  *
  * @param string $language The language.
  *
  * @return array The filenames.
  */
 function list_lang_files($language = 'english')
 {
     // Base language files.
     $langFiles = array();
     $langFiles['core'] = find_lang_files(APPPATH . "language/{$language}/");
     // Build the 'core' and 'custom' module lists.
     $modules = Modules::list_modules();
     $appModules = Modules::list_modules(true);
     foreach ($modules as $module) {
         $moduleLangs = Modules::files($module, 'language');
         $type = 'core';
         if (isset($moduleLangs[$module]['language'][$language])) {
             $path = implode('/', array(Modules::path($module, 'language'), $language));
             $files = find_lang_files($path . '/');
             // 'core' modules will only be found in $modules, while 'custom'
             // modules will be found in both $modules and $appModules.
             if (in_array($module, $appModules)) {
                 $type = 'custom';
             }
             if (is_array($files)) {
                 foreach ($files as $file) {
                     $langFiles[$type][] = $file;
                 }
             }
         }
     }
     return $langFiles;
 }