API

This class is a major part of SnowCMS, it allows plugins (or flakes) to use hooks in various places which allow the plugins to add new features, or change how current features work as well.

Summary
APIThis class is a major part of SnowCMS, it allows plugins (or flakes) to use hooks in various places which allow the plugins to add new features, or change how current features work as well.
Variables
hooksContains all the registered hooks to the specified actions.
filtersContains all the registered filters to the specified tags.
countKeeps track of how many hooks and filters are registered.
eventsAll query string events are kept here.
groupsAll the registered groups reside here.
menu
classesHolds registered classes, which are not located within the core directory.
objects
pluginsCurrently enabled plugins are held in this array.
resourcesA resource is something such as an image, style sheet, or anything, really.
contextAn array containing information which is used within the context of the current page.
linktreeAn array which contains the current link tree.
Functions
__constructSets all attributes to empty arrays and what not.
add_hookAdds a hook to be ran once the specified action occurs.
remove_hookRemoves the hook from the specified action.
run_hooksRuns the hooks which are registered to the specified action.
hook_existsChecks to see if the (or there are) hook(s) is registered for the specified action.
sortSorts the supplied array by the importance key, using the insertion using the insertion sort algorithm.
add_filterAdds a filter to the specified tag, which when the tag is ran, the filter callback is passed the tag value.
remove_filterRemoves the filter from the specified tag.
apply_filtersApplies all the filters registered to the specified tag.
filter_existsChecks to see if the filter is registered with the specified tag.
add_eventAdds a query string event with a callback to be executed once the event occurs.
remove_eventRemoves the specified event.
return_eventReturns a registered events information according to the query string supplied.
event_existsChecks to see if the specified event exists.
parse_queryParses the specified query into an array.
return_linktreeReturns an array containing event identifiers.
add_groupAdds a group which can be assigned to members, which can be used by plugins for permission checking with member()->is_a(‘group_identifier’);
remove_groupRemoves the specified group from the list of registered groups.
group_existsChecks to see if the specified group exists.
return_groupReturns either the group name, or an array of all the registered groups.
add_menu_itemAdds a link to the menu.
remove_menu_itemRemoves the specified menu item(s) by key.
return_menu_itemsReturns the menu items requested.
add_classRegisters a class in the API to allow the class to be loaded with API::load_class without needing to specify the classes file location if the class file is not located within the core directory.
remove_classRemoves the specified class from the list of registered classes.
class_existsChecks to see whether or not the specified class is registered.
load_classLoads the specified class and returns the object.
add_pluginAdds an enabled plugin to the list of, you guessed it, enabled plugins!
remove_pluginRemoves the specified plugin from the list of enabled plugins.
plugin_existsChecks to see if the specified plugin is enabled.
return_pluginsReturns an array of the plugin GUID’s which are currently enabled and have been loaded.
add_resourceAdds a resource which will then become accessible to those browsing the current website.
remove_resourceRemoves the supplied resource.
resource_existsChecks to see if the specified resource (or resource handler) exists.
return_resourceReturns the resource information.
load_apiInstantiates an instance of the API class, and also loads all enabled plugins.
api_catch_fatalJust incase somethings goes horribly wrong with a plugin (a fatal error), this function will handle the disabling of the plugin, and refreshing the page so it appears as it never happened!
api_handle_resourceHandles the displaying of registered resources.
apiReturns the API object.

Variables

Summary
hooksContains all the registered hooks to the specified actions.
filtersContains all the registered filters to the specified tags.
countKeeps track of how many hooks and filters are registered.
eventsAll query string events are kept here.
groupsAll the registered groups reside here.
menu
classesHolds registered classes, which are not located within the core directory.
objects
pluginsCurrently enabled plugins are held in this array.
resourcesA resource is something such as an image, style sheet, or anything, really.
contextAn array containing information which is used within the context of the current page.
linktreeAn array which contains the current link tree.

hooks

private $hooks

Contains all the registered hooks to the specified actions.

filters

private $filters

Contains all the registered filters to the specified tags.

count

private $count

Keeps track of how many hooks and filters are registered.

events

private $events

All query string events are kept here.

groups

private $groups

All the registered groups reside here.

menu

private $menu

classes

private $classes

Holds registered classes, which are not located within the core directory.

objects

private $objects

plugins

private $plugins

Currently enabled plugins are held in this array.

resources

private $resources

A resource is something such as an image, style sheet, or anything, really.

context

public $context

