Elgg  Version 2.3
plugins.php
Go to the documentation of this file.
1 <?php
8 
9 
13 define('ELGG_PLUGIN_INCLUDE_START', 1);
14 
18 define('ELGG_PLUGIN_REGISTER_VIEWS', 2);
19 
23 define('ELGG_PLUGIN_REGISTER_LANGUAGES', 4);
24 
28 define('ELGG_PLUGIN_REGISTER_CLASSES', 8);
29 
36 //define('ELGG_PLUGIN_SETTING_PREFIX', 'plugin:setting:');
37 
41 define('ELGG_PLUGIN_USER_SETTING_PREFIX', 'plugin:user_setting:');
42 
48 define('ELGG_PLUGIN_INTERNAL_PREFIX', 'elgg:internal:');
49 
61  return _elgg_services()->plugins->generateEntities();
62 }
63 
72  return _elgg_services()->plugins->cache($plugin);
73 }
74 
83  return _elgg_services()->plugins->get($plugin_id);
84 }
85 
98  return _elgg_services()->plugins->exists($id);
99 }
100 
109  return _elgg_services()->plugins->getMaxPriority();
110 }
111 
120 function elgg_is_active_plugin($plugin_id, $site_guid = null) {
121  return _elgg_services()->plugins->isActive($plugin_id, $site_guid);
122 }
123 
132 function elgg_get_plugins($status = 'active', $site_guid = null) {
133  return _elgg_services()->plugins->find($status, $site_guid);
134 }
135 
152  return _elgg_services()->plugins->namespacePrivateSetting($type, $name, $id);
153 }
154 
163  return _elgg_services()->plugins->invalidateProvidesCache();
164 }
165 
182 function _elgg_check_plugins_provides($type, $name, $version = null, $comparison = 'ge') {
183  return _elgg_services()->plugins->checkProvides($type, $name, $version, $comparison);
184 }
185 
202  return _elgg_services()->plugins->getDependencyStrings($dep);
203 }
204 
216 function elgg_get_all_plugin_user_settings($user_guid = 0, $plugin_id = null, $return_obj = false) {
217  return _elgg_services()->plugins->getAllUserSettings($user_guid, $plugin_id, $return_obj);
218 }
219 
233  return _elgg_services()->plugins->setUserSetting($name, $value, $user_guid, $plugin_id);
234 }
235 
248  return _elgg_services()->plugins->unsetUserSetting($name, $user_guid, $plugin_id);
249 }
250 
264  return _elgg_services()->plugins->getUserSetting($name, $user_guid, $plugin_id, $default);
265 }
266 
279  return _elgg_services()->plugins->setSetting($name, $value, $plugin_id);
280 }
281 
294  return _elgg_services()->plugins->getSetting($name, $plugin_id, $default);
295 }
296 
308  return _elgg_services()->plugins->unsetSetting($name, $plugin_id);
309 }
310 
321  return _elgg_services()->plugins->unsetAllSettings($plugin_id);
322 }
323 
353  return _elgg_services()->plugins->getEntitiesFromUserSettings($options);
354 }
355 
368  global $CONFIG;
369  $value[] = $CONFIG->path . 'engine/tests/ElggCorePluginsAPITest.php';
370  return $value;
371 }
372 
379 function _elgg_plugins_init() {
380 
381  if (elgg_is_admin_logged_in()) {
382  elgg_register_ajax_view('object/plugin/full');
383  elgg_register_ajax_view('object/plugin/details');
384  }
385 
386  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_plugins_test');
387 
391  $svc = _elgg_services()->plugins;
392  elgg_register_event_handler('deactivate', 'plugin', array($svc, 'invalidateIsActiveCache'));
393  elgg_register_event_handler('activate', 'plugin', array($svc, 'invalidateIsActiveCache'));
394 
395  elgg_register_action("plugins/settings/save", '', 'admin');
396  elgg_register_action("plugins/usersettings/save");
397 
398  elgg_register_action('admin/plugins/activate', '', 'admin');
399  elgg_register_action('admin/plugins/deactivate', '', 'admin');
400  elgg_register_action('admin/plugins/activate_all', '', 'admin');
401  elgg_register_action('admin/plugins/deactivate_all', '', 'admin');
402 
403  elgg_register_action('admin/plugins/set_priority', '', 'admin');
404 }
405 
406 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
407  $events->registerHandler('init', 'system', '_elgg_plugins_init');
408 };
elgg_get_entities_from_plugin_user_settings(array $options=array())
Returns entities based upon plugin user settings.
Definition: plugins.php:352
$plugin
$version
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:60
elgg_set_plugin_setting($name, $value, $plugin_id=null)
Set a setting for a plugin.
Definition: plugins.php:278
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
_elgg_check_plugins_provides($type, $name, $version=null, $comparison= 'ge')
Checks if a plugin is currently providing $type and $name, and optionally checking a version...
Definition: plugins.php:182
elgg_get_all_plugin_user_settings($user_guid=0, $plugin_id=null, $return_obj=false)
Returns an array of all plugin user settings for a user.
Definition: plugins.php:216
$value
Definition: longtext.php:42
$default
Definition: checkbox.php:34
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Definition: elgglib.php:740
$options
Elgg admin footer.
Definition: footer.php:6
$params
Definition: login.php:72
_elgg_namespace_plugin_private_setting($type, $name, $id=null)
Namespaces a string to be used as a private setting name for a plugin.
Definition: plugins.php:151
_elgg_cache_plugin_by_id(\ElggPlugin $plugin)
Cache a reference to this plugin by its ID.
Definition: plugins.php:71
elgg_unset_all_plugin_settings($plugin_id=null)
Unsets all plugin settings for a plugin.
Definition: plugins.php:320
_elgg_get_plugin_dependency_strings($dep)
Returns an array of parsed strings for a dependency in the format: array( &#39;type&#39; => requires...
Definition: plugins.php:201
$plugin_id
Definition: save.php:16
global $CONFIG
elgg_set_plugin_user_setting($name, $value, $user_guid=0, $plugin_id=null)
Set a user specific setting for a plugin.
Definition: plugins.php:232
_elgg_get_max_plugin_priority()
Returns the highest priority of the plugins.
Definition: plugins.php:108
elgg global
Pointer to the global context.
Definition: elgglib.js:12
elgg_register_ajax_view($view)
Register a view to be available for ajax calls.
Definition: views.php:221
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
Definition: autoloader.php:17
elgg_get_plugin_user_setting($name, $user_guid=0, $plugin_id=null, $default=null)
Get a user specific setting for a plugin.
Definition: plugins.php:263
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Definition: elgglib.php:550
elgg_plugin_exists($id)
Returns if a plugin exists in the system.
Definition: plugins.php:97
_elgg_plugins_init()
Initialize the plugin system.
Definition: plugins.php:379
elgg_unset_plugin_user_setting($name, $user_guid=0, $plugin_id=null)
Unsets a user-specific plugin setting.
Definition: plugins.php:247
_elgg_plugins_test($hook, $type, $value, $params)
Runs unit tests for plugin API.
Definition: plugins.php:367
elgg_get_plugins($status= 'active', $site_guid=null)
Returns an ordered list of plugins.
Definition: plugins.php:132
elgg_unset_plugin_setting($name, $plugin_id=null)
Unsets a plugin setting.
Definition: plugins.php:307
elgg_get_plugin_setting($name, $plugin_id=null, $default=null)
Get setting for a plugin.
Definition: plugins.php:293
elgg_is_active_plugin($plugin_id, $site_guid=null)
Returns if a plugin is active for a current site.
Definition: plugins.php:120
define(function(require){var $=require('jquery');$(document).on('change', '#elgg-river-selector', function(){var url=window.location.href;if(window.location.search.length){url=url.substring(0, url.indexOf('?'));}url+= '?'+$(this).val();window.location.href=url;});})
Initiates page reload when river selector value changes core/river/filter.
_elgg_invalidate_plugins_provides_cache()
Deletes all cached data on plugins being provided.
Definition: plugins.php:162
elgg_register_action($action, $filename="", $access= 'logged_in')
Registers an action.
Definition: actions.php:96
$user_guid
Avatar remove action.
Definition: remove.php:6
if(!$collection_name) $id
Definition: add.php:17
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:5
_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
elgg_get_plugin_from_id($plugin_id)
Returns an object with the path $path.
Definition: plugins.php:82
if(!$display_name) $type
Definition: delete.php:27