Functions

Function Description
allocateResources Assigns resources from $this->IRLsCreated
archivePage Archives a page.
archivePageChildren Archives a page's children and sets the archive status to inherited.
assign2FASecret Assigns a two factor auth token to a user and then logs them in.
autoIPL Automatically converts links to internal page links.
backupDatabase Backs up the entire database to a given file.
cacheHooks Caches extension hooks.
canAccessGroup Returns whether or not the logged in user can access a module group.
canModifyChildren Checks whether the logged in user can modify all child pages of a page.
changePassword Changes a user's password via a password change hash and redirects to a success page.
checkAccess Determines whether the logged in user has access to a module or not.
checkPOSTError Checks if an error occurred during a POST and redirects back to the originating page with a session var.
checkHTML Checks a block of HTML for broken links/images
clearCache Removes all page cache files in the cache directory.
clearDead404s Removes all 404s that don't have 301 redirects.
convertTimestampFromUser Converts a timestamp from the logged in user's timezone frame of reference to the server's frame of reference
convertTimestampToUser Converts a timestamp from the logged in user's timezone frame of reference to the server's frame of reference
create301 Creates a 301 redirect.
createCallout Creates a callout and its files.
createCalloutGroup Creates a callout group.
createFeed Creates a feed.
createFieldType Creates a field type and its files.
createMessage Creates a message in message center.
createModule Creates a module and its class file.
createModuleAction Creates a module action.
createModuleEmbedForm Creates an embeddable form.
createModuleForm Creates a module form.
createModuleGroup Creates a module group.
createModuleReport Creates a module report and the associated module action.
createModuleView Creates a module view.
createPage Creates a page.
createPendingChange Creates a pending change.
createPendingPage Creates a pending page entry in bigtree_pending_changes
createResource Creates a resource.
createResourceFolder Creates a resource folder.
createSetting Creates a setting.
createTag Creates a new tag, or returns the id of an existing one.
createTemplate Creates a template and its default files/directories.
createUser Creates a user.
deallocateResources Removes resource allocation from a deleted entry.
delete404 Deletes a 404 error.
deleteCallout Deletes a callout and removes its file.
deleteCalloutGroup Deletes a callout group.
deleteExtension Uninstalls an extension from BigTree and removes its related components and files.
deleteFeed Deletes a feed.
deleteFieldType Deletes a field type and erases its files.
deleteModule Deletes a module.
deleteModuleAction Deletes a module action.
deleteModuleEmbedForm Deletes an embeddable module form.
deleteModuleForm Deletes a module form and its related actions.
deleteModuleGroup Deletes a module group. Sets modules in the group to Misc.
deleteModuleReport Deletes a module report and its related actions.
deleteModuleView Deletes a module view and its related actions.
deletePage Deletes a page or a pending page.
deletePageChildren Deletes the children of a page and recurses downward.
deletePageDraft Deletes a page draft.
deletePageRevision Deletes a page revision.
deletePendingChange Deletes a pending change.
deleteResource Deletes a resource.
deleteResourceFolder Deletes a resource folder and all of its sub folders and resources.
deleteSetting Deletes a setting.
deleteTag Deletes a tag.
deleteTemplate Deletes a template and its related files.
deleteUser Deletes a user.
disconnectGoogleAnalytics Turns of Google Analytics settings in BigTree and deletes cached information.
doesModuleActionExist Checks to see if an action exists for a given route and module.
doesModuleEditActionExist Determines whether there is already an edit action for a module.
doesModuleLandingActionExist Determines whether there is already a landing action for a module.
drawArrayLevel An internal function used for drawing callout and matrix resource data.
drawField A helper function that draws a field type.
drawCSRFToken Draws an input field for the CSRF token.
drawCSRFTokenGET Draws a GET variable in a URL for the CSRF token.
drawPOSTErrorMessage If a POST error occurred, draws a message for the form.
emailDailyDigest Sends out a daily digest email to all who have subscribed.
forgotPassword Creates a new password change hash and sends an email to the user.
get404Total Get the total number of 404s of a certain type.
getAccessGroups Returns a list of all groups the logged in user has access to in a module.
getAccessLevel Returns the permission level for a given module and item.
getActionClass Returns the button class for the given action and item.
getArchivedNavigationByParent Returns an alphabetic list of navigation that is archived under the given parent.
getAutoModuleActions Return a list of module forms and views.
getBasicTemplates Returns a list of non-routed templates ordered by position.
getCachedAccessLevel Returns the permission level for a given module and cached view entry.
getCachedFieldTypes Caches available field types and returns them.
getCallout Returns a callout entry.
getCalloutGroup Returns a callout group entry from the callout groups database.
getCalloutGroups Returns a list of callout groups sorted by name.
getCallouts Returns a list of callouts.
getCalloutsAllowed Returns a list of callouts the logged-in user is allowed access to.
getCalloutsInGroups Returns a list of callouts in a given set of groups.
getChange Get a pending change.
getChangeEditLink Returns a link to where the item involved in the pending change can be edited.
getContentAlerts Gets a list of pages with content older than their Max Content Age that a user follows.
getExisting404 Checks for the existance of a 404 at a given source URL.
getExtension Returns information about a package or extension.
getExtensions Returns a list of installed/created extensions.
getFeeds Returns a list of feeds.
getFieldType Returns a field type.
getFieldTypes Returns a list of field types.
getFullNavigationPath Calculates the full navigation path for a given page ID.
getHiddenNavigationByParent Returns an alphabetic list of navigation that is hidden under the given parent.
getMessage Returns a message from message center.
getMessageChain Gets a full chain of messages based on one ID in the chain
getMessages Returns all a user's messages.
getModule Returns an entry from the modules database.
getModuleAction Returns an action entry from the modules database.
getModuleActionByRoute Returns an action entry from the modules database for the given module and route.
getModuleActionForForm Returns the related module action for an auto module form. Prioritizes edit action over add.
getModuleActionForReport Returns the related module action for an auto module report.
getModuleActionForView Returns the related module action for an auto module view.
getModuleActions Returns a list of module actions in positioned order.
getModuleByClass Returns a module entry for the given class name.
getModuleByRoute Returns a module entry for the given route.
getModuleEmbedForms Gets embeddable forms from the modules database.
getModuleForms Gets forms from the modules database with fields decoded.
getModuleGroup Returns a module group entry from the module groups database.
getModuleGroupByName Returns a module group entry from the module groups database.
getModuleGroupByRoute Returns a module group entry from the module groups database.
getModuleGroups Returns a list of module groups.
getModuleNavigation Returns a list of module actions that are in navigation.
getModuleReports Gets reports from the modules database.
getModules Returns a list of modules.
getModulesByGroup Returns a list of modules in a given group.
getModuleViews Returns a list of all views in the modules database.
getNaturalNavigationByParent Returns a list of positioned navigation that is in navigation under the given parent.
getPageAccessLevel Returns the access level for the logged in user to a given page.
getPageAccessLevelByUser Returns the access level for the given user to a given page.
getPageAdminLinks Gets a list of pages that link back to the admin.
getPageChanges Returns pending changes for a given page.
getPageChildren Returns all non-archived children of a given page.
getPageLineage Returns all the ids of pages above this page.
getPageIds Returns all the IDs in bigtree_pages for pages that aren't archived.
getPageIDForPath Provides the page ID, commands array, routed status, GET variables, and URL hash for a given path array.
getPageOfSettings Returns a page of settings the logged in user has access to.
getPageOfTags Returns a page of tags.
getPageOfUsers Returns a page of users.
getPageRevision Returns a version of a page from the bigtree_page_revisions table.
getPageRevisions Get all revisions for a page.
getPages Returns all pages from the database.
getPageSEORating Returns the SEO rating for a page.
getPendingChange Returns a pending change from the bigtree_pending_changes table.
getPublishableChanges Returns a list of changes that the logged in user has access to publish.
getPendingChanges Returns a list of changes for a given user.
getPendingNavigationByParent Returns a list of pending pages under a given parent ordered by most recent.
getContentsOfResourceFolder Returns a list of resources and subfolders in a folder.
getResourceByFile Returns a resource with the given file name.
getResource Returns a resource.
getResourceAllocation Returns the places a resource is used.
getResourceFolder Returns a resource folder.
getResourceFolderAllocationCounts Returns the number of items inside a folder and it's subfolders and the number of allocations of the contained resources.
getResourceFolderBreadcrumb Returns a breadcrumb of the given folder.
getResourceFolderChildren Returns the child folders of a resource folder.
getResourceFolderPermission Returns the permission level of the current user for the folder.
getRoutedTemplates Returns a list of routed templates ordered by position that the logged in user has access to.
getSetting Returns a setting.
getSettings Returns a list of all settings that the logged in user has access to.
getSettingsPageCount Returns the number of pages of settings that the logged in user has access to.
getTag Returns a tag for the given id.
getTagsPageCount Returns the number of pages of tags.
getTemplates Returns a list of templates.
getUniqueModuleRoute Returns an available module route based on the desired route.
getUnreadMessageCount Returns the number of unread messages for the logged in user.
getUser Gets a user's decoded information.
getUserByEmail Gets a user entry for a given email.
getUserByHash Gets a user entry for a change password hash.
getUsers Returns a list of all users.
getUsersPageCount Returns the number of pages of users.
growl Sets up a growl session for the next page reload.
handleOpenGraph Handles open graph updates for a piece of data.
htmlClean Removes things that shouldn't be in the <body> of an HTML document from a string.
ignore404 Ignores a 404 error.
initSecurity Sets up security environment variables and runs white/blacklists for IP checks.
installExtension Installs an extension.
iplExists Determines whether an internal page link still exists or not.
irlExists Determines whether an internal resource link still exists or not.
isIPBanned Checks to see if the requesting IP address is banned and should not be allowed to attempt login.
isUserBanned Checks to see if the logging in user is banned and should not be allowed to attempt login.
lockCheck Checks if a lock exists.
login Attempts to login a user to the CMS.
login2FA Verifies an authorization token matches the user's secret and logs them in if successful.
logout Logs out of the CMS.
logoutAll Logs all users out of the CMS.
makeIPL Creates an internal page link out of a URL.
markMessageRead Marks a message as read by the currently logged in user.
mergeTags Merges a set of tags into a single tag and updates references.
pageChangeExists Returns whether pending changes exist for a given page.
parse404SourceURL Parses a user's 404 source URL based on site key.
pingSearchEngines Sends the latest sitemap.xml out to search engine ping services if enabled in settings.
processCrop Processes a single crop of a crop set.
processCrops Processes a list of cropped images.
processField A helper function for field type processing.
processImageUpload Processes image upload data for form fields.
rectifyResourceTypeChange Verifies that existing data for a resource set will fit with the new resource set.
refreshLock Refreshes a lock.
remove2FASecret Removes two factor authentication from a user.
requireAccess Checks the logged in user's access to a given module.
requireLevel Requires the logged in user to have a certain access level to continue.
requirePublisher Checks the logged in user's access to a given module to make sure they are a publisher.
runHooks Runs extension hooks of a given type for a given context.
saveCurrentPageRevision Saves the currently published page as a revision.
search404s Searches 404s, returns results.
searchAuditTrail Searches the audit trail for a set of data.
searchPages Searches for pages.
searchResources Returns a list of folders and files that match the given query string.
searchTags Finds existing tags that are similar.
set404Redirect Sets the redirect address for a 404.
setCalloutPosition Sets the position of a callout.
setModuleActionPosition Sets the position of a module action.
setModuleGroupPosition Sets the position of a module group.
setModulePosition Sets the position of a module.
setPagePosition Sets the position of a page.
setPasswordHashForUser Creates a change password hash for a user.
setTemplatePosition Sets the position of a template.
settingExists Determines whether a setting exists for a given id.
stop Stops processing of the Admin area and shows a message in the default layout.
stripMultipleRootTokens Strips the multi-domain root tokens from a string and replaces them with standard {wwwroot} and {staticroot}
submitPageChange Adds a pending change to the bigtree_pending_changes table for the page.
track Logs a user's actions to the audit trail table.
unarchivePage Unarchives a page and all its children that inherited archived status.
unarchivePageChildren Unarchives a page's children that have the archived_inherited status.
ungrowl Destroys the growl session.
urlExists Attempts to connect to a URL using cURL.
unCache Removes the cached copy of a given page.
unignore404 Unignores a 404.
uniqueModuleActionRoute Returns a unique module action route.
unlock Removes a lock from a table entry.
updateCallout Updates a callout.
updateCalloutGroup Updates a callout group's name and callout list.
updateChildPagePaths Updates the paths for pages who are descendants of a given page to reflect the page's new route.
updateFeed Updates a feed.
updateFieldType Updates a field type.
updateInternalSettingValue Updates the value of an internal BigTree setting.
updateModule Updates a module.
updateModuleAction Updates a module action.
updateModuleEmbedForm Updates an embeddable form.
updateModuleForm Updates a module form.
updateModuleGroup Updates a module group's name.
updateModuleReport Updates a module report.
updateModuleView Updates a module view.
updateModuleViewColumnNumericStatusForTable Updates module view columns to designate whether they are numeric or not based on parsers, column type, and related forms.
updateModuleViewFields Updates the fields for a module view.
updatePage Updates a page.
updatePageParent Changes a page's parent.
updatePageRevision Updates a page revision to save it as a favorite.
updatePendingChange Updates a pending change.
updateTagReferenceCounts Updates the reference counts for tags to accurately match active database entries.
updateProfile Updates a user's name, company, digest setting, and (optionally) password.
updateResource Updates a resource.
updateResourceAllocation Updates resource allocation to move pending changes to the live entry.
updateResourceFolder Updates a resource folder.
updateSetting Updates a setting.
updateSettingValue Updates the value of a setting.
updateTemplate Updates a template.
updateUser Updates a user.
updateUserPassword Updates a user's password.
validatePassword Validates a password against the security policy.
verifyCSRFToken Verifies the referring host and session token and stops processing if they fail.
verifyLogin2FA Verifies a username and password and returns the two factor auth secret.
versionToDecimal Returns a decimal number of a BigTree version for numeric comparisons.