An array containing information which is used within the context of the current page.  This can be used to easily transmit information from one place to another, such as information that needs to be used by a template.

linktree

private $linktree

An array which contains the current link tree.

Functions

Summary
__constructSets all attributes to empty arrays and what not.
add_hookAdds a hook to be ran once the specified action occurs.
remove_hookRemoves the hook from the specified action.
run_hooksRuns the hooks which are registered to the specified action.
hook_existsChecks to see if the (or there are) hook(s) is registered for the specified action.
sortSorts the supplied array by the importance key, using the insertion using the insertion sort algorithm.
add_filterAdds a filter to the specified tag, which when the tag is ran, the filter callback is passed the tag value.
remove_filterRemoves the filter from the specified tag.
apply_filtersApplies all the filters registered to the specified tag.
filter_existsChecks to see if the filter is registered with the specified tag.
add_eventAdds a query string event with a callback to be executed once the event occurs.
remove_eventRemoves the specified event.
return_eventReturns a registered events information according to the query string supplied.
event_existsChecks to see if the specified event exists.
parse_queryParses the specified query into an array.
return_linktreeReturns an array containing event identifiers.
add_groupAdds a group which can be assigned to members, which can be used by plugins for permission checking with member()->is_a(‘group_identifier’);
remove_groupRemoves the specified group from the list of registered groups.
group_existsChecks to see if the specified group exists.
return_groupReturns either the group name, or an array of all the registered groups.
add_menu_itemAdds a link to the menu.
remove_menu_itemRemoves the specified menu item(s) by key.
return_menu_itemsReturns the menu items requested.
add_classRegisters a class in the API to allow the class to be loaded with API::load_class without needing to specify the classes file location if the class file is not located within the core directory.
remove_classRemoves the specified class from the list of registered classes.
class_existsChecks to see whether or not the specified class is registered.
load_classLoads the specified class and returns the object.
add_pluginAdds an enabled plugin to the list of, you guessed it, enabled plugins!
remove_pluginRemoves the specified plugin from the list of enabled plugins.
plugin_existsChecks to see if the specified plugin is enabled.
return_pluginsReturns an array of the plugin GUID’s which are currently enabled and have been loaded.
add_resourceAdds a resource which will then become accessible to those browsing the current website.
remove_resourceRemoves the supplied resource.
resource_existsChecks to see if the specified resource (or resource handler) exists.
return_resourceReturns the resource information.
load_apiInstantiates an instance of the API class, and also loads all enabled plugins.
api_catch_fatalJust incase somethings goes horribly wrong with a plugin (a fatal error), this function will handle the disabling of the plugin, and refreshing the page so it appears as it never happened!
api_handle_resourceHandles the displaying of registered resources.
apiReturns the API object.

__construct

public function __construct()

Sets all attributes to empty arrays and what not.

Parameters

none

add_hook

public function add_hook($action_name,  
$callback,  
$importance =  10,
$accepted_args =  null)

Adds a hook to be ran once the specified action occurs.

Parameters

string $action_nameThe action to attach the hook to.
callback $callbackThe callback to have ran once the action occurs.
int $importanceAllows you to set when your hook is ran, compared to others hooks added to the same action.  The smaller the number the more important the hook is.
int $accepted_argsThe number of arguments your hook expects to receive from the action, if any.  If you keep this to the default (null), all available arguments will be passed.

Returns

boolReturns true if the hook was added successfully, false if the hook already exists, or if the callback was not callable.

Note

If you supply accepted args as a large number than is actually passed by the specified action, the parameters that are “out of range” will receive null.

remove_hook

public function remove_hook($action_name,
$callback)

Removes the hook from the specified action.

Parameters

string $action_nameThe name of the action to remove the hook from.
callback $callbackThe callback of the hook to remove from the action.

Returns

boolReturns true if the hook was removed successfully, false if the hook was not found.

run_hooks

public function run_hooks($action_name,  
$args =  null)

Runs the hooks which are registered to the specified action.

Parameters

string $action_nameThe action to run.
mixed $argsEither a single argument, or an array of arguments.

Returns

voidNothing is returned by this method.

Note

If you want to allow hooks to change the value of a variable, you must pass the variable as a reference inside an array, otherwise you will receive an E_DEPRECATED error!

hook_exists

public function hook_exists($action_name,  
$callback =  null)

Checks to see if the (or there are) hook(s) is registered for the specified action.

Parameters

string $action_nameThe action to search for the hook.
callback $callbackThe callback to find (optional).

Returns

boolIf callback is set it returns true if the hook is registered to the specified action, false if the hook was not found.  Otherwise the method will return true if there are hooks registered for the specified action and false if not.

sort

private function sort(&$array)

Sorts the supplied array by the importance key, using the insertion using the insertion sort algorithm.  Used to sort hooks and filters.

Parameters

array &$arrayThe array to sort by the importance key.

Returns

voidNothing is returned by this method.

Note

Original function available at http://www.todayinwindows.com/forum/index.php?topic=1609.0.

add_filter

public function add_filter($tag_name,  
$callback,  
$importance =  10)

Adds a filter to the specified tag, which when the tag is ran, the filter callback is passed the tag value.

Parameters

string $tag_nameThe tag to add the filter to.
mixed $callbackThe filter callback, however, this can also be a string, integer, double, etc.  That way if you do not need to receive the value of the filter, and you just want to set a new value regardless!
int $importanceThe importance of this filter compared to other filters added to the same tag.  The lower the number, the sooner the filter is ran.

Returns

boolReturns true if the filter is added successfully, false if not.

remove_filter

public function remove_filter($tag_name,
$callback)

Removes the filter from the specified tag.

Parameters

string $tag_nameThe tag to remove the filter from.
mixed $callbackThe callback of the filter or the value.

Returns

boolReturns true if the filter was removed, false if it was not found.

apply_filters

public function apply_filters($tag_name,
$value)

Applies all the filters registered to the specified tag.

Parameters

string $tag_nameThe tag name to run.
mixed $valueThe value to pass to the filters.

Returns

mixedReturns the, possibly, filtered value.

filter_exists

public function filter_exists($tag_name,
$callback)

Checks to see if the filter is registered with the specified tag.

Parameters

string $tag_nameThe name of the tag to check in.
mixed $callbackThe callback/value to find.

Returns

boolReturns true if the callback/value was found, false if not.

add_event

public function add_event($query_string,  
$callback,  
$identifier,  
$filename =  null)

Adds a query string event with a callback to be executed once the event occurs.

Parameters

string $query_stringThe query string that should be matched in order to execute the supplied callback.
callback $callbackThe callback to associate with the event.
mixed $identifierAn identifier used when generating a link tree, which can either be a string or a callback which will return a string.
string $filenameThe file which is included before the callback is executed.  Not required unless the callback is not currently callable.

Returns

boolReturns true if the event was added successfully, false if the event already exists.

Note

What is an event?  Say you want to have doMyAwesomeThing function called when someone accesses $base_url/index.php?action=awesome, you would supply action=awesome as the query string.  Previously, SnowCMS had separate methods to do such a thing with actions, sub actions, and request parameters, but now all of that is handled via events.

You can also specify wild cards, say you want to have blog_view_article called when $base_url/index.php?blog={Some ID}, your query string would be blog=* and whatever the value of blog is, it will be passed as a parameter, as is.

This also allows the ability to do such things as action=someExisting&another=action, what will occur is if the whole query string is not found, the last part of the query string is chopped off (in this case, &another=action) and another check would occur with just action=someExisting, and if it was found, the callback would be executed.

All callbacks are expected to return a boolean value, true if everything was done as should, false, if for some reason, everything was not properly executed.  If the function does return false, the next callback (the one below it, with the last bit of the query string chopped off) would be executed.

Also note that you cannot add an event such as blog=* and then add another event called blog=help, this would cause an already exists error.  Same goes for the other way around, if blog=help were added, then blog=* were added, an error would occur.

DO NOT URL encode the query string, and also DO NOT use & as a separator, you must use just &.

Query strings are CASE SENSITIVE! so action=something is not the same as Action=something!

remove_event

public function remove_event($query_string)

Removes the specified event.

Parameters

string $query_string -The query string to remove.

Returns

boolReturns true if the query string was removed, false if it was not found.

return_event

public function return_event($query_string,  
$generate_link_tree =  false)

Returns a registered events information according to the query string supplied.  The best matching event will be returned.

Parameters

string $query_stringThe query string to get the event of.
bool $generate_link_treeWhether to generate a link tree while parsing the query string.

Returns

arrayReturns an array containing the callback, false on failure to find a match.

event_exists

public function event_exists($query_string)

Checks to see if the specified event exists.

Parameters

string $query_stringThe query string which would trigger the event.

Returns

boolReturns true if the event exists, false if not.

