blob: bf9f4e4c18ef2335974eb5b008b5ea050aa761d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
<?php
/**
* Elgg administration simple plugin screen
*
* Shows an alphabetical list of "simple" plugins.
*
* @package Elgg
* @subpackage Core
*/
elgg_generate_plugin_entities();
$installed_plugins = elgg_get_plugins('any');
$plugin_list = array();
foreach ($installed_plugins as $plugin) {
if (!$plugin->isValid()) {
continue;
}
$interface = $plugin->manifest->getAdminInterface();
if ($interface == 'simple') {
$plugin_list[$plugin->manifest->getName()] = $plugin;
}
}
ksort($plugin_list);
echo <<<___END
<ul>
___END;
$actions_base = '/action/admin/plugins/';
$ts = time();
$token = generate_action_token($ts);
foreach ($plugin_list as $name => $plugin) {
$plugin_guid = $plugin->guid;
$plugin_id = $plugin->getID();
$active = $plugin->isActive();
$can_activate = $plugin->canActivate();
$author = $plugin->manifest->getAuthor();
$version = $plugin->manifest->getVersion();
$website = $plugin->manifest->getWebsite();
$description = $plugin->manifest->getDescription();
if ($active) {
$active_class = 'elgg-state-active';
$checked = 'checked="checked"';
} else {
$active_class = 'elgg-state-inactive';
$checked = '';
}
if ($can_activate) {
$disabled = '';
} else {
$disabled = 'disabled="disabled"';
$description .= '<p>' . elgg_echo('admin:plugins:simple:cannot_activate') . '</p>';
}
$description = elgg_view('output/longtext', array('value' => $description));
$plugin_footer = '<ul class="elgg-menu elgg-menu-footer">';
if ($author) {
$plugin_footer .= '<li>' . elgg_echo('admin:plugins:author', array($author)) . '</li>';
}
if ($version) {
$plugin_footer .= '<li>' . elgg_echo('admin:plugins:version', array($version)) . '</li>';
}
if ($website) {
$plugin_footer .= "<li><a href=\"$website\">" . elgg_echo('admin:plugins:plugin_website') . '</a></li>';
}
if (elgg_view_exists("settings/$plugin_id/edit")) {
$settings_href = elgg_get_site_url() . "pg/admin/plugin_settings/$plugin_id";
$plugin_footer .= "<li><a class='plugin_settings link' href='$settings_href'>" . elgg_echo('settings') . "</a></li>";
}
$plugin_footer .= "</ul>";
echo <<<___END
<li class="elgg-plugin $active_class">
<div class="elgg-grid">
<div class="elgg-col elgg-col-1of5">
<input type="checkbox" id="$plugin_guid" $checked $disabled name="active_plugin_guids[]" value="$plugin_guid"/>
<label for="$plugin_guid">$name</label>
</div>
<div class="elgg-col elgg-col-4of5">
$description
$plugin_footer
</div>
</div>
</li>
___END;
}
echo '</ul>';
echo elgg_view('input/submit', array('value' => elgg_echo('save')));
echo elgg_view('input/reset', array('value' => elgg_echo('reset')));
|