allocateResources

Assigns resources from $this->IRLsCreated

static allocateResources($table, $entry)
Parameter Description
$table Table in which the entry resides
$entry Entry ID to assign to

archivePage

Archives a page.

Return Value: true if successful. false if the logged in user doesn't have permission.

archivePage($page)
Parameter Description
$page Either a page id or page entry.

archivePageChildren

Archives a page's children and sets the archive status to inherited.

archivePageChildren($page)
Parameter Description
$page A page id.

assign2FASecret

Assigns a two factor auth token to a user and then logs them in.

assign2FASecret($secret)
Parameter Description
$secret A Google Authenticator secret

autoIPL

Automatically converts links to internal page links.

Return Value: A string with hard links converted into internal page links.

static autoIPL($html)
Parameter Description
$html A string of contents that may contain URLs

backupDatabase

Backs up the entire database to a given file.

Return Value: true if successful.

static backupDatabase($file)
Parameter Description
$file Full file path to dump the database to.

cacheHooks

Caches extension hooks.

cacheHooks()

canAccessGroup

Returns whether or not the logged in user can access a module group.
Utility for form field types / views -- we already know module group permissions are enabled so we skip some overhead

Return Value: The permission level if the user can access this group, otherwise false.

canAccessGroup($module, $group)
Parameter Description
$module A module entry.
$group A group id.

canModifyChildren

Checks whether the logged in user can modify all child pages of a page.
Assumes we already know that we're a publisher of the parent.

Return Value: true if the user can modify all the page children, otherwise false.

canModifyChildren($page)
Parameter Description
$page The page entry to check children for.

changePassword

Changes a user's password via a password change hash and redirects to a success page.

static changePassword($hash, $password)
Parameter Description
$hash The unique hash generated by .
$password The user's new password.

checkAccess

Determines whether the logged in user has access to a module or not.

Return Value: true if the user can access the module, otherwise false.

checkAccess($module, $action = false)
Parameter Description
$module Either a module id or module entry.
$action Optionally, a module action array to also check levels against.

checkPOSTError

Checks if an error occurred during a POST and redirects back to the originating page with a session var.

checkPOSTError()

checkHTML

Checks a block of HTML for broken links/images

Return Value: An array containing two possible keys (a and img) which each could contain an array of errors.

static checkHTML($relative_path, $html, $external = false)
Parameter Description
$relative_path The starting path of the page containing the HTML (so that relative links, i.e. "good/" know where to begin)
$html A string of HTML
$external Whether to check external links (slow) or not

clearCache

Removes all page cache files in the cache directory.

static clearCache()

clearDead404s

Removes all 404s that don't have 301 redirects.

clearDead404s()

convertTimestampFromUser

Converts a timestamp from the logged in user's timezone frame of reference to the server's frame of reference

Return Value: An adjusted timestamp in Y-m-d H:i:s format

convertTimestampFromUser($time, $format = null)
Parameter Description
$time A timestamp readable by strtotime
$format Return format, defaults to "Y-m-d H:i:s"

convertTimestampToUser

Converts a timestamp from the logged in user's timezone frame of reference to the server's frame of reference

Return Value: An adjusted timestamp

convertTimestampToUser($time, $format = null, $ = null)
Parameter Description
$time A timestamp readable by strtotime
$format A date format (defaults to the $bigtree["config"]["date_format"] value)
$

create301

Creates a 301 redirect.

create301($from, $to, $site_key = null)
Parameter Description
$from The 404 path
$to The 301 target
$site_key The site key for a multi-site environment (defaults to null)

createCallout

Creates a callout and its files.

