Stud.IP  5.4
PluginManager Class Reference

Public Member Functions

 setPluginEnabled ($id, $enabled, $force=false)
 
 setPluginPosition ($id, $position)
 
 isPluginActivated ($id, $context)
 
 isPluginActivatedForUser ($pluginId, $userId)
 
 setPluginActivated ($id, $rangeId, $active)
 
 setPluginActivatedForUser ($pluginid, $user_id, $active)
 
 deactivateAllPluginsForRange ($range_type, $range_id)
 
 setPluginsDisabled ($status)
 
 isPluginsDisabled ()
 
 registerPlugin ($name, $class, $path, $depends=null)
 
 unregisterPlugin ($id)
 
 getPluginInfo ($class)
 
 getPluginInfoById ($id)
 
 getPluginInfos ($type=null)
 
 getPlugin ($class)
 
 getPluginById ($id)
 
 getPlugins ($type, $context=null)
 
 getPluginManifest ($plugindir)
 

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 checkUserAccess ($plugin, $user_id)
 
 getCachedPlugin ($plugin_info)
 

Member Function Documentation

◆ checkUserAccess()

checkUserAccess (   $plugin,
  $user_id 
)
protected

Check user access permission for the given plugin.

Parameters
array$pluginplugin meta data
string$user_idid of user
Returns
bool

◆ deactivateAllPluginsForRange()

deactivateAllPluginsForRange (   $range_type,
  $range_id 
)

Deactivate all plugins for the given range.

Parameters
string$range_typeType of range (sem, inst or user)
string$range_idId of range
Returns
int number of deactivated/removed plugins for range

◆ getCachedPlugin()

getCachedPlugin (   $plugin_info)
protected

Get instance of the plugin specified by plugin meta data.

Parameters
array$plugin_infoplugin meta data
Returns
object

◆ getInstance()

static getInstance ( )
static

Returns the PluginManager singleton instance.

◆ getPlugin()

getPlugin (   $class)

Get instance of the plugin specified by plugin class name.

Parameters
string$classclass name of plugin
Returns
object

◆ getPluginById()

getPluginById (   $id)

Get instance of the plugin specified by plugin id.

Parameters
int$idid of the plugin
Returns
object $plugin

◆ getPluginInfo()

getPluginInfo (   $class)

Get meta data for the plugin specified by plugin class name.

Parameters
string$classclass name of plugin

◆ getPluginInfoById()

getPluginInfoById (   $id)

Get meta data for the plugin specified by plugin id.

Parameters
int$idid of the plugin

◆ getPluginInfos()

getPluginInfos (   $type = null)

Get meta data for all plugins of the specified type. A type of null returns meta data for all installed plugins.

Parameters
string$typeplugin type or null (all types)

◆ getPluginManifest()

getPluginManifest (   $plugindir)

Read the manifest of the plugin in the given directory. Returns null if the manifest cannot be found.

Returns
array containing the manifest information

◆ getPlugins()

getPlugins (   $type,
  $context = null 
)

Get instances of all plugins of the specified type. A type of null returns all enabled plugins. The optional context parameter can be used to get only plugins that are activated in the given context.

Parameters
string$typeplugin type or null (all types)
string$contextcontext range id (optional)

◆ isPluginActivated()

isPluginActivated (   $id,
  $context 
)

Get the activation status of a plugin in the given context. This also checks the plugin default activations and sem_class-settings.

Parameters
int$idid of the plugin
string$contextrange id
Returns
bool

◆ isPluginActivatedForUser()

isPluginActivatedForUser (   $pluginId,
  $userId 
)

Get the activation status of a plugin for the given user. This also checks the plugin default activations and sem_class-settings.

Parameters
int$pluginIdid of the plugin
string$userIdid of the user

◆ isPluginsDisabled()

isPluginsDisabled ( )

Check whether loading of non-core plugins is currently disabled.

◆ registerPlugin()

registerPlugin (   $name,
  $class,
  $path,
  $depends = null 
)

Register a new plugin or update an existing plugin entry in the data base. Returns the id of the new or updated plugin.

Parameters
string$nameplugin name
string$classplugin class name
string$pathplugin relative path
int$dependsid of plugin this plugin depends on

◆ setPluginActivated()

setPluginActivated (   $id,
  $rangeId,
  $active 
)

Sets the activation status of a plugin in the given context.

Parameters
int$idid of the plugin
string$rangeIdcontext range id
bool$activeplugin status (true or false)

◆ setPluginActivatedForUser()

setPluginActivatedForUser (   $pluginid,
  $user_id,
  $active 
)

Sets the activation status of a plugin in the given context.

Parameters
int$pluginidid of the plugin
string$user_iduser id
bool$activeplugin status (true or false)

◆ setPluginEnabled()

setPluginEnabled (   $id,
  $enabled,
  $force = false 
)

Set the enabled/disabled status of the given plugin.

If the plugin implements the method "onEnable" or "onDisable", this method will be called accordingly. If the method returns false or throws and exception, the plugin's activation state is not updated.

Parameters
int$idid of the plugin
bool$enabledplugin status (true or false)
bool$forceforce (de)activation regardless of the result of on(en|dis)able
Returns
bool indicating whether the plugin was updated or null if the passed state equals the current state or if the plugin is missing.

◆ setPluginPosition()

setPluginPosition (   $id,
  $position 
)

Set the navigation position of the given plugin.

Parameters
int$idid of the plugin
int$positionplugin navigation position
Returns
bool indicating whether any change occured

◆ setPluginsDisabled()

setPluginsDisabled (   $status)

Disable loading of all non-core plugins for the current session.

Parameters
bool$statustrue: disable non-core plugins

◆ unregisterPlugin()

unregisterPlugin (   $id)

Remove registration for the given plugin from the data base.

Parameters
int$idid of the plugin

The documentation for this class was generated from the following file: