Elgg  Version 1.9
Elgg\Core Namespace Reference

Activate a plugin or plugins. More...

Detailed Description

Activate a plugin or plugins.

Elgg RSS output pageshell.

Used to show plugin user settings.

Displays an invalid plugin on the admin screen.

Displays a plugin on the admin screen.

Shows a table of plugin dependecies for ElggPlugin in $vars['plugin'].

Shows a list of contributors for ElggPlugin in $vars['plugin'].

A single element of a menu.

Plugin user settings.

Used to show plugin settings for both users and admins.

Elgg primary CSS view.

CSS typography.

CSS reset.

Navigation.

Page Layout.

Elgg icons.

Helpers CSS.

CSS grid.

CSS form/input elements.

Layout Object CSS.

CSS buttons.

Elgg Admin CSS.

Elgg plugin specific user settings.

Elgg administration plugin screen.

Elgg plugin settings.

Default widgets landing page.

Elgg upgrade script.

Elgg friends of page.

Elgg friends page.

Elgg collections of friends.

Elgg friends picker callback.

Elgg add a collection of friends.

Assembles and outputs the registration page.

Assembles and outputs a login page.

Assembles and outputs the forgotten password page.

Page for resetting a forgotten password.

Elgg RewriteTester.

Elgg Installer.

Bootstraps the Elgg engine.

Defines database credentials.

Elgg widgets library.

Elgg users Functions to manage multiple or single users in an Elgg install.

Elgg user settings functions.

Elgg upgrade library.

Elgg tags Functions for managing tags and tag clouds.

Elgg system log.

Elgg statistics library.

Elgg sites Functions to manage multiple or single sites in an Elgg install.

Elgg session management Functions to manage logins.

Elgg river.

Elgg relationships.

Private settings for entities Private settings provide metadata like storage of settings for plugins and users.

Elgg plugins library Contains functions for managing plugins.

Elgg Simple PAM library Contains functions for managing authentication.

Elgg page owner library Contains functions for managing page ownership and context.

Elgg page handler functions.

Notifications This file contains classes and functions which allow plugins to register and send notifications.

Adding a New Notification Event

Elgg navigation library Functions for managing menus and other navigational elements.

Elgg metastrngs Functions to manage object metastrings.

Elgg metadata Functions to manage entity metadata.

Elgg memcache support.

Elgg language module Functions to manage language and translations.

Parameter input functions.

Elgg Groups.

Elgg friends library.

Elgg filestore.

Elgg Entity Extender.

Procedural code for creating, loading, and modifying ElggEntity objects.

Bootstrapping and helper procedural code available for use in Elgg core and plugins.

Elgg database procedural code.

Elgg cron library.

Elgg configuration procedural code.

Elgg comments library.

Elgg cache Cache file interface for caching data.

Elgg autoloader Facilities for class/interface/trait autoloading.

Elgg admin functions.

Elgg Actions.

Functions for Elgg's access system for entities, metadata, and annotations.

Pages handler.

Export handler.

Cache handler.

Action handler.

A class representing an XML element for import.

SecurityException An Security Exception, throw when a Security Exception occurs.

RegistrationException Could not register a new user for whatever reason.

PluginException.

ODD Metadata class.

ODD Entity class.

This class is used during import and export to construct.

Open Data Definition (ODD) superclass.

Notification exception.

Calendar interface for events.

Login Exception Stub.

Interface that provides an interface which must be implemented by all objects wishing to be recorded in the system log (and by extension the river).

Define an interface for geo-tagging entities.

IOException An IO Exception, throw when an IO Exception occurs.

InvalidParameterException A parameter is invalid.

InvalidClassException An invalid class Exception, throw when a class is invalid.

InstallationException Thrown when there is a major problem with the installation.

IncompleteEntityException Thrown when constructing an entity that is missing its secondary entity table.

Import exception.

Define an interface for all ODD importable objects.

An interface for objects that behave as elements within a social network that have a profile.

Export exception.

Define an interface for all ODD exportable objects.

A parser for XML that uses SimpleXMLElement.

ElggWidget.

ElggVolatileMetadataCache In memory cache of known metadata values stored by entity.

ElggUser.

ElggStaticVariableCache Dummy cache which stores values in a static array.

Shared memory cache description.

Elgg Session Management.

River item class.

Relationship class.

Iterate over elements in a specific priority.

Manages plugin packages under mod.

Plugin manifest.xml parser for Elgg 1.8 and above.

Plugin manifest.xml parser for Elgg 1.7 and lower.

Parent class for manifest parsers.

Parses Elgg manifest.xml files.

Stores site-side plugin settings as private data.

ElggPAM Pluggable Authentication Module.

ElggMetadata.

Elgg Menu Item.

Elgg Menu Builder.

Memcache wrapper class.

Class representing a container for other elgg entities.

This class defines the interface for all elgg data repositories.

ElggFileCache Store cached data in a file store.

This class represents a physical file.

The base class for ElggEntity extenders.

The parent class for all Elgg Entities.

A filestore that uses disk as storage.

A generic class that contains shared code among ElggExtender, ElggEntity, and ElggRelationship.

ElggCrypto.

A simple object model for an HTTP cookie.

ElggComment.

ElggCache The elgg cache superclass.

DataModel

Create wrapper P and BR elements in HTML depending on newlines.

Upgrade service for Elgg.

Elgg Transliterate.

Delegates requests to controllers based on the registered configuration.

Queue interface.

FIFO queue that is memory based (not persistent)

FIFO queue that uses the database for persistence.

Internal component to detect and fix some whitespace issues.

Elgg_PersistentLoginService.

Notification container.

Notification event.

Based on Symfony2's SessionStorageInterface and AttributeBagInterface.

Session handler interface.

Based on Symfony2's ParameterBag.

Based on Symfony2's NativeSessionStorage.

Mock session handler.

Database session handler.

Determines if otherwise visible items should be hidden from a user due to group policy or visibility.

Service for Events.

Locate the relative path of an entity's data dir.

Missing value exception.

Factory uncallable exception.

Container holding values which can be resolved upon reading and optionally stored and shared across reads.

Wrap an object and display warnings whenever the object's variables are accessed or a method is used.

An object representing a single Elgg database.

Count queries performed.

A map of class names to absolute file paths.

A class/interface/trait autoloader for PHP.

Simplecache handler.

Least Recently Used Cache.

Manages core autoloading and caching of class maps.

Loads ElggEntity attributes from DB or validates those passed in via constructor.

Control configuration of RequireJS.

WARNING: API IN FLUX.

Class used to determine if access is being ignored.

Data format exception An exception thrown when there is a problem in the format of some data.

Database Exception.

Class not found.

Class Exception.

Call Exception Stub.

Stub info for $CONFIG global options.

Upgrade default widgets for Elgg 1.8.

Elgg save widget settings action.

Elgg widget move action.

Elgg widget delete action.

Elgg widget add action.

Aggregate action for saving settings.

Action to request a new password.

Elgg registration action.

Saves user-specific plugin settings.

Saves global plugin settings.

Elgg login action.

Elgg remove friend action.

Friends collection edit action.

Elgg friends: delete collection action.

Elgg collection add page.

Elgg add friend action.

Action for adding and editing comments.

Delete comment entity.

Unbans a user.

Reset a user's password.

Revokes admin privileges from a user.

Grants admin privileges to a user.

Delete a user.

Bans a user.

Updates the basic settings for the primary site object.

Updates the advanced settings for the primary site object.

Changes the load priority of a plugin.

Disable all specified installed plugins.

Deactivate a plugin or plugins.

Activates all specified installed and inactive plugins.

Plugins to be activated are passed via $_REQUEST['plugin_guids'] as GUIDs. After activating the plugin(s), the views cache and simplecache are invalidated.

mixed $_GET['plugin_guids'] The GUIDs of the plugin to activate. Can be an array.

Administration.Plugins

All specified plugins in the mod/ directory that aren't active are activated and the views cache and simplecache are invalidated.

Administration.Plugins

Plugins to be deactivated are passed via $_REQUEST['plugin_guids'] as GUIDs. After deactivating the plugin(s), the views cache and simplecache are invalidated.

mixed $_GET['plugin_guids'] The GUIDs of the plugin to deactivate. Can be an array.

Administration.Plugins

Specified plugins in the mod/ directory are disabled and the views cache and simplecache are reset.

Administration.Plugins

Plugin priority affects view, action, and page handler overriding as well as the order of view extensions. Plugins with higher priority are loaded after and override plugins with lower priorities.

NOTE: When viewing the plugin admin page, plugins LOWER on the page have HIGHER priority and will override views, etc from plugins above them.

Administration.Plugins

Options are saved among metadata on the site object, entries in the datalist table, and entries in the config table.

Administration.Site

Basic site settings are saved as metadata on the site object, with the exception of the default language, which is saved in the config table.

Administration.Site

User entities are banned by setting the 'banned' column to 'yes' in the users_entity table.

Administration.User

The user will be deleted recursively, meaning all entities owned or contained by the user will also be removed.

Administration.User

In >=1.7.1, admin is flagged by setting the admin column in the users_entity table.

In <1.7.1, admin is a piece of metadata on the user object.

Administration.User

Administration.User

This is an admin action that generates a new salt and password for a user, then emails the password to the user's registered email address.

NOTE: This is different to the "reset password" link users can use in that it does not first email the user asking if they want to have their password reset.

Administration.User

Comments

Friends.Management

Friends.Collections

User.Authentication

This action can be overriden for a specific plugin by creating the <plugin_id>/settings/save action in that plugin.

array $_REQUEST['params'] A set of key/value pairs to save to the ElggPlugin entity int $_REQUEST['plugin_id'] The ID of the plugin

Plugins.Settings

This action can be overriden for a specific plugin by creating the <plugin_id>/usersettings/save action in that plugin.

array $_REQUEST['params'] A set of key/value pairs to save to the ElggPlugin entity int $_REQUEST['plugin_id'] The id of the plugin int $_REQUEST['user_guid'] The GUID of the user to save settings for.

Plugins.Settings

User.Account

UserSettings

Widgets.Management

Widgets.Management

int $_REQUEST['guid'] The guid of the widget to save array $_REQUEST['params'] An array of params to set on the widget. int $_REQUEST['default_widgets'] Flag for if these settings are for default wigets. string $_REQUEST['context'] An optional context of the widget. Used to return the correct output if widget content changes depending on context. string $_REQUEST['title'] Optional title for the widget

Pre-1.8, default widgets were stored as metadata on a defaultwidgets object. Now they are stored as widget objects owned by the site.

Widgets.Management

Plugins should never use the $CONFIG array directly.

Configuration

Generic parent class for Call exceptions

Exceptions.Stub

A generic parent class for Class exceptions

Exceptions.Stub

Thrown when trying to load a class that doesn't exist.

Exceptions

A generic parent class for database exceptions

Exceptions.Stub

Exceptions.Stub

Access private

See also
elgg_get_ignore_access()

DO NOT USE DIRECTLY.

Use the elgg_* versions instead.

private

Actions

Since
1.9.0

private

JavaScript

DO NOT USE DIRECTLY.

This filter adds AMD names to anonymous AMD modules defined in views.

JavaScript

Since
1.9

private

private

DataModel

private

Autoloader

A fixed sized cache that removes the element used last when it reaches its size limit.

Based on https://github.com/cash/LRUCache

private

Cache

private

It is able to load classes that use either:

Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be looked for in a list of locations to ease the vendoring of a sub-set of classes for large projects.

All discovered files are stored in the internal class map and the map is queried before attempting to find a file.

Contains code from Symfony2's UniversalClassLoader.

Copyright (c) 2004-2013 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

private

Autoloader

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

DO NOT USE DIRECTLY.

private

Database

Since
1.9.0

Do not use directly. Use _elgg_db_get_query_counter().

private

Database

Since
1.9.0

WARNING: THIS API IS IN FLUX. PLUGIN AUTHORS SHOULD NOT USE. See lib/database.php instead.

private

Database

It can also be used to wrap a string.

Note that the wrapper will not share the type of the wrapped object and will fail type hints, instanceof, etc.

