Table of Contents

Plugin functions

This page documents the GetSimpleCMS functions available from admin/inc/plugin_functions.php.
The ones you will most commonly need as a plugin/ theme developer are:

register_plugin, add_action, add_filter, createSideMenu, createNavTab, register_script, queue_script, register_style, queue_style

The following functions are mostly used by GS internally:

get_scripts_frontend, get_scripts_backend, get_styles_frontend, get_styles_backend, read_pluginsxml, create_pluginsxml, cdn_fallback, change_plugin

add_action

Signature

add_action($hook_name, $added_function[, $args])

Description
Hooks $added_function in the function queue to be executed at $hook_name.

Parameters

exec_action

Signature

exec_action($hook_name)

Description
Registers a hook at the line where it is called. Other plugins can then execute a function in that hook by using add_action($hook_name,'their_function');

Parameters

createSideMenu

Signature

createSideMenu($id, $txt[, $action=null, $always=true])

Description
Adds a sidebar link item to the sidebar with $id as id.

Parameters:

createNavTab

Signature

createNavTab($tabname, $id, $tabtitle[, $action=null])

Parameters:

register_plugin

Signature

register_plugin($id, $name[, $ver=null, $auth=null, $auth_url=null, $desc=null, $type=null, $init=null])

Description
Registers a plugin in the $plugin_info list.

Parameters

add_filter

Signature

add_filter($filter_name, $added_function)

Description
Provides the ability to filter/modify content passed to $added_function.
The (filtered) content is provided to $added_function as parameter and must be returned at the end of the function.

Parameters

exec_filter

Signature

exec_filter($filter_name[, $data = array()])

Description
Allows filtering content passed as $data. Functions called in add_function will have access to the $data parameter.
These functions must return the modified data.

Parameters

change_plugin

Signature

change_plugin($name[, $active = null])

Description
Toggles the state of a plugin (active/ inactive). Pass $active to force activation.

Parameters

read_pluginsxml

Signature

read_pluginsxml()

Description
Reads in the plugins.xml file and populates the $live_plugins array with activated plugins

create_pluginsxml

Signature

create_pluginsxml([$force = false])

Description
Reads in each plugin and creates the plugins.xml file, if it does not exist, or if $force is true.

Parameters

register_script

Signature

register_script($handle, $src, $ver[, $in_footer=FALSE])

Description
Registers a script in the global $GS_scripts.

Parameters

deregister_script

Signature

deregister_script($handle)

Description
Removes the identified script completely from the $GS_scripts global.

Parameters

queue_script

Signature

queue_script($handle, $context)

Description
Queue a script to be outputted in the front- or backend (depending on $context), or pass 1 to load in both.

Parameters

dequeue_script

Signature

dequeue_script($handle, $context)

Description
Removes a script queued with register_script from the script queue (effectively un-loading it).

Parameters

get_scripts_frontend

Signature

get_scripts_frontend([$footer=FALSE])

Description
Outputs script tags for all scripts queued in the GSFRONT context. Is called once in the theme header, and once in the footer.

Parameters

get_scripts_backend

Signature

get_scripts_backend([$footer=FALSE])

Description
Outputs script tags for all scripts queued in the GSBACK context. Is called once in the admin header, and once in the footer.

Parameters

cdn_fallback

Signature

cdn_fallback($script)

Description
Ouputs a local cdn fallback link. Only works when GSNOCDN=false.

Parameters

register_style

Signature

register_style($handle, $src, $ver, $media)

Description
Registers a stylesheet in the global $GS_styles.

Parameters

queue_style

Signature

queue_style($handle[, $context=1])

Description
Queue a style to be outputted in the front- or backend (depending on $context), or pass 1 to load in both.

Parameters

dequeue_style

Signature

dequeue_style($handle, $context)

Description
Removes a style queued with queue_style from the stylesheet queue (effectively un-loading it).

Parameters

get_styles_frontend

Signature

get_styles_frontend()

Description
Loops through the $GS_styles global and outputs all styles queued with queue_style
where the queueing $context is “GSFRONT”, on front-end pages.

get_styles_backend

Signature

get_styles_backend()

Description
Loops through the $GS_styles global and outputs all styles queued with queue_style
where the queueing $context is “GSBACK”, on admin pages.