createCallout($id, $name, $description, $level, $resources, $display_field, $display_default)
Parameter Description
$id The id.
$name The name.
$description The description.
$level Access level (0 for everyone, 1 for administrators, 2 for developers).
$resources An array of resources.
$display_field The field to use as the display field describing a user's callout
$display_default The text string to use in the event the display_field is blank or non-existent

createCalloutGroup

Creates a callout group.

Return Value: The id of the newly created group.

createCalloutGroup($name, $callouts)
Parameter Description
$name The name of the group.
$callouts An array of callout IDs to assign to the group.

createFeed

Creates a feed.

Return Value: The route to the new feed.

createFeed($name, $description, $table, $type, $settings, $fields)
Parameter Description
$name The name.
$description The description.
$table The data table.
$type The feed type.
$settings The feed type settings.
$fields The fields.

createFieldType

Creates a field type and its files.

createFieldType($id, $name, $use_cases, $self_draw)
Parameter Description
$id The id of the field type.
$name The name.
$use_cases Associate array of sections in which the field type can be used (i.e. array("pages" => "on", "modules" => "","callouts" => "","settings" => ""))
$self_draw Whether this field type will draw its
and

createMessage

Creates a message in message center.

createMessage($subject, $message, $recipients, $in_response_to)
Parameter Description
$subject The subject line.
$message The message.
$recipients The recipients.
$in_response_to The message being replied to.

createModule

Creates a module and its class file.

Return Value: The new module id.

createModule($name, $group, $class, $table, $permissions, $icon, $route = false)
Parameter Description
$name The name of the module.
$group The group for the module.
$class The module class to create.
$table The table this module relates to.
$permissions The group-based permissions.
$icon The icon to use.
$route Desired route to use (defaults to auto generating if this is left false).

createModuleAction

Creates a module action.

Return Value: The action's route.

createModuleAction($module, $name, $route, $in_nav, $icon, $form, $view, $report, $level, $position)
Parameter Description
$module The module to create an action for.
$name The name of the action.
$route The action route.
$in_nav Whether the action is in the navigation.
$icon The icon class for the action.
$form The associated form.
$view The associated view.
$report The associated report.
$level The required access level.
$position The position in navigation.

createModuleEmbedForm

Creates an embeddable form.

Return Value: The embed code.

createModuleEmbedForm($module, $title, $table, $fields, $hooks, $default_position, $default_pending, $css, $redirect_url, $thank_you_message)
Parameter Description
$module The module ID that this form relates to.
$title The title of the form.
$table The table for the form data.
$fields The form fields.
$hooks An array of "pre", "post", and "publish" keys that can be function names to call
$default_position Default position for entries to the form (if the view is positioned).
$default_pending Whether the submissions to default to pending or not ("on" or "").
$css URL of a CSS file to include.
$redirect_url The URL to redirect to upon completion of submission.
$thank_you_message The message to display upon completeion of submission.

createModuleForm

Creates a module form.

Return Value: The new form id.

createModuleForm($module, $title, $table, $fields, $hooks, $default_position, $return_view, $return_url, $tagging, $open_graph)
Parameter Description
$module The module ID that this form relates to.
$title The title of the form.
$table The table for the form data.
$fields The form fields.
$hooks An array of "pre", "post", and "publish" keys that can be function names to call
$default_position Default position for entries to the form (if the view is positioned).
$return_view The view to return to after completing the form.
$return_url The alternative URL to return to after completing the form.
$tagging Whether or not to enable tagging.
$open_graph Whether to enable open graph attributes.

createModuleGroup

Creates a module group.

Return Value: The id of the newly created group.

createModuleGroup($name)
Parameter Description
$name The name of the group.

createModuleReport

Creates a module report and the associated module action.

Return Value: The id of the report.

createModuleReport($module, $title, $table, $type, $filters, $fields = "", $parser = "", $view = "")
Parameter Description
$module The module ID that this report relates to.
$title The title of the report.
$table The table for the report data.
$type The type of report (csv or view).
$filters The filters a user can use to create the report.
$fields The fields to show in the CSV export (if type = csv).
$parser An optional parser function to run on the CSV export data (if type = csv).
$view A module view ID to use (if type = view).

createModuleView

Creates a module view.

Return Value: The id for view.

createModuleView($module, $title, $description, $table, $type, $settings, $fields, $actions, $related_form, $preview_url = "", $exclude_from_search = false)
Parameter Description
$module The module ID that this view relates to.
$title View title.
$description Description.
$table Data table.
$type View type.
$settings View settings array.
$fields Field array.
$actions Actions array.
$related_form Form ID to handle edits.
$preview_url Optional preview URL.
$exclude_from_search Excludes view data from admin search.

createPage

Creates a page.
Does not check permissions.

Return Value: The id of the newly created page.

createPage($data, $publishing_change = false)
Parameter Description
$data An array of page information.
$publishing_change Set to change ID if publishing a change (causes audit trail to reflect original user as author, defaults false)

createPendingChange

Creates a pending change.

Return Value: The change id.

createPendingChange($table, $item_id, $changes, $mtm_changes, $tags_changes, $module)
Parameter Description
$table The table the change applies to.
$item_id The entry the change applies to's id.
$changes The changes to the fields in the entry.
$mtm_changes Many to Many changes.
$tags_changes Tags changes.
$module The module id for the change.

createPendingPage

Creates a pending page entry in bigtree_pending_changes

Return Value: The id of the pending change.

createPendingPage($data)
Parameter Description
$data An array of page information.

createResource

Creates a resource.

Return Value: The new resource id.

createResource($folder, $file, $name, $type = "file", $crops = [], $thumbs = [], $video_data = [], $metadata = [])
Parameter Description
$folder The folder to place it in.
$file The file path or a video URL.
$name The file name.
$type "file", "image", or "video"
$crops An array of crop prefixes
$thumbs An array of thumb prefixes
$video_data An array of video data
$metadata An array of metadata

createResourceFolder

Creates a resource folder.
Checks permissions.

Return Value: The new folder id.

createResourceFolder($parent, $name)
Parameter Description
$parent The parent folder.
$name The name of the new folder.

createSetting

Creates a setting.

Return Value: True if successful, false if a setting already exists with the ID given.

createSetting($data)
Parameter Description
$data An array of settings information. Available fields: "id", "name", "description", "type", "settings", locked", "module", "encrypted", "system"

createTag

Creates a new tag, or returns the id of an existing one.

Return Value: Otherwise, returns the new tag id.

createTag($tag)
Parameter Description
$tag The tag.

createTemplate

Creates a template and its default files/directories.

createTemplate($id, $name, $routed, $level, $module, $resources, $hooks = [])
Parameter Description
$id Id for the template.
$name Name
$routed Basic ("") or Routed ("on")
$level Access level (0 for everyone, 1 for administrators, 2 for developers)
$module Related module id
$resources An array of resources
$hooks An array of hooks

createUser

Creates a user.
Checks for developer access.

Return Value: id of the newly created user or false if a user already exists with the provided email.

createUser($data)
Parameter Description
$data An array of user data. ("email", "password", "name", "company", "level", "permissions","alerts")

deallocateResources

Removes resource allocation from a deleted entry.

static deallocateResources($table, $entry)
Parameter Description
$table The table of the entry
$entry The ID of the entry

delete404

Deletes a 404 error.
Checks permissions.

delete404($id)
Parameter Description
$id The id of the reported 404.

deleteCallout

Deletes a callout and removes its file.

deleteCallout($id)
Parameter Description
$id The id of the callout.

deleteCalloutGroup

Deletes a callout group.

deleteCalloutGroup($id)
Parameter Description
$id The id of the callout group.

deleteExtension

Uninstalls an extension from BigTree and removes its related components and files.

deleteExtension($id)
Parameter Description
$id The extension ID.

deleteFeed

Deletes a feed.

deleteFeed($id)
Parameter Description
$id The id of the feed.

deleteFieldType

Deletes a field type and erases its files.

deleteFieldType($id)
Parameter Description
$id The id of the field type.

deleteModule

Deletes a module.

deleteModule($id)
Parameter Description
$id The id of the module.

deleteModuleAction

Deletes a module action.
Also deletes the related form or view if no other action is using it.

deleteModuleAction($id)
Parameter Description
$id The id of the action to delete.

deleteModuleEmbedForm

Deletes an embeddable module form.

deleteModuleEmbedForm($id)
Parameter Description
$id The id of the embeddable form.

deleteModuleForm

Deletes a module form and its related actions.

deleteModuleForm($id)
Parameter Description
$id The id of the module form.

deleteModuleGroup

Deletes a module group. Sets modules in the group to Misc.

deleteModuleGroup($id)
Parameter Description
$id The id of the module group.

deleteModuleReport

Deletes a module report and its related actions.

deleteModuleReport($id)
Parameter Description
$id The id of the module report.

deleteModuleView

Deletes a module view and its related actions.

deleteModuleView($id)
Parameter Description
$id The id of the module view.

deletePage

