ElggPlugin Class Reference

Inheritance diagram for ElggPlugin:
ElggObject ElggEntity ElggData Notable Locatable Importable Loggable Exportable

List of all members.

Public Member Functions

 __construct ($plugin)
 Loads the plugin by GUID or path.
 save ()
 Save the plugin object.
 getID ()
 Returns the ID (dir name) of this plugin.
 getFriendlyName ()
 Returns the manifest's name if available, otherwise the ID.
 getPath ()
 Returns the plugin's full path with trailing slash.
 setID ($id)
 Sets the location of this plugin.
 getAvailableTextFiles ()
 Returns an array of available markdown files for this plugin.
 getPriority ()
 Gets the plugin's load priority.
 setPriority ($priority, $site_guid=null)
 Sets the priority of the plugin.
 getSetting ($name)
 Returns a plugin setting.
 getAllSettings ()
 Returns an array of all settings saved for this plugin.
 setSetting ($name, $value)
 Set a plugin setting for the plugin.
 unsetSetting ($name)
 Removes a plugin setting name and value.
 unsetAllSettings ()
 Removes all settings for this plugin.
 getUserSetting ($name, $user_guid=null)
 Returns a user's setting for this plugin.
 getAllUserSettings ($user_guid=null)
 Returns an array of all user settings saved for this plugin for the user.
 setUserSetting ($name, $value, $user_guid=null)
 Sets a user setting for a plugin.
 unsetUserSetting ($name, $user_guid=null)
 Removes a user setting name and value.
 unsetAllUserSettings ($user_guid)
 Removes all User Settings for this plugin.
 unsetAllUsersSettings ()
 Removes this plugin's user settings for all users.
 isValid ()
 Returns if the plugin is complete, meaning has all required files and Elgg can read them and they make sense.
 isActive ($site_guid=null)
 Is this plugin active?
 canActivate ($site_guid=null)
 Checks if this plugin can be activated on the current Elgg installation.
 activate ($site_guid=null)
 Actives the plugin for the current site.
 deactivate ($site_guid=null)
 Deactivates the plugin.
 start ($flags)
 Start the plugin.
 get ($name)
 Get a value from private settings.
 set ($name, $value)
 Save a value as private setting or attribute.
 getError ()
 Returns the last error message registered.
 getManifest ()
 Returns this plugin's ElggPluginManifest object.
 getPackage ()
 Returns this plugin's ElggPluginPackage object.

Protected Member Functions

 initializeAttributes ()
 Set subtype to 'plugin'.
 includeFile ($filename)
 Includes one of the plugins files.
 canReadFile ($filename)
 Checks whether a plugin file with the given name exists.
 registerViews ()
 Registers the plugin's views.
 registerLanguages ()
 Registers the plugin's languages.
 registerClasses ()
 Registers the plugin's classes.

Detailed Description

Definition at line 11 of file ElggPlugin.php.


Constructor & Destructor Documentation

ElggPlugin::__construct ( plugin  ) 

Loads the plugin by GUID or path.

Warning:
Unlike other ElggEntity objects, you cannot null instantiate ElggPlugin. You must point it to an actual plugin GUID or location.
Parameters:
mixed $plugin The GUID of the ElggPlugin object or the path of the plugin to load.
Exceptions:
PluginException 

Reimplemented from ElggObject.

Definition at line 43 of file ElggPlugin.php.


Member Function Documentation

ElggPlugin::activate ( site_guid = null  ) 

Actives the plugin for the current site.

Parameters:
mixed $site_guid Optional site GUID.
Returns:
bool

Definition at line 627 of file ElggPlugin.php.

ElggPlugin::canActivate ( site_guid = null  ) 

Checks if this plugin can be activated on the current Elgg installation.

Parameters:
mixed $site_guid Optional site guid
Returns:
bool

Definition at line 605 of file ElggPlugin.php.

ElggPlugin::canReadFile ( filename  )  [protected]

Checks whether a plugin file with the given name exists.

Parameters:
string $filename The name of the file
Returns:
bool

Definition at line 774 of file ElggPlugin.php.

ElggPlugin::deactivate ( site_guid = null  ) 

Deactivates the plugin.

Parameters:
mixed $site_guid Optional site GUID.
Returns:
bool

Definition at line 677 of file ElggPlugin.php.

ElggPlugin::get ( name  ) 

Get a value from private settings.

Parameters:
string $name Name
Returns:
mixed

Reimplemented from ElggEntity.

Definition at line 870 of file ElggPlugin.php.

ElggPlugin::getAllSettings (  ) 

Returns an array of all settings saved for this plugin.

Note:
Unlike user settings, plugin settings are not namespaced.
Returns:
array An array of key/value pairs.

Definition at line 284 of file ElggPlugin.php.

ElggPlugin::getAllUserSettings ( user_guid = null  ) 

Returns an array of all user settings saved for this plugin for the user.

Note:
Plugin settings are saved with a prefix. This removes that prefix.
Parameters:
int $user_guid The user GUID. Defaults to logged in.
Returns:
array An array of key/value pairs.

Definition at line 398 of file ElggPlugin.php.

ElggPlugin::getAvailableTextFiles (  ) 

Returns an array of available markdown files for this plugin.

Returns:
array

Definition at line 160 of file ElggPlugin.php.

ElggPlugin::getError (  ) 

Returns the last error message registered.

Returns:
string|null

Definition at line 964 of file ElggPlugin.php.

ElggPlugin::getFriendlyName (  ) 

Returns the manifest's name if available, otherwise the ID.

Returns:
string
Since:
1.8.1

Definition at line 127 of file ElggPlugin.php.

ElggPlugin::getID (  ) 

Returns the ID (dir name) of this plugin.

Returns:
string

