Elgg
Version 2.3
|
Persistent, installation-wide key-value storage. More...
Public Member Functions | |
__construct (Pool $pool, PluginSettingsCache $cache) | |
Constructor. More... | |
setBootPlugins (array $plugins) | |
Set the list of active plugins according to the boot data cache. More... | |
getDirsInDir ($dir=null) | |
Returns a list of plugin directory names from a base directory. More... | |
generateEntities () | |
Discovers plugins in the plugins_path setting and creates entities for them if they don't exist. More... | |
cache (\ElggPlugin $plugin) | |
Cache a reference to this plugin by its ID. More... | |
get ($plugin_id) | |
Returns an object with the path $path. More... | |
exists ($id) | |
Returns if a plugin exists in the system. More... | |
getMaxPriority () | |
Returns the highest priority of the plugins. More... | |
isActive ($plugin_id, $site_guid=null) | |
Returns if a plugin is active for a current site. More... | |
load () | |
Loads all active plugins in the order specified in the tool admin panel. More... | |
find ($status= 'active', $site_guid=null) | |
Returns an ordered list of plugins. More... | |
setPriorities (array $order) | |
Reorder plugins to an order specified by the array. More... | |
reindexPriorities () | |
Reindexes all plugin priorities starting at 1. More... | |
namespacePrivateSetting ($type, $name, $id=null) | |
Namespaces a string to be used as a private setting name for a plugin. More... | |
getProvides ($type=null, $name=null) | |
Returns an array of all provides from all active plugins. More... | |
invalidateProvidesCache () | |
Deletes all cached data on plugins being provided. More... | |
invalidateIsActiveCache () | |
Delete the cache holding whether plugins are active or not. More... | |
checkProvides ($type, $name, $version=null, $comparison= 'ge') | |
Checks if a plugin is currently providing $type and $name, and optionally checking a version. More... | |
getDependencyStrings ($dep) | |
Returns an array of parsed strings for a dependency in the format: array( 'type' => requires, conflicts, or provides. More... | |
getAllUserSettings ($user_guid=0, $plugin_id=null, $return_obj=false) | |
Returns an array of all plugin user settings for a user. More... | |
setUserSetting ($name, $value, $user_guid=0, $plugin_id=null) | |
Set a user specific setting for a plugin. More... | |
unsetUserSetting ($name, $user_guid=0, $plugin_id=null) | |
Unsets a user-specific plugin setting. More... | |
getUserSetting ($name, $user_guid=0, $plugin_id=null, $default=null) | |
Get a user specific setting for a plugin. More... | |
setSetting ($name, $value, $plugin_id=null) | |
Set a setting for a plugin. More... | |
getSetting ($name, $plugin_id=null, $default=null) | |
Get setting for a plugin. More... | |
unsetSetting ($name, $plugin_id=null) | |
Unsets a plugin setting. More... | |
unsetAllSettings ($plugin_id=null) | |
Unsets all plugin settings for a plugin. More... | |
getEntitiesFromUserSettings (array $options=array()) | |
Returns entities based upon plugin user settings. More... | |
Persistent, installation-wide key-value storage.
WARNING: API IN FLUX. DO NOT USE DIRECTLY.
private
Definition at line 18 of file Plugins.php.
Elgg\Database\Plugins::__construct | ( | Pool | $pool, |
PluginSettingsCache | $cache | ||
) |
Constructor.
Pool | $pool | Cache for referencing plugins by ID |
PluginSettingsCache | $cache | Plugin settings cache |
Definition at line 57 of file Plugins.php.
Elgg\Database\Plugins::cache | ( | \ElggPlugin | $plugin | ) |
Cache a reference to this plugin by its ID.
\ElggPlugin | $plugin | private |
Definition at line 214 of file Plugins.php.
Elgg\Database\Plugins::checkProvides | ( | $type, | |
$name, | |||
$version = null , |
|||
$comparison = 'ge' |
|||
) |
Checks if a plugin is currently providing $type and $name, and optionally checking a version.
string | $type | The type of the provide |
string | $name | The name of the provide |
string | $version | A version to check against |
string | $comparison | The comparison operator to use in version_compare() |
Definition at line 679 of file Plugins.php.
Elgg\Database\Plugins::exists | ( | $id | ) |
Returns if a plugin exists in the system.
string | $id | The plugin ID. |
Definition at line 259 of file Plugins.php.
Elgg\Database\Plugins::find | ( | $status = 'active' , |
|
$site_guid = null |
|||
) |
Returns an ordered list of plugins.
string | $status | The status of the plugins. active, inactive, or all. |
mixed | $site_guid | Optional site guid |
Definition at line 409 of file Plugins.php.
Elgg\Database\Plugins::generateEntities | ( | ) |
Discovers plugins in the plugins_path setting and creates entities for them if they don't exist.
If there are plugins with entities but not actual files, will disable the entities and mark as inactive. The object holds config data, so don't delete.
Definition at line 115 of file Plugins.php.
Elgg\Database\Plugins::get | ( | $plugin_id | ) |
Returns an object with the path $path.
string | $plugin_id | The id (dir name) of the plugin. NOT the guid. |
Definition at line 224 of file Plugins.php.
Elgg\Database\Plugins::getAllUserSettings | ( | $user_guid = 0 , |
|
$plugin_id = null , |
|||
$return_obj = false |
|||
) |
Returns an array of all plugin user settings for a user.
int | $user_guid | The user GUID or 0 for the currently logged in user. |
string | $plugin_id | The plugin ID (Required) |
bool | $return_obj | Return settings as an object? This can be used to in reusable views where the settings are passed as $vars['entity']. |
Definition at line 837 of file Plugins.php.
Elgg\Database\Plugins::getDependencyStrings | ( | $dep | ) |
Returns an array of parsed strings for a dependency in the format: array( 'type' => requires, conflicts, or provides.
'name' => The name of the requirement / conflict 'value' => A string representing the expected value: <1, >=3, !=enabled 'local_value' => The current value, ("Not installed") 'comment' => Free form text to help resovle the problem ("Enable / Search for plugin <link>") )
array | $dep | An dependency array |
Definition at line 714 of file Plugins.php.
Elgg\Database\Plugins::getDirsInDir | ( | $dir = null | ) |
Returns a list of plugin directory names from a base directory.
string | $dir | A dir to scan for plugins. Defaults to config's plugins_path. Must have a trailing slash. |
Definition at line 84 of file Plugins.php.
Elgg\Database\Plugins::getEntitiesFromUserSettings | ( | array | $options = array() | ) |
Returns entities based upon plugin user settings.
Takes all the options for elgg_get_entities_from_private_settings() in addition to the ones below.
array | $options | Array in the format: plugin_id => STR The plugin id. Required. plugin_user_setting_names => null|ARR private setting names plugin_user_setting_values => null|ARR metadata values plugin_user_setting_name_value_pairs => null|ARR ( name => 'name', value => 'value', 'operand' => '=', ) Currently if multiple values are sent via an array (value => array('value1', 'value2') the pair's operand will be forced to "IN". plugin_user_setting_name_value_pairs_operator => null|STR The operator to use for combining (name = value) OPERATOR (name = value); default AND |
Definition at line 1065 of file Plugins.php.
Elgg\Database\Plugins::getMaxPriority | ( | ) |
Returns the highest priority of the plugins.
Definition at line 269 of file Plugins.php.
Elgg\Database\Plugins::getProvides | ( | $type = null , |
|
$name = null |
|||
) |
Returns an array of all provides from all active plugins.
Array in the form array( 'provide_type' => array( 'provided_name' => array( 'version' => '1.8', 'provided_by' => 'provider_plugin_id' ) ) )
string | $type | The type of provides to return |
string | $name | A specific provided name to return. Requires $provide_type. |
Definition at line 600 of file Plugins.php.
Elgg\Database\Plugins::getSetting | ( | $name, | |
$plugin_id = null , |
|||
$default = null |
|||
) |
Get setting for a plugin.
string | $name | The name of the setting. |
string | $plugin_id | The plugin ID (Required) |
mixed | $default | The default value to return if none is set |
Definition at line 976 of file Plugins.php.
Elgg\Database\Plugins::getUserSetting | ( | $name, | |
$user_guid = 0 , |
|||
$plugin_id = null , |
|||
$default = null |
|||
) |
Get a user specific setting for a plugin.
string | $name | The name of the setting. |
int | $user_guid | The user GUID or 0 for the currently logged in user. |
string | $plugin_id | The plugin ID (Required) |
mixed | $default | The default value to return if none is set |
Definition at line 926 of file Plugins.php.
Elgg\Database\Plugins::invalidateIsActiveCache | ( | ) |
Delete the cache holding whether plugins are active or not.
Definition at line 659 of file Plugins.php.
Elgg\Database\Plugins::invalidateProvidesCache | ( | ) |
Deletes all cached data on plugins being provided.
Definition at line 648 of file Plugins.php.
Elgg\Database\Plugins::isActive | ( | $plugin_id, | |
$site_guid = null |
|||
) |
Returns if a plugin is active for a current site.
string | $plugin_id | The plugin ID |
int | $site_guid | The site guid |
Definition at line 298 of file Plugins.php.
Elgg\Database\Plugins::load | ( | ) |
Loads all active plugins in the order specified in the tool admin panel.
Definition at line 335 of file Plugins.php.
Elgg\Database\Plugins::namespacePrivateSetting | ( | $type, | |
$name, | |||
$id = null |
|||
) |
Namespaces a string to be used as a private setting name for a plugin.
For user_settings, two namespaces are added: a user setting namespace and the plugin id.
For internal (plugin priority), there is a single internal namespace added.
string | $type | The type of setting: user_setting or internal. |
string | $name | The name to namespace. |
string | $id | The plugin's ID to namespace with. Required for user_setting. |
Definition at line 558 of file Plugins.php.
Elgg\Database\Plugins::reindexPriorities | ( | ) |
Reindexes all plugin priorities starting at 1.
Definition at line 540 of file Plugins.php.
Elgg\Database\Plugins::setBootPlugins | ( | array | $plugins | ) |
Set the list of active plugins according to the boot data cache.
Definition at line 68 of file Plugins.php.
Elgg\Database\Plugins::setPriorities | ( | array | $order | ) |
Reorder plugins to an order specified by the array.
Plugins not included in this array will be appended to the end.
array | $order | An array of plugin ids in the order to set them |
Definition at line 484 of file Plugins.php.
Elgg\Database\Plugins::setSetting | ( | $name, | |
$value, | |||
$plugin_id = null |
|||
) |
Set a setting for a plugin.
string | $name | The name of the setting - note, can't be "title". |
mixed | $value | The value. |
string | $plugin_id | The plugin ID (Required) |
Definition at line 951 of file Plugins.php.
Elgg\Database\Plugins::setUserSetting | ( | $name, | |
$value, | |||
$user_guid = 0 , |
|||
$plugin_id = null |
|||
) |
Set a user specific setting for a plugin.
string | $name | The name. Note: cannot be "title". |
mixed | $value | The value. |
int | $user_guid | The user GUID or 0 for the currently logged in user. |
string | $plugin_id | The plugin ID (Required) |
Definition at line 875 of file Plugins.php.
Elgg\Database\Plugins::unsetAllSettings | ( | $plugin_id = null | ) |
Unsets all plugin settings for a plugin.
string | $plugin_id | The plugin ID (Required) |
Definition at line 1023 of file Plugins.php.
Elgg\Database\Plugins::unsetSetting | ( | $name, | |
$plugin_id = null |
|||
) |
Unsets a plugin setting.
string | $name | The name of the setting. |
string | $plugin_id | The plugin ID (Required) |
Definition at line 1000 of file Plugins.php.
Elgg\Database\Plugins::unsetUserSetting | ( | $name, | |
$user_guid = 0 , |
|||
$plugin_id = null |
|||
) |
Unsets a user-specific plugin setting.
string | $name | Name of the setting |
int | $user_guid | The user GUID or 0 for the currently logged in user. |
string | $plugin_id | The plugin ID (Required) |
Definition at line 900 of file Plugins.php.