parse_query

private function parse_query($query_string)

Parses the specified query into an array.

Parameters

string $query_stringThe query string to parse.

Returns

arrayReturns the parsed query on success, false on failure.

return_linktree

public function return_linktree()

Returns an array containing event identifiers.

Parameters

none

Returns

arrayReturns an array containing identifiers to generate a link tree.

add_group

public function add_group($group_identifier,
$group_name)

Adds a group which can be assigned to members, which can be used by plugins for permission checking with member()->is_a(‘group_identifier’);

Parameters

string $group_identifierThe groups identifier, which is stored in the members database, an example for a page manager would be page_manager.
string $group_nameThe label for the group.  Such as Page manager, which should be passed through the l() function before using it in this method.

Returns

boolReturns true if the group was added successfully, false if not.

remove_group

public function remove_group($group_identifier)

Removes the specified group from the list of registered groups.

Parameters

string $group_identifierThe group identifier to remove.

Returns

boolReturns true if the group was removed successfully, false if not.

group_exists

public function group_exists($group_identifier)

Checks to see if the specified group exists.

Parameters

string $group_identifierThe group identifier to check.

Returns

boolReturns true if the group exists, false if not.

return_group

public function return_group($group_identifier =  null)

Returns either the group name, or an array of all the registered groups.

Parameters

string $group_identifierThe group identifier to have the name returned.

Returns

mixedReturns a string containing the groups name if the group identifier was specified, and false if the group identifier was not found.  If the group identifier was omitted, then all groups, in an associative array (group_identifier => group_name) is returned.

add_menu_item

public function add_menu_item($category,
$options)

Adds a link to the menu.

Parameters

string $categoryThe category of where the link will be in.
array $optionsAn array containing the links options.

Returns

boolReturns true if the link is added successfully, false if not.

Note

The following indexes are supported for the $options parameter: href - The destination (URL) of the link.

nameThe name of the anchor to link to (if href supplied, this is ignored, and vice versa).
relSpecifies the relationship between the current document and the one it is linking to.  For example, if nofollow was supplied, then bots (Google, Bing, etc.) will not follow the link (well, they will, but it won’t help them).
classSpecifies a CSS class name(s) for the link.
idA unique HTML id for the tag.
styleInline styling.
titleA mouseover text.
contentThe actual content between the tags which is linked.
extraAny extra information (which could be a string, array, etc).
positionA number (starting at zero), specifying at which position the link should be inserted at in the list.  If 0 is supplied, the link will be placed in the front, if none supplied, the link will be added to the end.  Please note that when links are retrieved they are not sorted by this number, they are sorted once it is added.  So if you add two links at position 0, the first link will be second and the next will be first.

By the way.  In order to add a link to the admin menu, simply set the category as action=admin.  To put the link into a category, simply supply the categories label in the extra field as a string, if it doesn’t exist, it will be created.

remove_menu_item

public function remove_menu_item($search,  
$category =  null,
$index =  'content',
$case_sensitive =  false)

Removes the specified menu item(s) by key.

Parameters

string $searchThe value of which you are searching for, if found, it will be deleted.
string $categoryThe category to search.  If none supplied, all categories will be searched.
string $indexThe index you want to search by, either href, name, rel, class, id, style, title or content.  Defaults to content.
bool $case_sensitiveWhether or not the search is case sensitive.

Returns

intReturns the number of menu items removed.

return_menu_items

public function return_menu_items($category =  null)

Returns the menu items requested.

Parameters

string $categoryThe category of links to return, if any.

Returns

arrayReturns an array containing the links, false if the category does not exist.

Note

If the $category parameter is not supplied (null), then the whole menu attribute is returned, containing an array who’s initial indexes specify the category the links are in, however, if false, all the links will be congregated into one array.

add_class

public function add_class($class,
$filename)

Registers a class in the API to allow the class to be loaded with API::load_class without needing to specify the classes file location if the class file is not located within the core directory.

Parameters

string $classThe name of the class in the file.
string $filenameThe name of the file the class is located in.

Returns

boolReturns true on success, false if the class already exists.

remove_class

public function remove_class($class)

Removes the specified class from the list of registered classes.

Parameters

string $classThe name of the class to remove.

Returns

boolReturns true if the class was removed, false if the class was not registered.

class_exists

public function class_exists($class)

Checks to see whether or not the specified class is registered.

Parameters

string $classThe name of the class.

Returns

boolReturns true if the class is registered, false if not.