Definition at line 117 of file ElggPlugin.php.

ElggPlugin::getManifest (  ) 

Returns this plugin's ElggPluginManifest object.

Returns:
ElggPluginManifest

Definition at line 973 of file ElggPlugin.php.

ElggPlugin::getPackage (  ) 

Returns this plugin's ElggPluginPackage object.

Returns:
ElggPluginPackage

Definition at line 993 of file ElggPlugin.php.

ElggPlugin::getPath (  ) 

Returns the plugin's full path with trailing slash.

Returns:
string

Definition at line 141 of file ElggPlugin.php.

ElggPlugin::getPriority (  ) 

Gets the plugin's load priority.

Returns:
int

Definition at line 180 of file ElggPlugin.php.

ElggPlugin::getSetting ( name  ) 

Returns a plugin setting.

Parameters:
string $name The setting name
Returns:
mixed

Definition at line 273 of file ElggPlugin.php.

ElggPlugin::getUserSetting ( name,
user_guid = null 
)

Returns a user's setting for this plugin.

Parameters:
string $name The setting name
int $user_guid The user GUID
Returns:
mixed The setting string value or false

Definition at line 373 of file ElggPlugin.php.

ElggPlugin::includeFile ( filename  )  [protected]

Includes one of the plugins files.

Parameters:
string $filename The name of the file
Exceptions:
PluginException 
Returns:
mixed The return value of the included file (or 1 if there is none)

Definition at line 750 of file ElggPlugin.php.

ElggPlugin::initializeAttributes (  )  [protected]

Set subtype to 'plugin'.

Returns:
void

Reimplemented from ElggObject.

Definition at line 24 of file ElggPlugin.php.

ElggPlugin::isActive ( site_guid = null  ) 

Is this plugin active?

Parameters:
int $site_guid Optional site guid.
Returns:
bool

Definition at line 578 of file ElggPlugin.php.

ElggPlugin::isValid (  ) 

Returns if the plugin is complete, meaning has all required files and Elgg can read them and they make sense.

Returns:
bool

Definition at line 553 of file ElggPlugin.php.

ElggPlugin::registerClasses (  )  [protected]

Registers the plugin's classes.

Exceptions:
PluginException 
Returns:
true

Definition at line 847 of file ElggPlugin.php.

ElggPlugin::registerLanguages (  )  [protected]

Registers the plugin's languages.

Exceptions:
PluginException 
Returns:
true

Definition at line 823 of file ElggPlugin.php.

ElggPlugin::registerViews (  )  [protected]

Registers the plugin's views.

Exceptions:
PluginException 
Returns:
true

Definition at line 784 of file ElggPlugin.php.

ElggPlugin::save (  ) 

Save the plugin object.

Make sure required values exist.

See also:
ElggObject::save()
Returns:
bool

Reimplemented from ElggObject.

Definition at line 90 of file ElggPlugin.php.

ElggPlugin::set ( name,
value 
)

Save a value as private setting or attribute.

Attributes include title and description.

Parameters:
string $name Name
mixed $value Value
Returns:
bool

Reimplemented from ElggEntity.

Definition at line 906 of file ElggPlugin.php.

ElggPlugin::setID ( id  ) 

Sets the location of this plugin.

Parameters:
string $id The path to the plugin's dir.
Returns:
bool

Definition at line 151 of file ElggPlugin.php.

ElggPlugin::setPriority ( priority,
site_guid = null 
)

Sets the priority of the plugin.

Parameters:
mixed $priority The priority to set. One of +1, -1, first, last, or a number. If given a number, this will displace all plugins at that number and set their priorities +1
mixed $site_guid Optional site GUID.
Returns:
bool

Definition at line 194 of file ElggPlugin.php.

ElggPlugin::setSetting ( name,
value 
)

Set a plugin setting for the plugin.

Parameters:
string $name The name to set
string $value The value to set
Returns:
bool

Definition at line 325 of file ElggPlugin.php.

ElggPlugin::setUserSetting ( name,
value,
user_guid = null 
)

Sets a user setting for a plugin.

Parameters:
string $name The setting name
string $value The setting value
int $user_guid The user GUID
Returns:
mixed The new setting ID or false

Definition at line 448 of file ElggPlugin.php.

ElggPlugin::start ( flags  ) 

Start the plugin.

Parameters:
int $flags Start flags for the plugin. See the constants in lib/plugins.php for details.
Returns:
true
Exceptions:
PluginException 

Definition at line 711 of file ElggPlugin.php.

ElggPlugin::unsetAllSettings (  ) 

Removes all settings for this plugin.

Returns:
bool

Definition at line 351 of file ElggPlugin.php.

ElggPlugin::unsetAllUserSettings ( user_guid  ) 

Removes all User Settings for this plugin.

Use removeAllUsersSettings() to remove all user settings for all users. (Note the plural 'Users'.)

Parameters:
int $user_guid The user GUID to remove user settings.
Returns:
bool

Definition at line 513 of file ElggPlugin.php.

ElggPlugin::unsetAllUsersSettings (  ) 

Removes this plugin's user settings for all users.

Use removeAllUserSettings() if you just want to remove settings for a single user.

Returns:
bool

Definition at line 532 of file ElggPlugin.php.

ElggPlugin::unsetSetting ( name  ) 

Removes a plugin setting name and value.

Parameters:
string $name The setting name to remove
Returns:
bool

Definition at line 340 of file ElggPlugin.php.

ElggPlugin::unsetUserSetting ( name,
user_guid = null 
)

Removes a user setting name and value.

Parameters:
string $name The user setting name
int $user_guid The user GUID
Returns:
bool

Definition at line 485 of file ElggPlugin.php.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations
Generated on Tue May 21 00:01:20 2013 for Elgg by  doxygen 1.6.3