Deletes a page or a pending page.
Checks permissions.

Return Value: true if successful. Stops page execution if permission issues occur.

deletePage($page)
Parameter Description
$page A page id or a pending page id prefixed with a "p"

deletePageChildren

Deletes the children of a page and recurses downward.
Does not check permissions.

deletePageChildren($id)
Parameter Description
$id The parent id to delete children for.

deletePageDraft

Deletes a page draft.
Checks permissions.

deletePageDraft($id)
Parameter Description
$id The page id to delete the draft for.

deletePageRevision

Deletes a page revision.
Checks permissions.

deletePageRevision($id)
Parameter Description
$id The page version id.

deletePendingChange

Deletes a pending change.

deletePendingChange($id)
Parameter Description
$id The id of the change.

deleteResource

Deletes a resource.

deleteResource($id)
Parameter Description
$id The id of the resource.

deleteResourceFolder

Deletes a resource folder and all of its sub folders and resources.

deleteResourceFolder($id)
Parameter Description
$id The id of the resource folder.

deleteSetting

Deletes a setting.

deleteSetting($id)
Parameter Description
$id The id of the setting.

deleteTag

Deletes a tag.

deleteTag($id)
Parameter Description
$id A tag ID

deleteTemplate

Deletes a template and its related files.

Return Value: true if successful.

deleteTemplate($id)
Parameter Description
$id The id of the template.

deleteUser

Deletes a user.
Checks for developer access.

Return Value: true if successful. false if the logged in user does not have permission to delete the user.

deleteUser($id)
Parameter Description
$id The user id to delete.

disconnectGoogleAnalytics

Turns of Google Analytics settings in BigTree and deletes cached information.

disconnectGoogleAnalytics()

doesModuleActionExist

Checks to see if an action exists for a given route and module.

Return Value: true if an action exists, otherwise false.

static doesModuleActionExist($module, $route)
Parameter Description
$module The module to check.
$route The route of the action to check.

doesModuleEditActionExist

Determines whether there is already an edit action for a module.

Return Value: 1 or 0, for true or false.

static doesModuleEditActionExist($module)
Parameter Description
$module The module id to check.

doesModuleLandingActionExist

Determines whether there is already a landing action for a module.

Return Value: 1 or 0, for true or false.

static doesModuleLandingActionExist($module)
Parameter Description
$module The module id to check.

drawArrayLevel

An internal function used for drawing callout and matrix resource data.

static drawArrayLevel($ = false)
Parameter Description
$

drawField

A helper function that draws a field type.

static drawField($field)
Parameter Description
$field Field array

drawCSRFToken

Draws an input field for the CSRF token.

drawCSRFToken()

drawCSRFTokenGET

Draws a GET variable in a URL for the CSRF token.

drawCSRFTokenGET()

drawPOSTErrorMessage

If a POST error occurred, draws a message for the form.

Return Value: true if a message was displayed

static drawPOSTErrorMessage($ = false)
Parameter Description
$

emailDailyDigest

Sends out a daily digest email to all who have subscribed.

emailDailyDigest()

forgotPassword

Creates a new password change hash and sends an email to the user.

Return Value: Redirects if the email address was found, returns false if the user doesn't exist.

static forgotPassword($email)
Parameter Description
$email The user's email address

get404Total

Get the total number of 404s of a certain type.

Return Value: The number of 404s in the table of the given type.

static get404Total($type, $site_key = null)
Parameter Description
$type The type to retrieve the count for (301, ignored, 404)
$site_key The site key to return 404 count for (defaults to all sites)

getAccessGroups

Returns a list of all groups the logged in user has access to in a module.

Return Value: An array of groups if a user has limited access to a module or "true" if the user has access to all groups.

getAccessGroups($module)
Parameter Description
$module A module id or module entry.

getAccessLevel

Returns the permission level for a given module and item.

Return Value: The permission level for the given item or module (if item was not passed).

getAccessLevel($module, $item, $table, $user)
Parameter Description
$module The module id or entry to check access for.
$item (optional) The item of the module to check access for.
$table (optional) The group based table.
$user (optional) User array if checking for a user other than the logged in user.

getActionClass

Returns the button class for the given action and item.

Return Value: If the item isn't already featured, it would simply return "icon_featured" for the "feature" action.

static getActionClass($action, $item)
Parameter Description
$action The action for the item (edit, feature, approve, etc)
$item The entry to check the action for.

getArchivedNavigationByParent

Returns an alphabetic list of navigation that is archived under the given parent.

Return Value: An array of page entries.

static getArchivedNavigationByParent($parent)
Parameter Description
$parent The ID of the parent page

getAutoModuleActions

Return a list of module forms and views.
Used by the API for reconstructing forms and views.

Return Value: An array of module actions with "form" and "view" columns replaced with form and view data.

static getAutoModuleActions($module)
Parameter Description
$module The module id to pull forms/views for.

getBasicTemplates

Returns a list of non-routed templates ordered by position.

Return Value: An array of template entries.

getBasicTemplates($sort = "position DESC id ASC")
Parameter Description
$sort Sort order, defaults to positioned

getCachedAccessLevel

Returns the permission level for a given module and cached view entry.

Return Value: The permission level for the given item or module (if item was not passed).

getCachedAccessLevel($module, $item, $table)
Parameter Description
$module The module id or entry to check access for.
$item (optional) The item of the module to check access for.
$table (optional) The group based table.

getCachedFieldTypes

Caches available field types and returns them.

Return Value: Array of three arrays of field types (template, module, and callout).

static getCachedFieldTypes($split = false)
Parameter Description
$split Whether to split the field types into separate default / custom arrays (defaults to false)

getCallout

Returns a callout entry.

Return Value: A callout entry from callouts database with resources decoded.

static getCallout($id)
Parameter Description
$id The id of the callout.

getCalloutGroup

Returns a callout group entry from the callout groups database.

Return Value: A callout group entry.

static getCalloutGroup($id)
Parameter Description
$id The id of the callout group.

getCalloutGroups

Returns a list of callout groups sorted by name.

Return Value: An array of callout group entries from callout groups database.

static getCalloutGroups()

getCallouts

Returns a list of callouts.

Return Value: An array of callout entries from callouts database.

static getCallouts($sort = "position")
Parameter Description
$sort The order to return the callouts. Defaults to positioned.

getCalloutsAllowed

Returns a list of callouts the logged-in user is allowed access to.

Return Value: An array of callout entries from callouts database.

getCalloutsAllowed($sort = "position")
Parameter Description
$sort The order to return the callouts. Defaults to positioned.

getCalloutsInGroups

Returns a list of callouts in a given set of groups.

Return Value: An array of entries from the callouts database.

getCalloutsInGroups($groups, $auth = true)
Parameter Description
$groups An array of group IDs to retrieve callouts for.
$auth If set to true, only returns callouts the logged in user has access to. Defaults to true.

getChange

Get a pending change.

Return Value: A pending change entry from the bigtree_pending_changes table.

static getChange($id)
Parameter Description
$id The id of the pending change.

getContentAlerts

Gets a list of pages with content older than their Max Content Age that a user follows.

Return Value: An array of arrays containing a page title, path, and id.

getContentAlerts($user = false)
Parameter Description
$user The user id to pull alerts for or a user entry (defaults to the logged in user)

getExisting404

Checks for the existance of a 404 at a given source URL.

Return Value: An existing 404 or null if one is not found.

static getExisting404($url, $get_vars, $site_key = null)
Parameter Description
$url Source URL
$get_vars Source URL get vars
$site_key Optional site key for a multi-site environment.

getExtension

Returns information about a package or extension.

Return Value: A package/extension.

static getExtension($id)
Parameter Description
$id The package/extension ID.

getExtensions

Returns a list of installed/created extensions.

Return Value: An array of extensions.

static getExtensions($sort = "name ASC")
Parameter Description
$sort Column/direction to sort (defaults to name ASC)

getFeeds

Returns a list of feeds.

Return Value: An array of feed elements from the feeds database sorted by name.

static getFeeds($sort = "name ASC")
Parameter Description
$sort The sort direction, defaults to name.

getFieldType

Returns a field type.

Return Value: A field type entry with the "files" column decoded.

static getFieldType($id)
Parameter Description
$id The id of the file type.

getFieldTypes

Returns a list of field types.

Return Value: An array of entries from the field types database.

static getFieldTypes($sort = "name ASC")
Parameter Description
$sort The sort directon, defaults to name ASC.

getFullNavigationPath

Calculates the full navigation path for a given page ID.

Return Value: The navigation path (normally found in the "path" column in bigtree_pages).

static getFullNavigationPath($id)
Parameter Description
$id The page ID to calculate the navigation path for.

getHiddenNavigationByParent

Returns an alphabetic list of navigation that is hidden under the given parent.

Return Value: An array of page entries.

static getHiddenNavigationByParent($parent)
Parameter Description
$parent The ID of the parent page

getMessage

