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


PHP ModuleManager::required_modules方法代码示例

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


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

示例1: simple_setup

 public function simple_setup()
 {
     Base_ActionBarCommon::add('settings', __('Advanced view'), $this->create_confirm_callback_href(__('Switch to advanced view?'), array($this, 'switch_simple'), false));
     $module_dirs = $this->get_module_dirs();
     $is_required = ModuleManager::required_modules(true);
     $structure = array();
     foreach ($module_dirs as $entry => $versions) {
         $installed = ModuleManager::is_installed($entry);
         $module_install_class = $entry . 'Install';
         $func_simple = array($module_install_class, 'simple_setup');
         if (is_callable($func_simple)) {
             $simple_module = call_user_func($func_simple);
         } else {
             $simple_module = false;
         }
         if ($simple_module === false) {
             continue;
         }
         if ($simple_module === true) {
             $simple_module = array('package' => __('Uncategorized'), 'option' => $entry);
         }
         if (is_string($simple_module)) {
             $simple_module = array('package' => $simple_module);
         }
         if (!isset($simple_module['option'])) {
             $simple_module['option'] = null;
         }
         $simple_module['module'] = $entry;
         $simple_module['installed'] = $installed >= 0;
         $simple_module['key'] = $simple_module['package'] . ($simple_module['option'] ? '|' . $simple_module['option'] : '');
         $structure[$entry] = $simple_module;
     }
     $packages = array();
     foreach ($structure as $s) {
         if (!isset($packages[$s['key']])) {
             $packages[$s['key']] = array('also_uninstall' => array(), 'modules' => array(), 'is_required' => array(), 'installed' => null, 'icon' => false, 'version' => null, 'url' => null, 'core' => 0);
         }
         $package =& $packages[$s['key']];
         $package['modules'][] = $s['module'];
         $package['name'] = $s['package'];
         $package['option'] = $s['option'];
         if (isset($s['core'])) {
             $package['core'] = $s['core'];
         }
         if ($package['installed'] === null) {
             $package['installed'] = $s['installed'];
         } else {
             if ($s['installed'] && !$package['installed'] || !$s['installed'] && $package['installed']) {
                 $package['installed'] = 'partial';
             }
         }
         if (!isset($is_required[$s['module']])) {
             $is_required[$s['module']] = array();
         }
         foreach ($is_required[$s['module']] as $r) {
             if (!isset($structure[$r])) {
                 $package['also_uninstall'][] = $r;
                 continue;
             }
             if ($structure[$r]['package'] == $s['package']) {
                 continue;
             }
             $package['is_required'][$structure[$r]['key']] = $structure[$r]['key'];
         }
         if (isset($s['icon'])) {
             $package['icon'] = Base_ThemeCommon::get_template_file($s['module'], 'package-icon.png');
         }
         if (isset($s['version'])) {
             $package['version'] = $s['version'];
         }
         if (isset($s['url'])) {
             $package['url'] = $s['url'];
         }
     }
     $sorted = array();
     foreach ($packages as $key => $p) {
         if ($key === 0) {
             continue;
         }
         $name = $p['name'];
         $option = $p['option'];
         if (!isset($sorted[$name])) {
             $sorted[$name] = array();
             $sorted[$name]['name'] = $name;
             $sorted[$name]['modules'] = array();
             $sorted[$name]['buttons'] = array();
             $sorted[$name]['options'] = array();
             $sorted[$name]['status'] = __('Options only');
             $sorted[$name]['filter'] = array('available');
             $sorted[$name]['style'] = 'disabled';
             $sorted[$name]['installed'] = null;
             $sorted[$name]['instalable'] = 0;
             $sorted[$name]['uninstalable'] = 0;
             $sorted[$name]['core'] = 0;
         }
         $sorted[$name]['core'] |= $p['core'];
         $buttons = array();
         $status = '';
         if ($p['installed'] === true || $p['installed'] === 'partial') {
             if (!$p['core'] && empty($p['is_required'])) {
//.........这里部分代码省略.........
开发者ID:62BRAINS,项目名称:EPESI,代码行数:101,代码来源:Setup_0.php


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