本文整理汇总了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'])) {
//.........这里部分代码省略.........