Returns a message from message center.
Verifies that the user calling this method is either the sender or a recipient.

Return Value: An entry from bigtree_messages.

getMessage($id)
Parameter Description
$id The id of the message.

getMessageChain

Gets a full chain of messages based on one ID in the chain

Return Value: An array of entries from bigtree_messages with the message entry that was requested having the "selected" column set.

getMessageChain($id)
Parameter Description
$id The ID of one message in the chain.

getMessages

Returns all a user's messages.

Return Value: An array containing "sent", "read", and "unread" keys that contain an array of messages each.

getMessages($user = false)
Parameter Description
$user Optional user ID (defaults to logged in user)

getModule

Returns an entry from the modules database.

Return Value: A module entry with the "gbp" column decoded.

static getModule($id)
Parameter Description
$id The id of the module.

getModuleAction

Returns an action entry from the modules database.

Return Value: A module action entry.

static getModuleAction($id)
Parameter Description
$id The id of the action.

getModuleActionByRoute

Returns an action entry from the modules database for the given module and route.

Return Value: A module action entry.

static getModuleActionByRoute($module, $route)
Parameter Description
$module The module to lookup an action for.
$route An array of routes of the action and extra commands.

getModuleActionForForm

Returns the related module action for an auto module form. Prioritizes edit action over add.

Return Value: A module action entry.

static getModuleActionForForm($form)
Parameter Description
$form The id of a form or a form entry.

getModuleActionForReport

Returns the related module action for an auto module report.

Return Value: A module action entry.

static getModuleActionForReport($report)
Parameter Description
$report The id of a report or a report entry.

getModuleActionForView

Returns the related module action for an auto module view.

Return Value: A module action entry.

static getModuleActionForView($view)
Parameter Description
$view The id of a view or a view entry.

getModuleActions

Returns a list of module actions in positioned order.

Return Value: An array of module action entries.

static getModuleActions($module)
Parameter Description
$module A module id or a module entry.

getModuleByClass

Returns a module entry for the given class name.

Return Value: A module entry with the "gbp" column decoded or false if a module was not found.

static getModuleByClass($class)
Parameter Description
$class A module class.

getModuleByRoute

Returns a module entry for the given route.

Return Value: A module entry with the "gbp" column decoded or false if a module was not found.

static getModuleByRoute($route)
Parameter Description
$route A module route.

getModuleEmbedForms

Gets embeddable forms from the modules database.

Return Value: An array of embeddable form entries from modules database with "fields" decoded.

static getModuleEmbedForms($sort = "title", $module = false)
Parameter Description
$sort The field to sort by.
$module Specific module to pull forms for (defaults to all modules).

getModuleForms

Gets forms from the modules database with fields decoded.

Return Value: An array of form entries from modules database with "fields" decoded.

static getModuleForms($sort = "title", $module = false)
Parameter Description
$sort The field to sort by.
$module Specific module to pull forms for (defaults to all modules).

getModuleGroup

Returns a module group entry from the module groups database.

Return Value: A module group entry.

static getModuleGroup($id)
Parameter Description
$id The id of the module group.

getModuleGroupByName

Returns a module group entry from the module groups database.

Return Value: A module group entry.

static getModuleGroupByName($name)
Parameter Description
$name The name of the module group.

getModuleGroupByRoute

Returns a module group entry from the module groups database.

Return Value: A module group entry.

static getModuleGroupByRoute($route)
Parameter Description
$route The route of the module group.

getModuleGroups

Returns a list of module groups.

Return Value: An array of module group entries from the module groups database.

static getModuleGroups($sort = "position DESC")
Parameter Description
$sort Sort by (defaults to positioned)

getModuleNavigation

Returns a list of module actions that are in navigation.

Return Value: An array of module actions from the modules database.

static getModuleNavigation($module)
Parameter Description
$module A module id or a module entry.

getModuleReports

Gets reports from the modules database.

Return Value: An array of report entries from the modules database.

static getModuleReports($sort = "title", $module = false)
Parameter Description
$sort The field to sort by.
$module Specific module to pull reports for (defaults to all modules).

getModules

Returns a list of modules.

Return Value: An array of entries from the modules database with an additional "group_name" column for the group the module is in.

getModules($sort = "id ASC", $auth = true)
Parameter Description
$sort The sort order (defaults to oldest first).
$auth If set to true, only returns modules the logged in user has access to. Defaults to true.

getModulesByGroup

Returns a list of modules in a given group.

Return Value: An array of entries from the modules database.

getModulesByGroup($group, $sort = "position DESC id ASC", $auth = true)
Parameter Description
$group The group to return modules for.
$sort The sort order (defaults to positioned)
$auth If set to true, only returns modules the logged in user has access to. Defaults to true.

getModuleViews

Returns a list of all views in the modules database.

Return Value: An array of view entries with "fields" decoded.

static getModuleViews($sort = "title", $module = false)
Parameter Description
$sort The column to sort by.
$module Specific module to pull views for (defaults to all modules).

getNaturalNavigationByParent

Returns a list of positioned navigation that is in navigation under the given parent.
Does not return module navigation.

Return Value: An array of page entries.

static getNaturalNavigationByParent($parent, $ = 1)
Parameter Description
$parent The ID of the parent page
$

getPageAccessLevel

Returns the access level for the logged in user to a given page.

Return Value: "p" for publisher, "e" for editor, false for no access.

getPageAccessLevel($page)
Parameter Description
$page The page id.

getPageAccessLevelByUser

Returns the access level for the given user to a given page.

Return Value: "p" for publisher, "e" for editor, false for no access.

getPageAccessLevelByUser($page, $user)
Parameter Description
$page The page id.
$user The user id.

getPageChanges

Returns pending changes for a given page.

Return Value: An entry from bigtree_pending_changes with changes decoded.

static getPageChanges($page)
Parameter Description
$page The page id.

getPageChildren

Returns all non-archived children of a given page.

Return Value: An array of pages.

static getPageChildren($page, $sort = "nav_title ASC")
Parameter Description
$page The page id to pull children for.
$sort The way to sort results. Defaults to nav_title ASC.

getPageLineage

Returns all the ids of pages above this page.

Return Value: Array of IDs

getPageLineage($page)
Parameter Description
$page Page ID

getPageIds

Returns all the IDs in bigtree_pages for pages that aren't archived.

Return Value: An array of page ids.

static getPageIds()

getPageIDForPath

Provides the page ID, commands array, routed status, GET variables, and URL hash for a given path array.

Return Value: - URL Hash

static getPageIDForPath($path, $previewing = false)
Parameter Description
$path An array of path elements from a URL
$previewing Whether we are previewing or not.

getPageOfSettings

Returns a page of settings the logged in user has access to.

Return Value: If the calling user is a developer, returns locked settings, otherwise they are left out.

getPageOfSettings($page = 1, $query = "", $sort = false)
Parameter Description
$page The page to return.
$query Optional query string to search against.
$sort Sort order. Defaults to name ASC.

getPageOfTags

Returns a page of tags.

Return Value: An array of entries from bigtree_users.

static getPageOfTags($page = 1, $query = "", $sort_column = "tag", $sort_direction = "ASC")
Parameter Description
$page The page of tags to return.
$query Optional query string to search against.
$sort_column Column to sort by
$sort_direction Direction to sort by

getPageOfUsers

Returns a page of users.

Return Value: An array of entries from bigtree_users.

static getPageOfUsers($page = 1, $query = "", $sort = "name ASC")
Parameter Description
$page The page of users to return.
$query Optional query string to search against.
$sort Order to sort the results by. Defaults to name ASC.

getPageRevision

Returns a version of a page from the bigtree_page_revisions table.

Return Value: A page version entry from the table.

static getPageRevision($id)
Parameter Description
$id The id of the page version.

getPageRevisions

Get all revisions for a page.

Return Value: An array of "saved" revisions and "unsaved" revisions.

static getPageRevisions($page)
Parameter Description
$page The page id to get revisions for.

getPages

Returns all pages from the database.

Return Value: Array of unmodified entries from bigtree_pages.

static getPages()

getPageSEORating

Returns the SEO rating for a page.

Return Value: - Fresh content - up to 10 points

static getPageSEORating($page, $content)
Parameter Description
$page A page array.
$content An array of resources.

getPendingChange

Returns a pending change from the bigtree_pending_changes table.

Return Value: A entry from the table with the "changes" column decoded.

static getPendingChange($id)
Parameter Description
$id The id of the change.

getPublishableChanges

Returns a list of changes that the logged in user has access to publish.

Return Value: An array of changes sorted by most recent.

getPublishableChanges($user = false)
Parameter Description
$user The user id to retrieve changes for. Defaults to the logged in user.

getPendingChanges

Returns a list of changes for a given user.

Return Value: An array of changes sorted by most recent.

getPendingChanges($user = false)
Parameter Description
$user The user id to retrieve changes for. Defaults to the logged in user.

getPendingNavigationByParent