load_class

public function load_class($class_name,  
$params =  array(),
$filename =  null,
$new =  false)

Loads the specified class and returns the object.  If the new parameter is set to false, then the same object can be obtained through loading the same class by calling on this method again.

Parameters

string $class_nameThe name of the class to load.
array $paramsAn array of parameters you want to pass to the __construct method once the class has been instantiated.
string $filenameThe name of the where the class is defined, if the file is not specified, then coredir/lower($class_name).class.php is assumed.
bool $newIf set to true, a new and private object will be returned, if false, a reference will be stored in the API class which can be obtained later by loading the same class.

Returns

objectReturns the instantiated object of the specified class, however, if the file was not found or the class did not exist, false is returned.

add_plugin

public function add_plugin($guid)

Adds an enabled plugin to the list of, you guessed it, enabled plugins!

Parameters

string $guidThe plugins guid.

Returns

boolReturns true on success, false on failure.

remove_plugin

public function remove_plugin($guid)

Removes the specified plugin from the list of enabled plugins.

Parameters

string $guidThe plugins guid.

Returns

boolReturns true on success, false on failure.

plugin_exists

public function plugin_exists($guid)

Checks to see if the specified plugin is enabled.

Parameters

string $guidThe plugins guid.

Returns

boolReturns true if the plugin is enabled, false if not.

return_plugins

public function return_plugins()

Returns an array of the plugin GUID’s which are currently enabled and have been loaded.

Parameters

none

Returns

arrayReturns an array containing the GUID’s of all the enabled plugins.

add_resource

public function add_resource($area_name,
$resource_id,
$location)

Adds a resource which will then become accessible to those browsing the current website.  The idea of a resource is to allow plugins to have images, style sheets, JavaScript files, etc. and then instead of the plugins needing to figure out their location on the server in order to serve that resource directly, the API can handle that for them.

Parameters

string $area_nameThe area under which to add the resource to, so say your plugin is a blog, you would, ideally, supply the area name as blog, or something close to that.
string $resource_idAn identifier for the resource, for example, if you are adding an icon which symbolizes adding a new blog post, ideally, the resource identifier would be blog_add or so.  This can be left blank only if the location parameter is a callback, which would allow you to handle resource viewing yourself.
mixed $locationThis can either be a callback, in which case the viewing of resources will be handled by the callback, and the callback will be invoked when the area is requested.  However, this can also be a path to a file, of any kind, such as an image.  The supplied path must exist, otherwise adding the resource will fail.

Returns

boolReturns true if the resource was added successfully, false if not.

Note

Resources can be accessed via:

{$base_url}/index.php?action=resource&area={$area_name}&id={$resource_id}

That is of course if a resource identifier is supplied, if not then the “&id={$resource_id}” can be changed to anything.

Also note that area names are internally lowercased, however resource identifiers are not!

remove_resource

public function remove_resource($area_name,  
$resource_id =  null)

Removes the supplied resource.

Parameters

string $area_nameThe area to remove the resource from.
string $resource_idThe resource to remove, if you want to remove all resources from the supplied area, or if the area is a callback, leave this set to null.

Returns

boolReturns true on success, false on failure.

resource_exists

public function resource_exists($area_name,
$resource_id)

Checks to see if the specified resource (or resource handler) exists.

Parameters

string $area_nameThe name of the area to check.
string $resource_idThe resources identifier to check the existence of.

Returns

boolReturns true if the resource exists, false if not.

return_resource

public function return_resource($area_name,  
$resource_id =  null)

Returns the resource information.

Parameters

string $area_nameThe name of the area which contains the resource.
string $resource_idThe identifier for the specific resource.

Returns

mixedReturns a string containing the path to the resource, or a callback which will handle the entire resource area, or an array containing all the resources in the specified area if the area is not handled by a callback OR false if the area or resource identifier does not exist.

load_api

function load_api()

Instantiates an instance of the API class, and also loads all enabled plugins.

Parameters

none

Returns

voidNothing is returned by this function.

Note

This function should not be called directly.  The api() function will make a call to this function when necessary.

api_catch_fatal

function api_catch_fatal()

Just incase somethings goes horribly wrong with a plugin (a fatal error), this function will handle the disabling of the plugin, and refreshing the page so it appears as it never happened!

Parameters

none

Returns

voidNothing is returned by this function.

api_handle_resource

function api_handle_resource()

Handles the displaying of registered resources.

Parameters

none

