Overview

Packages

  • ClipIt
    • clipit
      • api
    • urjc
      • backend
  • Elgg
    • Core
      • Access
      • Authentication
      • Cache
      • Caches
      • Core
      • DataMode
        • Site
      • DataModel
        • Annotations
        • Entities
        • Extender
        • File
        • Importable
        • Loggable
        • Notable
        • Object
        • User
      • DataStorage
      • Exception
      • Exceptions
        • Stub
      • FileStore
        • Disk
      • Groups
      • Helpers
      • HMAC
      • Memcache
      • Metadata
      • Navigation
      • ODD
      • Output
      • Plugins
        • Settings
      • Sessions
      • SocialModel
        • Friendable
        • Locatable
      • WebServicesAPI
      • Widgets
      • XML
      • XMLRPC
    • Exceptions
      • Stub
  • None
  • PHP

Classes

  • ElggPlugin
  • Overview
  • Package
  • Class
  • Tree

Class ElggPlugin

Stores site-side plugin settings as private data.

This class is currently a stub, allowing a plugin to save settings in an object's private settings for each site.

ElggData implements Loggable, Iterator, ArrayAccess, Exportable
Extended by ElggEntity implements Notable, Locatable, Importable
Extended by ElggObject
Extended by ElggPlugin
Package: Elgg\Core\Plugins\Settings
Located at ElggPlugin.php
Methods summary
protected
# initializeAttributes( )

Set subtype to 'plugin'

Set subtype to 'plugin'

Overrides

ElggObject::initializeAttributes()
public
# __construct( mixed $plugin )

Loads the plugin by GUID or path.

Loads the plugin by GUID or path.

Parameters

$plugin
mixed
$plugin The GUID of the ElggPlugin object or the path of the plugin to load.

Throws

PluginException

Warning

Unlike other ElggEntity objects, you cannot null instantiate ElggPlugin. You must point it to an actual plugin GUID or location.

Overrides

ElggObject::__construct()
public boolean
# save( )

Save the plugin object. Make sure required values exist.

Save the plugin object. Make sure required values exist.

Returns

boolean

Throws

IOException

See

ElggObject::save()

Overrides

ElggObject::save()
public string
# getID( )

Returns the ID (dir name) of this plugin

Returns the ID (dir name) of this plugin

Returns

string
public string
# getFriendlyName( )

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

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

Returns

string

Since

1.8.1
public string
# getPath( )

Returns the plugin's full path with trailing slash.

Returns the plugin's full path with trailing slash.

Returns

string
public boolean
# setID( string $id )

Sets the location of this plugin.

Sets the location of this plugin.

Parameters

$id
string
$id The path to the plugin's dir.

Returns

boolean
public array
# getAvailableTextFiles( )

Returns an array of available markdown files for this plugin

Returns an array of available markdown files for this plugin

Returns

array
public integer
# getPriority( )

Gets the plugin's load priority.

Gets the plugin's load priority.

Returns

integer
public boolean
# setPriority( mixed $priority, mixed $site_guid = null )

Sets the priority of the plugin

Sets the priority of the plugin

Parameters

$priority
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
$site_guid
mixed
$site_guid Optional site GUID.

Returns

boolean
public mixed
# getSetting( string $name )

Returns a plugin setting

Returns a plugin setting

Parameters

$name
string
$name The setting name

Returns

mixed
public array
# getAllSettings( )

Returns an array of all settings saved for this plugin.

Returns an array of all settings saved for this plugin.

Returns

array
An array of key/value pairs.

Note

Unlike user settings, plugin settings are not namespaced.
public boolean
# setSetting( string $name, string $value )

Set a plugin setting for the plugin

Set a plugin setting for the plugin

Parameters

$name
string
$name The name to set
$value
string
$value The value to set

Returns

boolean
public boolean
# unsetSetting( string $name )

Removes a plugin setting name and value.

Removes a plugin setting name and value.

Parameters

$name
string
$name The setting name to remove

Returns

boolean
public boolean
# unsetAllSettings( )

Removes all settings for this plugin.

Removes all settings for this plugin.

Returns

boolean
public mixed
# getUserSetting( string $name, integer $user_guid = null )

Returns a user's setting for this plugin

Returns a user's setting for this plugin

Parameters

$name
string
$name The setting name
$user_guid
integer
$user_guid The user GUID

Returns

mixed
The setting string value or false
public array
# getAllUserSettings( integer $user_guid = null )

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

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

Parameters

$user_guid
integer
$user_guid The user GUID. Defaults to logged in.

Returns

array
An array of key/value pairs.

Note

Plugin settings are saved with a prefix. This removes that prefix.
public mixed
# setUserSetting( string $name, string $value, integer $user_guid = null )

Sets a user setting for a plugin

Sets a user setting for a plugin

Parameters

$name
string
$name The setting name
$value
string
$value The setting value
$user_guid
integer
$user_guid The user GUID

Returns

mixed
The new setting ID or false
public boolean
# unsetUserSetting( string $name, integer $user_guid = null )

Removes a user setting name and value.

Removes a user setting name and value.

Parameters

$name
string
$name The user setting name
$user_guid
integer
$user_guid The user GUID

Returns