Returns a list of pending pages under a given parent ordered by most recent.

Return Value: An array of pending page titles/ids.

static getPendingNavigationByParent($parent, $in_nav = true)
Parameter Description
$parent The ID of the parent page
$in_nav true returns pages in navigation, false returns hidden pages

getContentsOfResourceFolder

Returns a list of resources and subfolders in a folder.

Return Value: An array of two arrays - folders and resources.

static getContentsOfResourceFolder($folder, $sort = "date DESC")
Parameter Description
$folder The id of a folder or a folder entry.
$sort The column to sort the folder's files on (default: date DESC).

getResourceByFile

Returns a resource with the given file name.

Return Value: An entry from bigtree_resources with file and thumbs decoded.

static getResourceByFile($file)
Parameter Description
$file The file name.

getResource

Returns a resource.

Return Value: A resource entry.

static getResource($id)
Parameter Description
$id The id of the resource.

getResourceAllocation

Returns the places a resource is used.

Return Value: An array of entries from the bigtree_resource_allocation table.

static getResourceAllocation($id)
Parameter Description
$id The id of the resource.

getResourceFolder

Returns a resource folder.

Return Value: A resource folder entry.

static getResourceFolder($id)
Parameter Description
$id The id of the folder.

getResourceFolderAllocationCounts

Returns the number of items inside a folder and it's subfolders and the number of allocations of the contained resources.

Return Value: A keyed array of "resources", "folders", and "allocations" for the number of resources, sub folders, and allocations.

static getResourceFolderAllocationCounts($folder)
Parameter Description
$folder The id of the folder.

getResourceFolderBreadcrumb

Returns a breadcrumb of the given folder.

Return Value: An array of arrays containing the name and id of folders above.

static getResourceFolderBreadcrumb($folder)
Parameter Description
$folder The id of a folder or a folder entry.

getResourceFolderChildren

Returns the child folders of a resource folder.

Return Value: An array of resource folder entries.

static getResourceFolderChildren($id)
Parameter Description
$id The id of the parent folder.

getResourceFolderPermission

Returns the permission level of the current user for the folder.

Return Value: "p" if a user can create folders and upload files, "e" if the user can see/use files, "n" if a user can't access this folder.

getResourceFolderPermission($folder)
Parameter Description
$folder The id of a folder or a folder entry.

getRoutedTemplates

Returns a list of routed templates ordered by position that the logged in user has access to.

Return Value: An array of template entries.

getRoutedTemplates($sort = "position DESC id ASC")
Parameter Description
$sort Sort order, defaults to positioned

getSetting

Returns a setting.

Return Value: Returns false if the setting could not be found.

static getSetting($id, $decode = true)
Parameter Description
$id The id of the setting to return.
$decode Whether to decode the array or not. Large data sets may want to set this to false if there aren't internal page links.

getSettings

Returns a list of all settings that the logged in user has access to.

Return Value: If the calling user is a developer, returns locked settings, otherwise they are left out.

getSettings($sort = "name ASC")
Parameter Description
$sort Order to return the settings. Defaults to name ASC.

getSettingsPageCount

Returns the number of pages of settings that the logged in user has access to.

Return Value: The number of pages of settings.

getSettingsPageCount($query = "")
Parameter Description
$query Optional string to query against.

getTag

Returns a tag for the given id.

Return Value: A bigtree_tags entry.

static getTag($id)
Parameter Description
$id The id of the tag.

getTagsPageCount

Returns the number of pages of tags.

Return Value: An integer.

static getTagsPageCount($query = "")
Parameter Description
$query Optional query to search against.

getTemplates

Returns a list of templates.

Return Value: An array of template entries.

static getTemplates($sort = "position")
Parameter Description
$sort Sort order, defaults to positioned.

getUniqueModuleRoute

Returns an available module route based on the desired route.

Return Value: A string

getUniqueModuleRoute($route)
Parameter Description
$route A route string

getUnreadMessageCount

Returns the number of unread messages for the logged in user.

Return Value: The number of unread messages.

getUnreadMessageCount()

getUser

Gets a user's decoded information.

Return Value: A user entry from bigtree_users with permissions and alerts decoded.

static getUser($id)
Parameter Description
$id The id of the user to return.

getUserByEmail

Gets a user entry for a given email.

Return Value: A user entry from bigtree_users.

static getUserByEmail($email)
Parameter Description
$email The email to find.

getUserByHash

Gets a user entry for a change password hash.

Return Value: A user entry from bigtree_users.

static getUserByHash($hash)
Parameter Description
$hash The hash to find.

getUsers

Returns a list of all users.

Return Value: The keys of the array are the ids of the user.

static getUsers($sort = "name ASC")
Parameter Description
$sort Order to sort the list. Defaults to name ASC.

getUsersPageCount

Returns the number of pages of users.

Return Value: The number of pages of results.

static getUsersPageCount($query = "")
Parameter Description
$query Optional query string to search against.

growl

Sets up a growl session for the next page reload.

static growl($title, $message, $type = "success")
Parameter Description
$title The section message for the growl.
$message The description of what happened.
$type The icon to draw.

handleOpenGraph

Handles open graph updates for a piece of data.

Return Value: An array of data if pending flag is true, otherwise the ID of the open graph table entry

static handleOpenGraph($table, $id, $data_source = null, $pending = false)
Parameter Description
$table The table for the entry
$id The ID of the entry
$data_source Data Source (defaults to $_POST["_open_graph_"] if left empty)
$pending Whether this is a pending entry, if true returns the array of pending data to store

htmlClean

Removes things that shouldn't be in the <body> of an HTML document from a string.

Return Value: A clean string of HTML for echoing in

static htmlClean($html)
Parameter Description
$html A string of HTML

ignore404

Ignores a 404 error.
Checks permissions.

ignore404($id)
Parameter Description
$id The id of the reported 404.

initSecurity

Sets up security environment variables and runs white/blacklists for IP checks.

initSecurity()

installExtension

Installs an extension.

Return Value: Modified manifest array.

installExtension($manifest, $upgrade = false)
Parameter Description
$manifest Manifest array
$upgrade Old manifest array (if doing an upgrade, otherwise leave false)

iplExists

Determines whether an internal page link still exists or not.

Return Value: True if it is still a valid link, otherwise false.

static iplExists($ipl)
Parameter Description
$ipl An internal page link

irlExists

Determines whether an internal resource link still exists or not.

Return Value: True if it is still a valid link, otherwise false.

static irlExists($irl)
Parameter Description
$irl An internal resource link

isIPBanned

Checks to see if the requesting IP address is banned and should not be allowed to attempt login.

Return Value: true if the IP is banned

static isIPBanned()

isUserBanned

Checks to see if the logging in user is banned and should not be allowed to attempt login.

Return Value: true if the user is banned

static isUserBanned($user)
Parameter Description
$user A user ID

lockCheck

Checks if a lock exists.
If a lock exists and it's currently active, stops page execution and shows the lock page.
If a lock is yours, refreshes the lock.
If there is no lock, creates one for you.

Return Value: Your lock id.

lockCheck($table, $id, $include, $force = false, $in_admin = true)
Parameter Description
$table The table to check.
$id The id of the entry to check.
$include The lock page to include (relative to /core/ or /custom/)
$force Whether to force through the lock or not.
$in_admin Whether to call stop()

login

Attempts to login a user to the CMS.

Return Value: false if login failed, otherwise redirects back to the page the person requested.

static login($email, $password, $stay_logged_in = false, $domain = null, $two_factor_token = null)
Parameter Description
$email The email address of the user.
$password The password of the user.
$stay_logged_in Whether to set a cookie to keep the user logged in.
$domain A secondary domain to set login cookies for (used for multi-site).
$two_factor_token A token for a login that is already in progress with 2FA.

login2FA

Verifies an authorization token matches the user's secret and logs them in if successful.

Return Value: true if login fails, otherwise redirects

login2FA($token, $bypass = false)
Parameter Description
$token A time based token
$bypass For first time setup, bypass code check

logout

Logs out of the CMS.
Destroys the user's session and unsets the login cookies, then sends the user back to the login page.

static logout()

logoutAll

Logs all users out of the CMS.
Requires the "db" state for sessions.

logoutAll()

makeIPL

Creates an internal page link out of a URL.