This was introduced for deprecating passing particular variabled to views automatically in elgg_view(). It also used to wrap the deprecated global $SESSION. It can be removed once that use is no longer required.

Wraps: url string in ViewsService config object in ViewsService user object in ViewsService session object in session lib

private

$c = new Elgg_Di_DiContainer();

$c->setFactory('foo', 'Foo_factory'); // $c will be passed to Foo_factory() $c->foo; // new Foo instance $c->foo; // same instance

$c->setFactory('bar', 'Bar_factory', false); // non-shared $c->bar; // new Bar instance $c->bar; // different Bar instance

$c->setValue('a_string', 'foo_factory'); // don't call this $c->a_string; // 'foo_factory'

private

Since
1.9

This returns paths like: '1/27/'.

Note
This class does not require the Elgg engine to be loaded and is suitable for being used directly.

private

private

Hooks

Since
1.9.0

Groups

private

DO NOT USE DIRECTLY.

Use the elgg_* versions instead.

private

Hooks

Since
1.9.0

private

Http

Copyright (c) 2004-2013 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Mock for unit tests.

private

Http

Copyright (c) 2004-2013 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PHP Session Storage

private

Http

Copyright (c) 2004-2013 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Container for key/values

private

Http

DO NOT USE DIRECTLY.

Represents an HTTP request.

This will likely be replaced by Symfony's Request class from HttpFoundation in the future.

Some methods were pulled from Symfony. They are Copyright (c) 2004-2013 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Http

Since
1.9.0 private

Use SessionHandlerInterface when minimum PHP version becomes 5.4

private

Http

Copyright (c) 2004-2013 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Interface for session storage

private

Http

DO NOT USE DIRECTLY.

Use the elgg_* versions instead.

private

Logging

Since
1.9.0

Notifications

Since
1.9.0

DO NOT USE DIRECTLY.

private

Notifications

Since
1.9.0

If a user selects a persistent login, a long, random token is generated and stored in the cookie called "elggperm", and a hash of the token is stored in the DB. If the user's PHP session expires, the session boot sequence will try to log the user in via the token in the cookie.

Before Elgg 1.9, the token hashes were stored as "code" in the users_entity table.

In Elgg 1.9, the token hashes are stored as "code" in the users_remember_me_cookies table, allowing multiple browsers to maintain persistent logins.

Legacy notes: This feature used to be called "remember me"; confusingly, both the tokens and the hashes were called "codes"; old tokens were hexadecimal and lower entropy; new tokens are base64 URL and always begin with the letter "z"; the boot sequence replaces old tokens whenever possible.

private

private

Project

WARNING: API IN FLUX. DO NOT USE DIRECTLY.

private

Queue

Since
1.9.0

Plugin devs should use these wrapper functions:

Router

Since
1.9.0 private

For creating "friendly titles" for URLs

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software consists of voluntary contributions made by many individuals and is licensed under the LGPL. For more information, see http://www.doctrine-project.org.

Author
Konsta Vesterinen kvest.nosp@m.eri@.nosp@m.cc.hu.nosp@m.t.fi
Jonathan H. Wage jonwa.nosp@m.ge@g.nosp@m.mail..nosp@m.com
Steve Clay steve.nosp@m.@mrc.nosp@m.lay.o.nosp@m.rg

private Plugin authors should not use this directly

This is a straight port of the procedural code used for upgrading before Elgg 1.9.

private

Upgrade

DO NOT USE DIRECTLY.

Use the elgg_* versions instead.

private

Views

Since
1.9.0

DO NOT USE DIRECTLY.

Use the elgg_* versions instead.

private

Widgets

Since
1.9.0

Useful when users use newlines to signal line and paragraph breaks. In all cases output should be well-formed markup.

In DIV elements, Ps are only added when there would be at least two of them.

Output

Since
1.8

This defines the interface for a cache (wherever that cache is stored).

Cache

Comments

Since
1.9.0

Http

See also
elgg_set_cookie()
http://php.net/manual/en/function.setcookie.php
http://php.net/manual/en/function.session-set-cookie-params.php
Since
1.9.0

Crypto

private

Warning
This should be used by a wrapper class like ElggFile.

FileStore.Disk

