Elgg  Version 4.3
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.
11 
12 foreach ($plugins as $plugin) {
13  if (!$plugin->isValid()) {
14  if ($plugin->isActive()) {
15  if (elgg_get_config('auto_disable_plugins')) {
16  try {
17  // force disable and warn
18  $plugin->deactivate();
19 
20  elgg_add_admin_notice('invalid_and_deactivated_' . $plugin->getID(), elgg_echo('ElggPlugin:InvalidAndDeactivated', [$plugin->getID()]));
21  } catch (\Elgg\Exceptions\PluginException $e) {
22  // do nothing
23  }
24  }
25  }
26 
27  continue;
28  }
29 
30  $plugin_categories = $plugin->getCategories();
31  foreach ($plugin_categories as $category => $category_title) {
32  if (!array_key_exists($category, $categories)) {
33  $categories[$category] = $category_title;
34  }
35  }
36 }
37 
38 asort($categories);
39 
41  'all' => elgg_echo('admin:plugins:category:all'),
42  'active' => elgg_echo('admin:plugins:category:active'),
43  'inactive' => elgg_echo('admin:plugins:category:inactive'),
44 ];
45 
47 
48 echo elgg_view('admin/plugins/filter', [
49  'category' => "all",
50  'category_options' => $categories,
51  'active_filter' => elgg_extract('active_filter', $vars),
52 ]);
$plugin
$plugins
Definition: categories.php:3
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
$common_categories
Definition: categories.php:40
if(empty($plugins)) $categories
Definition: categories.php:10
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:547
elgg_add_admin_notice(string $id, string $message)
Write a persistent message to the admin view.
Definition: admin.php:51
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179
elgg_get_config($name, $default=null)
Get an Elgg configuration value.