当前位置: 首页>>代码示例>>PHP>>正文


PHP Modules::files方法代码示例

本文整理汇总了PHP中Modules::files方法的典型用法代码示例。如果您正苦于以下问题:PHP Modules::files方法的具体用法?PHP Modules::files怎么用?PHP Modules::files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modules的用法示例。


在下文中一共展示了Modules::files方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: list_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 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;
 }
开发者ID:brkrishna,项目名称:freelance,代码行数:38,代码来源:languages_helper.php

示例2: list_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;
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:38,代码来源:languages_helper.php

示例3: get_module_versions

 /**
  * Get all versions available for the modules
  *
  * @return array Array of available versions for each module
  */
 private function get_module_versions()
 {
     $modules = Modules::files(null, 'migrations');
     if ($modules === false) {
         return false;
     }
     // Sort modules by key (module directory name)
     ksort($modules);
     // Get the installed version of all of the modules (modules which have
     // not been installed will not be included)
     $installedVersions = $this->migrations->getModuleVersions();
     $modVersions = array();
     // Add the migration data for each module
     foreach ($modules as $module => &$mod) {
         if (!array_key_exists('migrations', $mod)) {
             continue;
         }
         // Sort module migrations in reverse order
         arsort($mod['migrations']);
         /**
          * @internal Calculating the latest version from the migration list
          * saves ~20% of the load time when a lot of modules (tested with >
          * 50) are listed. However, it requires the controller to know more
          * about the format of the migration filenames than may be desirable.
          * If that is the case, the 'latest_version' key below can be
          * populated with the result of:
          * $this->migrations->getVersion("{$module}_", true)
          */
         // Add the installed version, latest version, and list of migrations
         $modVersions[$module] = array('installed_version' => isset($installedVersions["{$module}_"]) ? $installedVersions["{$module}_"] : 0, 'latest_version' => intval(substr(current($mod['migrations']), 0, 3), 10), 'migrations' => $mod['migrations']);
     }
     return $modVersions;
 }
开发者ID:brkrishna,项目名称:freelance,代码行数:38,代码来源:developer.php

示例4: get_module_versions

 /**
  * Get the versions of the modules.
  *
  * @return array The installed/latest versions of each module.
  */
 private function get_module_versions()
 {
     $modules = Modules::files(null, 'migrations');
     if ($modules === false) {
         return false;
     }
     // Sort modules by key (module directory name)
     ksort($modules);
     // Get the installed version of all of the modules (modules which have
     // not been installed will not be included)
     $installedVersions = $this->ci->migrations->getModuleVersions();
     $modVersions = array();
     // Add the migration data for each module
     foreach ($modules as $module => &$mod) {
         if (!array_key_exists('migrations', $mod)) {
             continue;
         }
         // Sort module migrations in reverse order
         arsort($mod['migrations']);
         // Add the installed version, latest version, and list of migrations
         $modVersions[$module] = array('installed_version' => isset($installedVersions["{$module}_"]) ? $installedVersions["{$module}_"] : 0, 'latest_version' => intval(substr(current($mod['migrations']), 0, 3), 10), 'migrations' => $mod['migrations']);
     }
     return $modVersions;
 }
开发者ID:rakesh-mohanta,项目名称:Bonfire,代码行数:29,代码来源:Installer_lib.php

示例5: module_files

 /**
  * Returns an associative array of files within one or more modules.
  *
  * @deprecated since 0.7.1 Use Modules::files() instead.
  *
  * @param $module_name string If not NULL, will return only files from that module.
  * @param $module_folder string If not NULL, will return only files within that folder of each module (ie 'views')
  * @param $exclude_core boolean Whether we should ignore all core modules.
  *
  * @return array An associative array, like: array('module_name' => array('folder' => array('file1', 'file2')))
  */
 function module_files($module_name = null, $module_folder = null, $exclude_core = false)
 {
     return Modules::files($module_name, $module_folder, $exclude_core);
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:15,代码来源:application_helper.php

示例6: delete_language

 /**
  * Delete existing language folder.
  *
  * @param string $language The language to delete.
  *
  * @return bool
  */
 function delete_language($language = NULL)
 {
     if (empty($language)) {
         return FALSE;
     }
     if (!function_exists('delete_files')) {
         get_instance()->load->helper('file');
     }
     // Delete the specified admin and main language folder.
     foreach (array(MAINDIR, ADMINDIR) as $domain) {
         $path = ROOTPATH . "{$domain}/language/{$language}";
         if (is_dir($path)) {
             delete_files($path, TRUE);
             rmdir($path);
         }
     }
     // Clone then specified module language files.
     $modules = Modules::list_modules();
     foreach ($modules as $module) {
         $moduleLangs = Modules::files($module, 'language');
         if (isset($moduleLangs[$module]['language'][$language])) {
             $path = Modules::path($module, 'language');
             delete_files("{$path}/{$language}", TRUE);
             rmdir("{$path}/{$language}");
         }
     }
     return FALSE;
 }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:35,代码来源:TI_language_helper.php

示例7: clone_language

 /**
  * Clone a single existing language.
  *
  * @param string $filename The name for the newly cloned language.
  * @param string $language The language to clone.
  *
  * @return mixed The $lang array from the file or false if not found. Returns
  * null if $filename is empty.
  */
 function clone_language($filename = NULL, $language = 'english')
 {
     if (empty($filename)) {
         return FALSE;
     }
     // Clone the specified admin and main language files.
     foreach (array(MAINDIR, ADMINDIR) as $domain) {
         copy_language_files(ROOTPATH . "{$domain}/language/{$language}", ROOTPATH . "{$domain}/language/{$filename}");
     }
     // Clone then specified module language files.
     $modules = Modules::list_modules();
     foreach ($modules as $module) {
         $moduleLangs = Modules::files($module, 'language');
         if (isset($moduleLangs[$module]['language'][$language])) {
             $path = Modules::path($module, 'language');
             copy_language_files("{$path}/{$language}", "{$path}/{$filename}");
         }
     }
     return TRUE;
 }
开发者ID:allrested,项目名称:TastyIgniter,代码行数:29,代码来源:TI_language_helper.php


注:本文中的Modules::files方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。