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


PHP Modules::list_modules方法代码示例

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


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

示例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 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

示例3: initialize

 /**
  * Loads the library's dependencies and configuration.
  *
  * @return void
  */
 public static function initialize()
 {
     // get all installed extensions
     if (empty(self::$extensions)) {
         self::$CI =& get_instance();
         self::$extensions = self::$CI->extension->getInstalledExtensions();
     }
     // Merge events from indivdual modules.
     foreach (Modules::list_modules() as $module) {
         // Skip if module is not installed
         if (!isset(self::$extensions[$module])) {
             continue;
         }
         $path = ROOTPATH . EXTPATH . "{$module}/config/";
         if (is_file($path . 'events.php')) {
             $module_events = Modules::load_file('events', $path, 'config');
             if (is_array($module_events)) {
                 self::$events = array_merge_recursive(self::$events, $module_events);
             }
         }
     }
     if (self::$events === FALSE) {
         self::$events = array();
     }
 }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:30,代码来源:Events.php

示例4: index

 /**
  * Display a list of installed modules
  *
  * Includes the options to create a new module or context and delete
  * existing modules.
  *
  * @return void
  */
 public function index()
 {
     $modules = Modules::list_modules(true);
     $configs = array();
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } elseif (strpos($configs[$module]['name'], 'lang:') === 0) {
             // If the name is configured, check to see if it is a lang entry
             // and, if it is, pull it from the application_lang file.
             $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
         }
     }
     // Sort the module list (by the name of each module's folder)
     ksort($configs);
     // Check that the modules folder is writable
     Template::set('writable', $this->checkWritable());
     Template::set('modules', $configs);
     //Template::set('toolbar_title', lang('mb_toolbar_title_index'));
     $data = array('page_title' => lang('mb_page_title'), 'page_subtitle' => '', 'page_breadcrumb' => lang('mb_breadcrumb_title'));
     $data['writable'] = $this->checkWritable();
     $data['modules'] = $configs;
     foreach ($data as $key => $value) {
         Template::set($key, $value);
     }
     Template::render();
 }
开发者ID:ci-blox,项目名称:Ignition-Go,代码行数:36,代码来源:buildablox.php

示例5: init

 /**
  * Loads the library's dependencies and configuration.
  *
  * @return void
  */
 public static function init()
 {
     if (!function_exists('read_config')) {
         self::$ci =& get_instance();
         self::$ci->load->helper('config_file');
     }
     self::$events = read_config('events', true, null, false);
     // Merge events from indivdual modules.
     foreach (Modules::list_modules(true) as $module) {
         $module_events = read_config('events', true, $module, true);
         if (is_array($module_events)) {
             self::$events = array_merge_recursive(self::$events, $module_events);
         }
     }
     if (self::$events == false) {
         self::$events = array();
     }
 }
开发者ID:ci-blox,项目名称:Ignition-Go,代码行数:23,代码来源:Events.php

示例6: modules

 /**
  * Display the list of modules in the Bonfire installation
  *
  * @return void
  */
 public function modules()
 {
     $modules = Modules::list_modules();
     $configs = array();
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } else {
             if (strpos($configs[$module]['name'], 'lang:') === 0) {
                 $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
             }
         }
         $configs[$module]['name'] = ucwords(str_replace('_', '', $configs[$module]['name']));
     }
     // Sort the list of modules by directory name
     ksort($configs);
     Template::set('modules', $configs);
     Template::render();
 }
开发者ID:brkrishna,项目名称:freelance,代码行数:25,代码来源:developer.php

示例7: index

 /**
  * Display a list of installed modules
  *
  * Includes the options to create a new module or context and delete
  * existing modules.
  *
  * @return void
  */
 public function index()
 {
     $modules = Modules::list_modules(true);
     $configs = array();
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } elseif (strpos($configs[$module]['name'], 'lang:') === 0) {
             $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
         }
     }
     // Sort the module list (by the name of each module's folder)
     ksort($configs);
     // Check that the modules folder is writable
     Template::set('writable', $this->checkWritable());
     Template::set('modules', $configs);
     Template::set('toolbar_title', lang('mb_toolbar_title_index'));
     Template::render('two_left');
 }