An ElggEntity is one of the basic data models in Elgg. It is the primary means of storing and retrieving data from the database. An ElggEntity represents one row of the entities table.

The ElggEntity class handles CRUD operations for the entities table. ElggEntity should always be extended by another class to handle CRUD operations on the type-specific table.

ElggEntity uses magic methods for get and set, so any property that isn't declared will be assumed to be metadata and written to the database as metadata on the object. All children classes must declare which properties are columns of the type table or they will be assumed to be metadata. See ElggObject::initializeAttributes() for examples.

Core supports 4 types of entities: ElggObject, ElggUser, ElggGroup, and ElggSite.

Plugin authors will want to extend the ElggObject class, not this class.

DataModel.Entities

Extenders allow you to attach extended information to an ElggEntity. Core supports two: ElggAnnotation and ElggMetadata.

Saving the extender data to database is handled by the child class.

DataModel.Extender

See also
ElggAnnotation
ElggMetadata

Create a new ElggFile object and specify a filename, and optionally a FileStore (if one isn't specified then the default is assumed.)

Open the file using the appropriate mode, and you will be able to read and write to the file.

Optionally, you can also call the file's save() method, this will turn the file into an entity in the system and permit you to do things like attach tags to the file. If you do not save the file, no entity is created in the database. This is because there are occasions when you may want access to file data on datastores using the ElggFile interface without a need to persist information such as temporary files.

DataModel.File

Caches

DataStorage

Groups

Memcache

Navigation

Since
1.8.0

To create a menu item that is not a link, pass false for $href.

Any undocumented properties set will be passed to the output/url view during rendering. E.g. to give a menu item a "target" attribute, set $item->target, or include a "target" key in the options array for factory().

Navigation

Since
1.8.0

This class describes metadata that can be attached to an ElggEntity. It is rare that a plugin developer needs to use this API for metadata. Almost all interaction with metadata occurs through the methods of ElggEntity. See its __set(), __get(), and setMetadata() methods.

Metadata

Authentication

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

Plugins.Settings

Normalizes the values from the ElggManifestParser object.

This requires an ElggPluginManifestParser class implementation as $this->parser.

To add new parser versions, name them ElggPluginManifestParserXX where XX is the version specified in the top-level <plugin_manifest> tag's XML namespace.

Plugins

Since
1.8

Converts manifest.xml files or strings to an array.

This should be extended by a class that does the actual work to convert based on the manifest.xml version.

This class only parses XML to an XmlEntity object and an array. The array should be used primarily to extract information since it is quicker to parse once and store values from the ElggXmlElement object than to parse the object each time.

The array should be an exact representation of the manifest.xml file or string. Any normalization needs to be done in the calling class / function.

Plugins

Since
1.8

Plugins

Since
1.8

Around 1.9 or so we should each plugin over to using ElggPlugin and merge ElggPluginPackage and ElggPlugin.

Plugins

Since
1.8

$pl = new ElggPriorityList(); $pl->add('Element 0'); $pl->add('Element 10', 10); $pl->add('Element -10', -10);

foreach ($pl as $priority => $element) { var_dump("$priority => $element"); }

Yields: -10 => Element -10 0 => Element 0 10 => Element 10

Collisions on priority are handled by inserting the element at or as close to the requested priority as possible:

$pl = new ElggPriorityList(); $pl->add('Element 5', 5); $pl->add('Colliding element 5', 5); $pl->add('Another colliding element 5', 5);

foreach ($pl as $priority => $element) { var_dump("$priority => $element"); }

Yields: 5 => 'Element 5', 6 => 'Colliding element 5', 7 => 'Another colliding element 5'

You can do priority lookups by element:

$pl = new ElggPriorityList(); $pl->add('Element 0'); $pl->add('Element -5', -5); $pl->add('Element 10', 10); $pl->add('Element -10', -10);

$priority = $pl->getPriority('Element -5');

Or element lookups by priority. $element = $pl->getElement(-5);

To remove elements, pass the element. $pl->remove('Element -10');

To check if an element exists: $pl->contains('Element -5');

To move an element: $pl->move('Element -5', -3);

ElggPriorityList only tracks priority. No checking is done in ElggPriorityList for duplicates or updating. If you need to track this use objects and an external map:

function elgg_register_something($id, $display_name, $location, $priority = 500) { // $id => $element. static $map = array(); static $list;

if (!$list) { $list = new ElggPriorityList(); }

// update if already registered. if (isset($map[$id])) { $element = $map[$id]; // move it first because we have to pass the original element. if (!$list->move($element, $priority)) { return false; } $element->display_name = $display_name; $element->location = $location; } else { $element = new stdClass(); $element->display_name = $display_name; $element->location = $location; if (!$list->add($element, $priority)) { return false; } $map[$id] = $element; }

return true; }

Helpers

Core

Reserved keys: last_forward_from, msg, sticky_forms, user, guid, id, code, name, username Deprecated keys: user, id, name, username

ArrayAccess was deprecated in Elgg 1.9. This means you should use $session->get('foo') rather than $session['foo']. Warning: You can not access multidimensional arrays through ArrayAccess like this $session['foo']['bar']

Session

See also
elgg_get_session()

Extends ElggCache with functions useful to shared memory style caches (static variables, memcache etc)

Cache

Using this makes future replacements to other caching back ends (eg memcache) much easier.

Cache

Representation of a "user" in the system.

DataModel.User

Cache

private

Stores metadata in private settings rather than as ElggMetadata

Widgets

XML

ODD

Exception

SocialModel.Friendable

DataModel.Importable

Exception

Exception private

Exception

Subclass for specific IO Exceptions.

Exception

SocialModel.Locatable

This interface defines a set of methods that permit the system log functions to hook in and retrieve the necessary information and to identify what events can actually be logged.

To have events involving your object to be logged simply implement this interface.

DataModel.Loggable

Generic parent class for login exceptions.

Exceptions.Stub

DataModel.Notable

ODD

ODD

ODD

ODD

A plugin Exception, thrown when an Exception occurs relating to the plugin mechanism. Subclass for specific plugin Exceptions.

Exception

Exceptions

Subclass for specific Security Execeptions (access problems etc)

Exception

XML

This file dispatches actions. It is called via a URL rewrite in .htaccess from http://site/action/. Anything after 'action/' is considered the action and will be passed to action().

Warning
This sets the input named 'action' to the current action. When calling an action, get_input('action') will always return the action name.

Actions

External access to cached CSS and JavaScript views. The cached file URLS should be of the form: cache/<ts>/<viewtype>/<name/of/view> where ts is an identifier that is updated every time the cache is flushed. The simplest way to maintain a unique identifier is to use the lastcache timestamp in Elgg's config object.

See also
elgg_register_simplecache_view()

Cache

Export

This file dispatches pages. It is called via a URL rewrite in .htaccess from http://site/handler/page1/page2. The first element after site/ is the page handler name as registered by elgg_register_page_handler(). The rest of the string is sent to page_handler().

Note that the following handler names are reserved by elgg and should not be registered by any plugins:

These additionally are reserved for the xml-rpc plugin

page_handler() explodes the pages string by / and sends it to the page handler function as registered by elgg_register_page_handler(). If a valid page handler isn't found, plugins have a chance to provide a 404.

PageHandler

Access is generally saved in the database as access_id. This corresponds to one of the ACCESS_* constants defined in elgglib.php or the ID of an access collection.

Access

See also
http://learn.elgg.org/en/latest/guides/actions.html

Actions

Admin menu items Elgg has a convenience function for adding menu items to the sidebar of the admin area.

See also
elgg_register_admin_menu_item()

Admin pages Plugins no not need to provide their own page handler to add a page to the admin area. A view placed at admin/<section>/<subsection> can be access at http://example.org/admin/<section>/<subsection>. The title of the page will be elgg_echo('admin:<section>:<subsection>'). For an example of how to add a page to the admin area, see the diagnostics plugin.

Admin notices System messages (success and error messages) are used in both the main site and the admin area. There is a special presistent message for the admin area called an admin notice. It should be used when a plugin requires an administrator to take an action. An example is the categories plugin requesting that the administrator set site categories after the plugin has been activated.

See also
elgg_add_admin_notice()

Admin

Autoloader

Cache

Comments

Since
1.9

Includes functions for manipulating the configuration values stored in the database Plugin authors should use the elgg_get_config(), elgg_set_config(), elgg_save_config(), and {()} functions to access or update config values.

Elgg's configuration is split among 2 tables and 1 file:

Upon system boot, all values in dbprefix_config are read into $CONFIG.

Configuration

Cron

Includes functions for reading data, writing data, and escaping queries.

Database

DataModel.Entities

This file contains ways of extending an Elgg entity in custom ways.

DataModel.Extender

This file contains functions for saving and retrieving data from files.

DataModel.FileStorage

Provides the UI for friends. Includes access collections since they are based on friends relationships.

Friends

Groups contain other entities, or rather act as a placeholder for other entities to mark any given container as their container.

DataModel.Group

This file contains functions for getting input from get/post variables.

Input

Languages

Requires php5-memcache to work.

Cache.Memcache

DataModel.Metadata

DataModel.MetaStrings

Breadcrumbs Elgg uses a breadcrumb stack. The page handlers (controllers in MVC terms) push the breadcrumb links onto the stack.

See also
elgg_push_breadcrumb()

Pagination Automatically handled by Elgg when using elgg_list_entities* functions.

See also
elgg_list_entities()

Tabs

See also
navigation/tabs view

Menus Elgg uses a single interface to manage its menus. Menu items are added with elgg_register_menu_item(). This is generally used for menus that appear only once per page. For dynamic menus (such as the hover menu for user's avatar), a plugin hook is emitted when the menu is being created. The hook is 'register', 'menu:<menu_name>'. For more details on this,

See also
elgg_view_menu().

Menus supported by the Elgg core Standard menus: site Site navigation shown on every page. page Page menu usually shown in a sidebar. Uses Elgg's context. topbar Topbar menu shown on every page. The default has two sections. footer Like the topbar but in the footer. extras Links about content on the page. The RSS link is added to this.

Dynamic menus (also called just-in-time menus): user_hover Avatar hover menu. The user entity is passed as a parameter. entity The set of links shown in the summary of an entity. river Links shown on river items. owner_block Links shown for a user or group in their owner block. filter The tab filter for content (all, mine, friends) title The buttons shown next to a content title. longtext The links shown above the input/longtext view. login Menu of links at bottom of login box

Navigation

  1. Register the event with elgg_register_notification_event()
  2. Register for the notification message plugin hook: 'prepare', 'notification:[event name]'. The event name is of the form [action]:[type]:[subtype]. For example, the publish event for a blog would be named 'publish:object:blog'.

    The parameter array for the plugin hook has the keys 'event', 'method', 'recipient', and 'language'. The event is an Elgg_Notifications_Event object and can provide access to the original object of the event through the method getObject() and the original actor through getActor().

    The plugin hook callback modifies and returns a Elgg_Notifications_Notification object that holds the message content.

Adding a Delivery Method

  1. Register the delivery method name with elgg_register_notification_method()
  2. Register for the plugin hook for sending notifications: 'send', 'notification:[method name]'. It receives the notification object of the class Elgg_Notifications_Notification in the params array with the key 'notification'. The callback should return a boolean to indicate whether the message was sent.

Subscribing a User for Notifications

Users subscribe to receive notifications based on container and delivery method.

Notifications

There are notification methods which are provided out of the box (see notification_init() ). Each method is identified by a string, e.g. "email".

To register an event use register_notification_handler() and pass the method name and a handler function.

To send a notification call notify() passing it the method you wish to use combined with a number of method specific addressing parameters.

Catch NotificationException to trap errors.

Notifications

Routing

PageOwner

This is not a full implementation of PAM. It supports a single facility (authentication) and allows multiple policies (user authentication is the default). There are two control flags possible for each module: sufficient or required. The entire chain for a policy is processed (or until a required module fails). A module fails by returning false or throwing an exception. The order that modules are processed is determined by the order they are registered. For an example of a PAM, see pam_auth_userpass() in sessions.php.

For more information on PAMs see: http://www.freebsd.org/doc/en/articles/pam/index.html

See also
ElggPAM

Authentication.PAM

Plugins

PrivateSettings

DataModel.Relationship

Activity stream functions.

River

Session

DataModel.Site

This file contains a number of functions for obtaining statistics about the running system. These statistics are mainly used by the administration pages, and is also where the basic views for statistics are added.

Statistics

Listens to events and writes crud events into the system log database.

Logging

Tags

Contains code for handling versioning and upgrades.

Upgrade

Functions for adding and manipulating options on the user settings panel.

Settings.User

DataModel.User

Contains code for handling widgets.

Widgets

Most of Elgg's configuration is stored in the database. This file contains the credentials to connect to the database, as well as a few optional configuration values.

The Elgg installation attempts to populate this file with the correct settings and then rename it to settings.php.

This file loads the full Elgg engine, checks the installation state, and triggers a series of events to finish booting Elgg:

If Elgg is fully uninstalled, the browser will be redirected to an installation page.

See also
install.php

Core

Controller for installing Elgg. Supports both web-based on CLI installation.

This controller steps the user through the install process. The method for each step handles both the GET and POST requests. There is no XSS/CSRF protection on the POST processing since the installer is only run once by the administrator.

The installation process can be resumed by hitting the first page. The installer will try to figure out where to pick up again.

All the logic for the installation process is in this class, but it depends on the core libraries. To do this, we selectively load a subset of the core libraries for the first few steps and then load the entire engine once the database and site settings are configured. In addition, this controller does its own session handling until the database is setup.

There is an aborted attempt in the code at creating the data directory for users as a subdirectory of Elgg's root. The idea was to protect this directory through a .htaccess file. The problem is that a malicious user can upload a .htaccess of his own that overrides the protection for his user directory. The best solution is server level configuration that turns off AllowOverride for the data directory. See ticket #3453 for discussion on this.

Installer

Test if URL rewriting is working.

Installer

Registration

This page serves as a fallback for non-JS users who click on the login drop down link.

If the user is logged in, this page will forward to the front page.

Accounts

Since 1.8, registration can be disabled via administration. If this is the case, calls to this page will forward to the network front page.

If the user is logged in, this page will forward to the network front page.

Registration

Social.Collections

Social.Friends

This script triggers any necessary upgrades. If the site has been upgraded to the most recent version of the code, no upgrades are run and the caches are flushed. If you would prefer that this script is not accessible to others after an upgrade, you can delete it. Future versions of Elgg will include a new version of the script. Deleting the script is not a requirement and leaving it behind does not affect the security of the site.

Upgrades use a table {db_prefix}upgrade_lock as a mutex to prevent concurrent upgrades.

The URL to forward to after upgrades are complete can be specified by setting $_GET['forward'] to a relative URL.

Upgrade

Administration.DefaultWidgets

ElggPlugin $vars['plugin'] The plugin object to display settings for.

Plugins.Settings

Shows a list of plugins that can be sorted and filtered.

Admin.Plugins

array $vars['installed_plugins'] An array of plugins as returned by elgg_get_plugins()

Plugins.Settings

This is a distinct theme from the theme of the site. There are dependencies on the HTML created by the views in Elgg core.

UI

UI

Image blocks, lists, tables, gallery, messages

UI

UI

To work around subpixel rounding discrepancies, apply .elgg-col-last to the last column

Contains generic elements that can be used throughout the site.

UI

Contains CSS for the page shell and page layout

Default layout: 990px wide, centered. Used in default page shell

UI

Calls the plugin admin settings form body with type set to 'user'

Plugins

Navigation

$vars['item'] ElggMenuItem $vars['item_class'] Additional CSS class for the menu item

Admin.Plugins

This uses a table because it's a table of data.

Admin.Plugins

This file renders a plugin for the admin screen, including active/deactive, manifest details & display plugin settings.

$vars['entity'] $vars['display_reordering'] Do we display the priority reordering links?

Plugins

An invalid plugin is a plugin whose isValid() method returns false. This usually means there are required files missing, unreadable or in the wrong format.

Plugins

$vars['title'] The title of the RSS feed $vars['body'] The items for the RSS feed as a string $vars['descrption'] The description for the RSS feed