Elgg  Version 3.0
categories.php
Go to the documentation of this file.
1 <?php
2 
3 $plugins = elgg_extract('plugins', $vars);
4 if (empty($plugins)) {
5  return;
6 }
7 
8 // Get a list of the all categories
9 // and trim down the plugin list if we're not viewing all categories.
10 // @todo this could be cached somewhere after have the manifest loaded
12 
13 foreach ($plugins as $id => $plugin) {
14  if (!$plugin->isValid()) {
15  if ($plugin->isActive()) {
16  // @todo this needs to go somewhere else
17  $disable_plugins = elgg_get_config('auto_disable_plugins');
18  if ($disable_plugins === null) {
19  $disable_plugins = true;
20  }
21  if ($disable_plugins) {
22  // force disable and warn
23  elgg_add_admin_notice('invalid_and_deactivated_' . $plugin->getID(),
24  elgg_echo('ElggPlugin:InvalidAndDeactivated', [$plugin->getId()]));
25  $plugin->deactivate();
26  }
27  }
28  continue;
29  }
30 
31  $plugin_categories = $plugin->getManifest()->getCategories();
32 
33  if (isset($plugin_categories)) {
34  foreach ($plugin_categories as $category) {
35  if (!array_key_exists($category, $categories)) {
37  }
38  }
39  }
40 }
41 
42 
43 asort($categories);
44 
45 // we want bundled/nonbundled pulled to be at the top of the list
46 unset($categories['bundled']);
47 unset($categories['nonbundled']);
48 
50  'all' => elgg_echo('admin:plugins:category:all'),
51  'active' => elgg_echo('admin:plugins:category:active'),
52  'inactive' => elgg_echo('admin:plugins:category:inactive'),
53  'bundled' => elgg_echo('admin:plugins:category:bundled'),
54  'nonbundled' => elgg_echo('admin:plugins:category:nonbundled'),
55 ];
56 
58 
59 echo elgg_view("admin/plugins/filter", [
60  'category' => "all",
61  'category_options' => $categories
62 ]);
$plugin
elgg_add_admin_notice($id, $message)
Write a persistent message to the admin view.
Definition: admin.php:59
$plugins
Definition: categories.php:3
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$common_categories
Definition: categories.php:49
if(empty($plugins)) $categories
Definition: categories.php:11
$id
River item delete action.
Definition: delete.php:6
elgg echo
Translates a string.
Definition: languages.js:43
static getFriendlyCategory($category)
Returns a category&#39;s friendly name.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1131
$vars['type']
Definition: save.php:11
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246
elgg_get_config($name, $default=null)
Get an Elgg configuration value.