Elgg  Version 2.3
plugins.php
Go to the documentation of this file.
1 <?php
10 $list_only = (bool)elgg_extract('list_only', $vars);
11 
12 // @todo this should occur in the controller code
14 
16 
17 // Get a list of the all categories
18 // and trim down the plugin list if we're not viewing all categories.
19 // @todo this could be cached somewhere after have the manifest loaded
20 $categories = array();
21 
22 foreach ($installed_plugins as $id => $plugin) {
23  if (!$plugin->isValid()) {
24  if ($plugin->isActive()) {
25  $disable_plugins = elgg_get_config('auto_disable_plugins');
26  if ($disable_plugins === null) {
27  $disable_plugins = true;
28  }
29  if ($disable_plugins) {
30  // force disable and warn
31  elgg_add_admin_notice('invalid_and_deactivated_' . $plugin->getID(),
32  elgg_echo('ElggPlugin:InvalidAndDeactivated', array($plugin->getId())));
33  $plugin->deactivate();
34  }
35  }
36  continue;
37  }
38 
39  $plugin_categories = $plugin->getManifest()->getCategories();
40 
41  if (isset($plugin_categories)) {
42  foreach ($plugin_categories as $category) {
43  if (!array_key_exists($category, $categories)) {
45  }
46  }
47  }
48 }
49 
51  'limit' => 0,
52  'full_view' => true,
53  'list_type_toggle' => false,
54  'pagination' => false,
55  'display_reordering' => true,
56 ];
57 
59 if ($add_context) {
60  // needed for expected plugin view rendering
61  elgg_push_context('admin');
62 }
64 $plugins_list .= "<div id='elgg-plugin-list-cover'></div>";
65 if ($add_context) {
67 }
68 
69 if ($list_only) {
71  return;
72 }
73 
74 asort($categories);
75 
76 // we want bundled/nonbundled pulled to be at the top of the list
77 unset($categories['bundled']);
78 unset($categories['nonbundled']);
79 
81  'all' => elgg_echo('admin:plugins:category:all'),
82  'active' => elgg_echo('admin:plugins:category:active'),
83  'inactive' => elgg_echo('admin:plugins:category:inactive'),
84  'bundled' => elgg_echo('admin:plugins:category:bundled'),
85  'nonbundled' => elgg_echo('admin:plugins:category:nonbundled'),
86 ];
87 
89 
90 $category_form = elgg_view("admin/plugins/filter", [
91  'category' => "all",
92  'category_options' => $categories
93 ]);
94 
95 elgg_register_menu_item('title', [
96  'name' => 'activate-all',
97  'href' => 'action/admin/plugins/activate_all',
98  'text' => elgg_echo('admin:plugins:activate_all'),
99  'link_class' => 'elgg-button elgg-button-submit elgg-plugins-toggle',
100  'data-desired-state' => 'active',
101 ]);
102 elgg_register_menu_item('title', [
103  'name' => 'dactivate-all',
104  'href' => 'action/admin/plugins/deactivate_all',
105  'text' => elgg_echo('admin:plugins:deactivate_all'),
106  'link_class' => 'elgg-button elgg-button-submit elgg-plugins-toggle',
107  'data-desired-state' => 'inactive',
108 ]);
109 
112  'div',
113  ['id' => 'elgg-plugin-list'],
115 );
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
$plugin
$installed_plugins
Definition: plugins.php:15
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
foreach($installed_plugins as $id=> $plugin) $add_context
Definition: plugins.php:58
elgg_add_admin_notice($id, $message)
Write a persistent message to the admin view.
Definition: admin.php:75
$vars['entity']
$list_only
Elgg administration plugin screen.
Definition: plugins.php:10
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:208
if($add_context) $plugins_list
Definition: plugins.php:63
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: pageowner.php:225
elgg_in_context($context)
Check if this context exists anywhere in the stack.
Definition: pageowner.php:241
elgg echo
Translates a string.
Definition: languages.js:48
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
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:1375
foreach($installed_plugins as $id=> $plugin) $list_options
Definition: plugins.php:50
elgg_view_entity_list($entities, array $vars=array())
Returns a rendered list of entities with pagination.
Definition: views.php:1048
elgg_get_plugins($status= 'active', $site_guid=null)
Returns an ordered list of plugins.
Definition: plugins.php:132
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:215
$common_categories
Definition: plugins.php:80
$categories
Definition: plugins.php:20
if(!$collection_name) $id
Definition: add.php:17
_elgg_generate_plugin_entities()
Discovers plugins in the plugins_path setting and creates entities for them if they don&#39;t exist...
Definition: plugins.php:60
$category_form
Definition: plugins.php:90