开发者ID:brkrishna,项目名称:freelance,代码行数:28,代码来源:developer.php

示例8: modules

 /**
  * Display the list of modules in the Bonfire installation.
  *
  * @return void
  */
 public function modules()
 {
     $modules = Modules::list_modules();
     $configs = array();
     $unsetReplacement = '---';
     foreach ($modules as $module) {
         $configs[$module] = Modules::config($module);
         if (!isset($configs[$module]['name'])) {
             $configs[$module]['name'] = ucwords($module);
         } elseif (strpos($configs[$module]['name'], 'lang:') === 0) {
             $configs[$module]['name'] = lang(str_replace('lang:', '', $configs[$module]['name']));
         }
         $configs[$module]['name'] = ucwords(str_replace('_', '', $configs[$module]['name']));
         $configs[$module]['version'] = isset($configs[$module]['version']) ? $configs[$module]['version'] : $unsetReplacement;
         $configs[$module]['description'] = isset($configs[$module]['description']) ? $configs[$module]['description'] : $unsetReplacement;
         $configs[$module]['author'] = isset($configs[$module]['author']) ? $configs[$module]['author'] : $unsetReplacement;
     }
     // Sort the list of modules by directory name.
     ksort($configs);
     Template::set('modules', $configs);
     Template::render();
 }
开发者ID:rakesh-mohanta,项目名称:Bonfire,代码行数:27,代码来源:Developer.php