boolean
public boolean
# unsetAllUserSettings( integer $user_guid )

Removes all User Settings for this plugin

Removes all User Settings for this plugin

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

Parameters

$user_guid
integer
$user_guid The user GUID to remove user settings.

Returns

boolean
public boolean
# unsetAllUsersSettings( )

Removes this plugin's user settings for all users.

Removes this plugin's user settings for all users.

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

Returns

boolean
public boolean
# isValid( )

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

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

Returns

boolean
public boolean
# isActive( integer $site_guid = null )

Is this plugin active?

Is this plugin active?

Parameters

$site_guid
integer
$site_guid Optional site guid.

Returns

boolean
public boolean
# canActivate( mixed $site_guid = null )

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

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

Parameters

$site_guid
mixed
$site_guid Optional site guid

Returns

boolean
public boolean
# activate( mixed $site_guid = null )

Actives the plugin for the current site.

Actives the plugin for the current site.

Parameters

$site_guid
mixed
$site_guid Optional site GUID.

Returns

boolean
public boolean
# deactivate( mixed $site_guid = null )

Deactivates the plugin.

Deactivates the plugin.

Parameters

$site_guid
mixed
$site_guid Optional site GUID.

Returns

boolean
public true
# start( integer $flags )

Start the plugin.

Start the plugin.

Parameters

$flags
integer
$flags Start flags for the plugin. See the constants in lib/plugins.php for details.

Returns

true

Throws

PluginException
protected mixed
# includeFile( string $filename )

Includes one of the plugins files

Includes one of the plugins files

Parameters

$filename
string
$filename The name of the file

Returns

mixed
The return value of the included file (or 1 if there is none)

Throws

PluginException
protected boolean
# canReadFile( string $filename )

Checks whether a plugin file with the given name exists

Checks whether a plugin file with the given name exists

Parameters

$filename
string
$filename The name of the file

Returns

boolean
protected true
# registerViews( )

Registers the plugin's views

Registers the plugin's views

Returns

true

Throws

PluginException
protected true
# registerLanguages( )

Registers the plugin's languages

Registers the plugin's languages

Returns

true

Throws

PluginException
protected true
# registerClasses( )

Registers the plugin's classes

Registers the plugin's classes

Returns

true

Throws

PluginException
public mixed
# get( string $name )

Get a value from private settings.

Get a value from private settings.

Parameters

$name
string
$name Name

Returns

mixed

Overrides

ElggEntity::get()
public boolean
# set( string $name, mixed $value )

Save a value as private setting or attribute.

Save a value as private setting or attribute.

Attributes include title and description.

Parameters

$name
string
$name Name
$value
mixed
$value Value

Returns

boolean

Overrides

ElggEntity::set()
public string|null
# getError( )

Returns the last error message registered.

Returns the last error message registered.

Returns

string|null
public ElggPluginManifest
# getManifest( )

Returns this plugin's ElggPluginManifest object

Returns this plugin's ElggPluginManifest object

Returns

ElggPluginManifest
public ElggPluginPackage
# getPackage( )

Returns this plugin's ElggPluginPackage object

Returns this plugin's ElggPluginPackage object

Returns

ElggPluginPackage
Methods inherited from ElggObject
addToSite(), canComment(), getExportableValues(), getSites(), load()
Methods inherited from ElggEntity
__clone(), __unset(), addRelationship(), annotate(), canAnnotate(), canEdit(), canEditMetadata(), canWriteToContainer(), countAnnotations(), countComments(), countEntitiesFromRelationship(), delete(), deleteAnnotations(), deleteMetadata(), deleteOwnedAnnotations(), deleteOwnedMetadata(), deleteRelationships(), disable(), disableAnnotations(), disableMetadata(), enable(), enableAnnotations(), enableMetadata(), export(), getAccessID(), getAnnotations(), getAnnotationsAvg(), getAnnotationsMax(), getAnnotationsMin(), getAnnotationsSum(), getCalendarEndTime(), getCalendarStartTime(), getContainerEntity(), getContainerGUID(), getEntitiesFromRelationship(), getGUID(), getIconURL(), getLatitude(), getLocation(), getLongitude(), getMetaData(), getObjectFromID(), getOwnerEntity(), getOwnerGUID(), getPrivateSetting(), getSubtype(), getSystemLogID(), getTags(), getTimeUpdated(), getType(), getURL(), getVolatileData(), import(), isEnabled(), isFullyLoaded(), removePrivateSetting(), removeRelationship(), setCalendarTimeAndDuration(), setContainerGUID(), setLatLong(), setLocation(), setMetaData(), setPrivateSetting(), setURL(), setVolatileData()
Methods inherited from ElggData
__get(), __isset(), __set(), current(), getClassName(), getTimeCreated(), key(), next(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), rewind(), valid()
Properties inherited from ElggEntity
$icon_override, $temp_annotations, $temp_metadata, $temp_private_settings, $url_override, $volatile
Properties inherited from ElggData
$attributes, $valid
Magic properties inherited from ElggObject
$description, $tags, $title
Magic properties inherited from ElggEntity
$access_id, $container_guid, $enabled, $guid, $owner_guid, $site_guid, $subtype, $time_created, $time_updated, $type
API documentation generated by ApiGen 2.8.0