Return Value: An internal page link (if possible) or just the same URL (if it's not internal).

static makeIPL($url)
Parameter Description
$url A URL

markMessageRead

Marks a message as read by the currently logged in user.

markMessageRead($id)
Parameter Description
$id The message id.

mergeTags

Merges a set of tags into a single tag and updates references.

Return Value: true if successful

mergeTags($tag, $merge_tags)
Parameter Description
$tag A tag ID that will consume the other tags
$merge_tags An array of tag IDs that will be consumed

pageChangeExists

Returns whether pending changes exist for a given page.

Return Value: true or false

static pageChangeExists($page)
Parameter Description
$page The page id.

parse404SourceURL

Parses a user's 404 source URL based on site key.

Return Value: An array containing the sanitized source URL for input into bigtree_404s and GET variables from the URL.

static parse404SourceURL($source, $site_key = null)
Parameter Description
$source Source URL or URL fragment
$site_key Optional site key

pingSearchEngines

Sends the latest sitemap.xml out to search engine ping services if enabled in settings.

static pingSearchEngines()

processCrop

Processes a single crop of a crop set.

static processCrop($crop_key, $index, $x, $y, $width, $height)
Parameter Description
$crop_key A cache key pointing to the location of crop data.
$index The crop to process
$x Starting x point of the crop
$y Starting y point of the crop
$width Width of the crop
$height Height of the crop

processCrops

Processes a list of cropped images.

static processCrops($crop_key)
Parameter Description
$crop_key A cache key pointing to the location of crop data.

processField

A helper function for field type processing.

Return Value: Field output.

static processField($field)
Parameter Description
$field Field information

processImageUpload

Processes image upload data for form fields.
If you're emulating field information, the following keys are of interest in the field array:
"file_input" - a keyed array that needs at least "name" and "tmp_name" keys that contain the desired name of the file and the source file location, respectively.
"settings" - a keyed array of options for the field, keys of interest for photo processing are:
"min_height" - Minimum Height required for the image
"min_width" - Minimum Width required for the image
"retina" - Whether to try to create a 2x size image when thumbnailing / cropping (if the source file / crop is large enough)
"thumbs" - An array of thumbnail arrays, each of which has "prefix", "width", "height", and "grayscale" keys (prefix is prepended to the file name when creating the thumbnail, grayscale will make the thumbnail grayscale)
"crops" - An array of crop arrays, each of which has "prefix", "width", "height" and "grayscale" keys (prefix is prepended to the file name when creating the crop, grayscale will make the thumbnail grayscale)). Crops can also have their own "thumbs" key that creates thumbnails of each crop (format mirrors that of "thumbs")