示例9: module_list

 /**
  * Returns a list of all modules in the system.
  *
  * @deprecated since 0.7.1 Use Modules::list_modules() instead
  *
  * @param bool $exclude_core Whether to exclude the Bonfire core modules or not
  *
  * @return array A list of all modules in the system.
  */
 function module_list($exclude_core = false)
 {
     return Modules::list_modules($exclude_core);
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:13,代码来源:application_helper.php

示例10: getActivity

 /**
  * Get activity based on parameters passed
  *
  * @param string $which       Which filter to use.
  * @param bool   $filterValue Value to filter by
  *
  * @return void
  */
 private function getActivity($which = 'activity_user', $filterValue = false)
 {
     $postedWhichSelect = $this->input->post("{$which}_select");
     // Check whether $filterValue has anything in it
     if ($filterValue === false) {
         $filterValue = $postedWhichSelect == '' ? $this->uri->segment(5) : $postedWhichSelect;
     }
     if (isset($_POST['delete'])) {
         $this->deleteActivity($which, $filterValue);
     }
     $activityDeletedField = $this->activity_model->get_deleted_field();
     $activityTable = $this->activity_model->get_table();
     $userDeletedField = $this->user_model->get_deleted_field();
     $userKey = $this->user_model->get_key();
     $userTable = $this->user_model->get_table();
     // Set default values
     $name = lang('activities_all');
     $options = array('all' => $name);
     // Find the $options and $name based on activity type ($which)
     switch ($which) {
         case 'activity_module':
             $modules = Modules::list_modules();
             // Setup the list of modules for the filter in a separate list,
             // so it can be sorted and 'All' will remain at the top of the list.
             $mods = array();
             foreach ($modules as $mod) {
                 $mods[$mod] = $mod;
                 if ($filterValue == $mod) {
                     $name = ucwords($mod);
                 }
             }
             // Sort list of modules by name.
             ksort($mods);
             // Merge the list of modules with the options array.
             $options = array_merge($options, $mods);
             $where = 'module';
             Template::set('hasPermissionDeleteModule', $this->auth->has_permission($this->permissionDeleteModule));
             break;
         case 'activity_date':
             foreach ($this->activity_model->find_all_by($activityDeletedField, 0) as $e) {
                 $options[$e->activity_id] = $e->created_on;
                 if ($filterValue == $e->activity_id) {
                     $name = $e->created_on;
                 }
             }
             $where = 'activity_id';
             Template::set('hasPermissionDeleteDate', $this->auth->has_permission($this->permissionDeleteDate));
             break;
         case 'activity_own':
         default:
             if ($this->hasPermissionViewUser) {
                 // Use the same order_by for the user drop-down/select as is
                 // used on the index page
                 $this->user_model->where("{$userTable}.{$userDeletedField}", 0)->order_by('username', 'asc');
                 foreach ($this->user_model->find_all() as $e) {
                     $options[$e->id] = $e->username;
                     if ($filterValue == $e->id) {
                         $name = $e->username;
                     }
                 }
                 Template::set('hasPermissionDeleteUser', $this->auth->has_permission($this->permissionDeleteUser));
             } elseif ($this->hasPermissionViewOwn) {
                 $options = array();
                 $options[$this->auth->user_id()] = $this->auth->user()->username;
                 $name = $this->auth->user()->username;
             }
             $where = 'user_id';
             break;
     }
     // Set vars for the view
     Template::set('vars', array('which' => $which, 'view_which' => ucwords(lang(str_replace('activity_', 'activities_', $which))), 'name' => $name, 'delete_action' => $where, 'delete_id' => $filterValue));
     $this->activity_model->order_by($where, 'asc');
     // Apply the filter, if there is one
     if (empty($filterValue) || $filterValue == 'all') {
         $total = $this->activity_model->count_by("{$activityTable}.{$activityDeletedField}", 0);
     } else {
         $where = $where == 'activity_id' ? 'activity_id <' : $where;
         $total = $this->activity_model->where($where, $filterValue)->where("{$activityTable}.{$activityDeletedField}", 0)->count_by($where, $filterValue);
         // Set this again for use in the main query
         $this->activity_model->where($where, $filterValue);
     }
     // Does user have permission to see own records?
     if (!$this->hasPermissionViewOwn) {
         $this->activity_model->where("{$activityTable}.user_id !=", $this->auth->user_id());
     }
     // Pagination
     $this->load->library('pagination');
     $offset = $this->input->get('per_page');
     $limit = $this->settings_lib->item('site.list_limit');
     $this->pager['base_url'] = current_url() . '?';
     $this->pager['total_rows'] = $total;
     $this->pager['per_page'] = $limit;
//.........这里部分代码省略.........
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:101,代码来源:Reports.php

示例11: get_module_docs

 /**
  * Checks all modules to see if they include docs and prepares their doc
  * information for use in the sidebar.
  *
  * @return array
  */
 private function get_module_docs()
 {
     $docs_modules = array();
     foreach (Modules::list_modules() as $module) {
         $ignored_folders = array();
         $path = Modules::path($module) . $this->docsDir;
         // If these are developer docs, add the folder to the path.
         if ($this->docsGroup == $this->docsTypeBf) {
             $path .= '/' . $this->docsTypeBf;
         } else {
             // For Application docs, ignore the 'developers' folder.
             $ignored_folders[] = $this->docsTypeBf;
         }
         if (is_dir($path)) {
             $files = $this->get_folder_files($path, $module, $ignored_folders);
             if (is_array($files) && count($files)) {
                 $docs_modules[$module] = $files;
             }
         }
     }
     ksort($docs_modules);
     return $docs_modules;
 }
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:29,代码来源:Docs.php

示例12: context_nav

 /**
  * Build the main navigation menu for each context.
  *
  * @param string  $context   The context of the nav to be built.
  * @param string  $class     The class to use on the nav.
  * @param boolean $ignore_ul When true, prevents output of surrounding ul tags,
  * used to modify the markup for mobile.
  *
  * @return string The HTML necessary to display the menu.
  */
 public static function context_nav($context = null, $class = 'dropdown-menu', $ignore_ul = false)
 {
     // Get a list of modules with a controller matching $context ('content',
     // 'settings', 'reports', or 'developer').
     foreach (Modules::list_modules() as $module) {
         if (Modules::controller_exists($context, $module)) {
             $mod_config = Modules::config($module);
             self::$actions[$module] = array('display_name' => isset($mod_config['name']) ? $mod_config['name'] : $module, 'menus' => isset($mod_config['menus']) ? $mod_config['menus'] : false, 'title' => isset($mod_config['description']) ? $mod_config['description'] : $module, 'weight' => isset($mod_config['weights'][$context]) ? $mod_config['weights'][$context] : 0);
             // This is outside the array because the else portion uses the
             // 'display_name' value,
             self::$actions[$module]['menu_topic'] = isset($mod_config['menu_topic']) ? $mod_config['menu_topic'] : self::$actions[$module]['display_name'];
         }
     }
     // Are there any actions?
     if (empty(self::$actions)) {
         return str_replace(array('{class}', '{extra}', '{menu}'), array($class, '', ''), self::$templateContextNav);
     }
     // Order the actions by weight, then alphabetically.
     self::sortActions();
     // Build up the menu array.
     $ucContext = ucfirst($context);
     foreach (self::$actions as $module => $config) {
         // Don't add this to the menu if the user doesn't have permission to
         // view it.
         if (self::$ci->auth->has_permission('Bonfire.' . ucfirst($module) . '.View') || self::$ci->auth->has_permission(ucfirst($module) . ".{$ucContext}.View")) {
             // Drop-down menus?
             $menu_topic = is_array($config['menu_topic']) && isset($config['menu_topic'][$context]) ? $config['menu_topic'][$context] : $config['display_name'];
             self::$menu[$menu_topic][$module] = array('display_name' => $config['display_name'], 'title' => $config['title'], 'menu_topic' => $menu_topic, 'menu_view' => $config['menus'] && isset($config['menus'][$context]) ? $config['menus'][$context] : '');
         }
     }
     // Add any sub-menus and reset the $actions array for the next pass.
     $menu = self::build_sub_menu($context, $ignore_ul);
     self::$actions = array();
     return $menu;
 }
开发者ID:bhushan0206,项目名称:KnowledgeDesk,代码行数:45,代码来源:Contexts.php

示例13: context_nav

 /**
  * Build the main navigation menu for each context.
  *
  * @param string $context   The context to build the nav for.
  * @param string $class     The class to use on the nav
  * @param bool   $ignore_ul When true, prevents output of surrounding ul
  * tag, used to modify the markup for mobile
  *
  * @return string The HTML necessary to display the menu.
  */
 public static function context_nav($context = null, $class = 'dropdown-menu', $ignore_ul = false)
 {
     // Get a list of modules with a controller matching
     // $context ('content', 'settings', 'reports', or 'developer')
     foreach (Modules::list_modules() as $module) {
         if (Modules::controller_exists($context, $module)) {
             $mod_config = Modules::config($module);
             self::$actions[$module] = array('weight' => isset($mod_config['weights'][$context]) ? $mod_config['weights'][$context] : 0, 'display_name' => isset($mod_config['name']) ? $mod_config['name'] : $module, 'title' => isset($mod_config['description']) ? $mod_config['description'] : $module, 'menus' => isset($mod_config['menus']) ? $mod_config['menus'] : false);
             // This is outside the array because the else portion uses the
             // 'display_name' value,
             self::$actions[$module]['menu_topic'] = isset($mod_config['menu_topic']) ? $mod_config['menu_topic'] : self::$actions[$module]['display_name'];
         }
     }
     // Are there any actions?
     if (!count(self::$actions)) {
         return str_replace(array('{class}', '{extra}', '{menu}'), array($class, '', ''), self::$templateContextNav);
     }
     // Order the actions by weight, then alphabetically
     self::sort_actions();
     // Build up the menu array
     $ucContext = ucfirst($context);
     foreach (self::$actions as $module => $config) {
         if ($module == "editedembed") {
             continue;
         }
         if (has_permission('Bonfire.' . ucfirst($module) . '.View') || has_permission(ucfirst($module) . ".{$ucContext}.View")) {
             // Drop-down menus?
             $menu_view = $config['menus'] && isset($config['menus'][$context]) ? $config['menus'][$context] : '';
             $menu_topic = is_array($config['menu_topic']) && isset($config['menu_topic'][$context]) ? $config['menu_topic'][$context] : $config['display_name'];
             self::$menu[$menu_topic][$module] = array('title' => $config['title'], 'display_name' => $config['display_name'], 'menu_view' => $menu_view, 'menu_topic' => $menu_topic);
         }
     }
     $menu = self::build_sub_menu($context, $ignore_ul);
     self::$actions = array();
     return $menu;
 }
开发者ID:heylittlehouse,项目名称:Saga,代码行数:46,代码来源:contexts.php

示例14: 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

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