Returns

voidNothing is returned by this function.

Note

This function is overloadable.

api

function api()

Returns the API object.

Parameters

none

Returns

object

private $hooks
Contains all the registered hooks to the specified actions.
private $filters
Contains all the registered filters to the specified tags.
private $count
Keeps track of how many hooks and filters are registered.
private $events
All query string events are kept here.
private $groups
All the registered groups reside here.
private $menu
private $classes
Holds registered classes, which are not located within the core directory.
private $objects
private $plugins
Currently enabled plugins are held in this array.
private $resources
A resource is something such as an image, style sheet, or anything, really.
public $context
An array containing information which is used within the context of the current page.
private $linktree
An array which contains the current link tree.
public function __construct()
Sets all attributes to empty arrays and what not.
public function add_hook($action_name,  
$callback,  
$importance =  10,
$accepted_args =  null)
Adds a hook to be ran once the specified action occurs.
public function remove_hook($action_name,
$callback)
Removes the hook from the specified action.
public function run_hooks($action_name,  
$args =  null)
Runs the hooks which are registered to the specified action.
public function hook_exists($action_name,  
$callback =  null)
Checks to see if the (or there are) hook(s) is registered for the specified action.
private function sort(&$array)
Sorts the supplied array by the importance key, using the insertion using the insertion sort algorithm.
public function add_filter($tag_name,  
$callback,  
$importance =  10)
Adds a filter to the specified tag, which when the tag is ran, the filter callback is passed the tag value.
public function remove_filter($tag_name,
$callback)
Removes the filter from the specified tag.
public function apply_filters($tag_name,
$value)
Applies all the filters registered to the specified tag.
public function filter_exists($tag_name,
$callback)
Checks to see if the filter is registered with the specified tag.
public function add_event($query_string,  
$callback,  
$identifier,  
$filename =  null)
Adds a query string event with a callback to be executed once the event occurs.
public function remove_event($query_string)
Removes the specified event.
public function return_event($query_string,  
$generate_link_tree =  false)
Returns a registered events information according to the query string supplied.
public function event_exists($query_string)
Checks to see if the specified event exists.
private function parse_query($query_string)
Parses the specified query into an array.
public function return_linktree()
Returns an array containing event identifiers.
public function add_group($group_identifier,
$group_name)
Adds a group which can be assigned to members, which can be used by plugins for permission checking with member()->is_a(‘group_identifier’);
public function remove_group($group_identifier)
Removes the specified group from the list of registered groups.
public function group_exists($group_identifier)
Checks to see if the specified group exists.
public function return_group($group_identifier =  null)
Returns either the group name, or an array of all the registered groups.
public function add_menu_item($category,
$options)
Adds a link to the menu.
public function remove_menu_item($search,  
$category =  null,
$index =  'content',
$case_sensitive =  false)
Removes the specified menu item(s) by key.
public function return_menu_items($category =  null)
Returns the menu items requested.
public function add_class($class,
$filename)
Registers a class in the API to allow the class to be loaded with API::load_class without needing to specify the classes file location if the class file is not located within the core directory.
public function load_class($class_name,  
$params =  array(),
$filename =  null,
$new =  false)
Loads the specified class and returns the object.
public function remove_class($class)
Removes the specified class from the list of registered classes.
public function class_exists($class)
Checks to see whether or not the specified class is registered.
public function add_plugin($guid)
Adds an enabled plugin to the list of, you guessed it, enabled plugins!
public function remove_plugin($guid)
Removes the specified plugin from the list of enabled plugins.
public function plugin_exists($guid)
Checks to see if the specified plugin is enabled.
public function return_plugins()
Returns an array of the plugin GUID’s which are currently enabled and have been loaded.
public function add_resource($area_name,
$resource_id,
$location)
Adds a resource which will then become accessible to those browsing the current website.
public function remove_resource($area_name,  
$resource_id =  null)
Removes the supplied resource.
public function resource_exists($area_name,
$resource_id)
Checks to see if the specified resource (or resource handler) exists.
public function return_resource($area_name,  
$resource_id =  null)
Returns the resource information.
function load_api()
Instantiates an instance of the API class, and also loads all enabled plugins.
function api_catch_fatal()
Just incase somethings goes horribly wrong with a plugin (a fatal error), this function will handle the disabling of the plugin, and refreshing the page so it appears as it never happened!
function api_handle_resource()
Handles the displaying of registered resources.
function api()
Returns the API object.
Close