static processImageUpload($field, $replace = false, $force_local_replace = false)
Parameter Description
$field Field information (normally set to $field when running a field type's process file)
$replace If not looking for a unique filename (e.g. replacing an existing image) pass truthy value
$force_local_replace If replacing a file, replace a local filepath regardless of default storage (defaults to false)

rectifyResourceTypeChange

Verifies that existing data for a resource set will fit with the new resource set.

Return Value: An array of fields which should force re-crops

rectifyResourceTypeChange($data, $new_resources, $old_resources)
Parameter Description
$data Data, passed by reference and modified upon return
$new_resources The resource fields for the data set to conform to
$old_resources The resource fields the data set originated in

refreshLock

Refreshes a lock.

refreshLock($table, $id)
Parameter Description
$table The table for the lock.
$id The id of the item.

remove2FASecret

Removes two factor authentication from a user.

remove2FASecret($user)
Parameter Description
$user A user ID

requireAccess

Checks the logged in user's access to a given module.
Throws a permission denied page and stops page execution if the user doesn't have access.

Return Value: The permission level of the logged in user.

requireAccess($module)
Parameter Description
$module The id of the module to check access to.

requireLevel

Requires the logged in user to have a certain access level to continue.
Throws a permission denied page and stops page execution if the user doesn't have access.

requireLevel($level)
Parameter Description
$level An access level (0 being normal user, 1 being administrator, 2 being developer)

requirePublisher

Checks the logged in user's access to a given module to make sure they are a publisher.
Throws a permission denied page and stops page execution if the user doesn't have access.

requirePublisher($module)
Parameter Description
$module The id of the module to check access to.

runHooks

Runs extension hooks of a given type for a given context.

Return Value: Data modified by hook script

runHooks($type, $context = "", $data = "", $data_context = [])
Parameter Description
$type Hook type
$context Hook context
$data Data to modify (will be returned modified)
$data_context Additional data context (will be global variables in the context of the hook, not returned)

saveCurrentPageRevision

Saves the currently published page as a revision.

Return Value: The new revision id.

saveCurrentPageRevision($page, $description)
Parameter Description
$page The page id.
$description The revision description.

search404s

Searches 404s, returns results.

Return Value: An array of entries from bigtree_404s.

static search404s($type, $query = "", $page = 1, $site_key = null)
Parameter Description
$type The type of results (301, 404, or ignored).
$query The search query.
$page The page to return.
$site_key The site key to return 404s for (leave null for all 404s).

searchAuditTrail

Searches the audit trail for a set of data.

Return Value: An array of adds/edits/deletions from the audit trail.

static searchAuditTrail($user = false, $table = false, $entry = false, $start = false, $end = false)
Parameter Description
$user User to restrict results to (optional)
$table Table to restrict results to (optional)
$entry Entry to restrict results to (optional)
$start Start date/time to restrict results to (optional)
$end End date/time to restrict results to (optional)

searchPages

Searches for pages.

Return Value: An array of pages.

static searchPages($query, $fields, $max)
Parameter Description
$query Query string to search against.
$fields Fields to search.
$max Maximum number of results to return.

searchResources

Returns a list of folders and files that match the given query string.

Return Value: An array of two arrays - folders and files - with permission levels.

searchResources($query, $sort = "date DESC")
Parameter Description
$query A string of text to search folders' and files' names to.
$sort The column to sort the files on (default: date DESC).

searchTags

Finds existing tags that are similar.

Return Value: An array of up to 8 similar tags.

static searchTags($tag, $full_row = false)
Parameter Description
$tag A tag to find similar tags for.
$full_row Set to true to return a whole tag row rather than just the name (defaults to false)

set404Redirect

Sets the redirect address for a 404.
Checks permissions.

set404Redirect($id, $url)
Parameter Description
$id The id of the 404.
$url The redirect URL.

setCalloutPosition

Sets the position of a callout.

static setCalloutPosition($id, $position)
Parameter Description
$id The id of the callout.
$position The position to set.

setModuleActionPosition

Sets the position of a module action.

static setModuleActionPosition($id, $position)
Parameter Description
$id The id of the module action.
$position The position to set.

setModuleGroupPosition

Sets the position of a module group.

static setModuleGroupPosition($id, $position)
Parameter Description
$id The id of the module group.
$position The position to set.

setModulePosition

Sets the position of a module.

static setModulePosition($id, $position)
Parameter Description
$id The id of the module.
$position The position to set.

setPagePosition

Sets the position of a page.

static setPagePosition($id, $position)
Parameter Description
$id The id of the page.
$position The position to set.

setPasswordHashForUser

Creates a change password hash for a user.

Return Value: A change password hash.

static setPasswordHashForUser($user)
Parameter Description
$user A user entry.

setTemplatePosition

Sets the position of a template.

static setTemplatePosition($id, $position)
Parameter Description
$id The id of the template.
$position The position to set.

settingExists

Determines whether a setting exists for a given id.

Return Value: 1 if the setting exists, otherwise 0.

static settingExists($id)
Parameter Description
$id The setting id to check for.

stop

Stops processing of the Admin area and shows a message in the default layout.

stop($message = "")
Parameter Description
$message Content to show (error, permission denied, etc)

stripMultipleRootTokens

Strips the multi-domain root tokens from a string and replaces them with standard {wwwroot} and {staticroot}

Return Value: A modified string.

static stripMultipleRootTokens($string)
Parameter Description
$string A string

submitPageChange

Adds a pending change to the bigtree_pending_changes table for the page.
Determines what has changed and only stores the changed fields.
Does not check permissions.

submitPageChange($page, $changes)
Parameter Description
$page The page id or pending page id (prefixed with a "p")
$changes An array of changes

track

Logs a user's actions to the audit trail table.

track($table, $entry, $type, $ = null)
Parameter Description
$table The table affected by the user.
$entry The primary key of the entry affected by the user.
$type The action taken by the user (delete, edit, create, etc.)
$

unarchivePage

Unarchives a page and all its children that inherited archived status.
Checks permissions.

Return Value: true if successful. false if permission was denied.

unarchivePage($page)
Parameter Description
$page The page id or page entry.

unarchivePageChildren

Unarchives a page's children that have the archived_inherited status.
Does not checks permissions.

unarchivePageChildren($id)
Parameter Description
$id The parent page id.

ungrowl

Destroys the growl session.

static ungrowl()

urlExists

Attempts to connect to a URL using cURL.
This is now an alias for BigTree::urlExists

Return Value: true if it can connect, false if connection failed.

static urlExists($url)
Parameter Description
$url The URL to connect to.

unCache

Removes the cached copy of a given page.

static unCache($page)
Parameter Description
$page Either a page id or a page entry.

unignore404

Unignores a 404.
Checks permissions.

unignore404($id)
Parameter Description
$id The id of the 404.

uniqueModuleActionRoute

Returns a unique module action route.

Return Value: A unique action route.

static uniqueModuleActionRoute($module, $route, $action = false)
Parameter Description
$module The module to create a route for.
$route The desired route.
$action The ID of the action you're trying to set a new route for (optional)

unlock

Removes a lock from a table entry.

static unlock($table, $id)
Parameter Description
$table The table the entry is in.
$id The id of the entry.

updateCallout

Updates a callout.

updateCallout($id, $name, $description, $level, $resources, $display_field, $display_default)
Parameter Description
$id The id of the callout to update.
$name The name.
$description The description.
$level The access level (0 for all users, 1 for administrators, 2 for developers)
$resources An array of resources.
$display_field The field to use as the display field describing a user's callout
$display_default The text string to use in the event the display_field is blank or non-existent

updateCalloutGroup

Updates a callout group's name and callout list.

updateCalloutGroup($id, $name, $callouts)
Parameter Description
$id The id of the callout group to update.
$name The name.
$callouts An array of callout IDs to assign to the group.

updateChildPagePaths

Updates the paths for pages who are descendants of a given page to reflect the page's new route.
Also sets route history if the page has changed paths.

static updateChildPagePaths($page)
Parameter Description
$page The page id.

updateFeed

Updates a feed.

updateFeed($id, $name, $description, $table, $type, $settings, $fields)
Parameter Description
$id The id of the feed to update.
$name The name.
$description The description.
$table The data table.
$type The feed type.
$settings The feed type settings.
$fields The fields.

updateFieldType

Updates a field type.

updateFieldType($id, $name, $use_cases, $self_draw)
Parameter Description
$id The id of the field type.
$name The name.
$use_cases Associate array of sections in which the field type can be used (i.e. array("pages" => "on", "modules" => "","callouts" => "","settings" => ""))
$self_draw Whether this field type will draw its
and

updateInternalSettingValue

Updates the value of an internal BigTree setting.

static updateInternalSettingValue($id, $value, $encrypted = false)
Parameter Description
$id The id of the setting to update.
$value A value to set (can be a string or array).
$encrypted Whether the value should be encrypted (defaults to false).

updateModule

Updates a module.

updateModule($id, $name, $group, $class, $permissions, $icon)
Parameter Description
$id The id of the module to update.
$name The name of the module.
$group The group for the module.
$class The module class to create.
$permissions The group-based permissions.
$icon The icon to use.

updateModuleAction

Updates a module action.

updateModuleAction($id, $name, $route, $in_nav, $icon, $form, $view, $report, $level, $position)
Parameter Description
$id The id of the module action to update.
$name The name of the action.
$route The action route.
$in_nav Whether the action is in the navigation.
$icon The icon class for the action.
$form The associated form.
$view The associated view.
$report The associated report.
$level The required access level.
$position The position in navigation.

updateModuleEmbedForm

Updates an embeddable form.

updateModuleEmbedForm($id, $title, $table, $fields, $hooks, $default_position, $default_pending, $css, $redirect_url, $thank_you_message)
Parameter Description
$id The ID of the form.
$title The title of the form.
$table The table for the form data.
$fields The form fields.
$hooks An array of "pre", "post", and "publish" keys that can be function names to call
$default_position Default position for entries to the form (if the view is positioned).
$default_pending Whether the submissions to default to pending or not ("on" or "").
$css URL of a CSS file to include.
$redirect_url The URL to redirect to upon completion of submission.
$thank_you_message The message to display upon completeion of submission.

updateModuleForm

Updates a module form.

updateModuleForm($id, $title, $table, $fields, $hooks, $default_position, $return_view, $return_url, $tagging, $open_graph)
Parameter Description
$id The id of the form.
$title The title of the form.
$table The table for the form data.
$fields The form fields.
$hooks An array of "pre", "post", and "publish" keys that can be function names to call
$default_position Default position for entries to the form (if the view is positioned).
$return_view The view to return to when the form is completed.
$return_url The alternative URL to return to when the form is completed.
$tagging Whether or not to enable tagging.
$open_graph Whether or not to enable open graph attributes.

updateModuleGroup

Updates a module group's name.

updateModuleGroup($id, $name)
Parameter Description
$id The id of the module group to update.
$name The name of the module group.

updateModuleReport

Updates a module report.

updateModuleReport($id, $title, $table, $type, $filters, $fields = "", $parser = "", $view = "")
Parameter Description
$id The ID of the report to update.
$title The title of the report.
$table The table for the report data.
$type The type of report (csv or view).
$filters The filters a user can use to create the report.
$fields The fields to show in the CSV export (if type = csv).
$parser An optional parser function to run on the CSV export data (if type = csv).
$view A module view ID to use (if type = view).

updateModuleView

Updates a module view.

Return Value: The id for view.

updateModuleView($id, $title, $description, $table, $type, $settings, $fields, $actions, $related_form, $preview_url = "", $exclude_from_search = false)
Parameter Description
$id The view id.
$title View title.
$description Description.
$table Data table.
$type View type.
$settings View settings array.
$fields Field array.
$actions Actions array.
$related_form Form ID to handle edits.
$preview_url Optional preview URL.
$exclude_from_search Excludes view data from admin search.

updateModuleViewColumnNumericStatusForTable

Updates module view columns to designate whether they are numeric or not based on parsers, column type, and related forms.

static updateModuleViewColumnNumericStatusForTable($table)
Parameter Description
$table A table to update view columns for

updateModuleViewFields

Updates the fields for a module view.

updateModuleViewFields($view, $fields)
Parameter Description
$view The view id.
$fields A fields array.

updatePage

Updates a page.
Checks some (but not all) permissions.

updatePage($page, $data)
Parameter Description
$page The page id to update.
$data The page data to update with.

updatePageParent

Changes a page's parent.
Checks permissions.

updatePageParent($page, $parent)
Parameter Description
$page The page to update.
$parent The parent to switch to.

updatePageRevision

Updates a page revision to save it as a favorite.
Checks permissions.

updatePageRevision($id, $description)
Parameter Description
$id The page revision id.
$description Saved description.

updatePendingChange

Updates a pending change.

updatePendingChange($id, $changes, $mtm_changes, $tags_changes)
Parameter Description
$id The id of the pending change.
$changes The changes to the fields in the entry.
$mtm_changes Many to Many changes.
$tags_changes Tags changes.

updateTagReferenceCounts

Updates the reference counts for tags to accurately match active database entries.

static updateTagReferenceCounts($tags)
Parameter Description
$tags An array of tag IDs to update reference counts for (defaults to all tags)

updateProfile

Updates a user's name, company, digest setting, and (optionally) password.

updateProfile($data)
Parameter Description
$data Array containing name / company / daily_digest / password.

updateResource

Updates a resource.

updateResource($id, $data)
Parameter Description
$id The id of the resource.
$data A key/value array of fields to update.

updateResourceAllocation

Updates resource allocation to move pending changes to the live entry.

updateResourceAllocation($table, $entry, $pending_id)
Parameter Description
$table Table the entry is in
$entry Entry ID
$pending_id The pending entry ID

updateResourceFolder

Updates a resource folder.

updateResourceFolder($id, $name, $parent = null)
Parameter Description
$id The id of the resource folder.
$name The new name for the resource folder.
$parent The new parent for the resource folder.

updateSetting

Updates a setting.

Return Value: true if successful, false if a setting exists for the new id already.

updateSetting($old_id, $data)
Parameter Description
$old_id The current id of the setting to update.
$data The new data for the setting ("id", "type", "name", "description", "locked", "system", "encrypted")

updateSettingValue

Updates the value of a setting.

static updateSettingValue($id, $value)
Parameter Description
$id The id of the setting to update.
$value A value to set (can be a string or array).

updateTemplate

Updates a template.

updateTemplate($id, $name, $level, $module, $resources, $hooks = [])
Parameter Description
$id The id of the template to update.
$name Name
$level Access level (0 for everyone, 1 for administrators, 2 for developers)
$module Related module id
$resources An array of resources
$hooks An array of hooks

updateUser

Updates a user.

Return Value: True if successful. False if the logged in user doesn't have permission to change the user or there was an email collision.

updateUser($id, $data)
Parameter Description
$id The user's "id"
$data A key/value array containing email, name, company, level, permissions, alerts, daily_digest, and (optionally) password.

updateUserPassword

Updates a user's password.

static updateUserPassword($id, $password)
Parameter Description
$id The user's id.
$password The new password.

validatePassword

Validates a password against the security policy.

Return Value: true if it passes all password criteria.

static validatePassword($password)
Parameter Description
$password Password to validate.

verifyCSRFToken

Verifies the referring host and session token and stops processing if they fail.

verifyCSRFToken()

verifyLogin2FA

Verifies a username and password and returns the two factor auth secret.

Return Value: The two factor auth secret for the user or null if login failed.

static verifyLogin2FA($email, $password)
Parameter Description
$email Email address
$password Password

versionToDecimal

Returns a decimal number of a BigTree version for numeric comparisons.

Return Value: A number

static versionToDecimal($version)
Parameter Description
$version BigTree version number (i.e. 4.2.0)