Functions
Function | Description |
---|---|
cacheDelete |
Deletes data from BigTree's cache table. |
cacheGet |
Retrieves data from BigTree's cache table. |
cachePut |
Puts data into BigTree's cache table. |
cacheUnique |
Puts data into BigTree's cache table with a random unqiue key and returns the key. |
catch404 |
Manually catch and display the 404 page from a routed template; logs missing page with handle404 |
checkOldRoutes |
Checks the old route table, redirects if the page is found. |
decodeResources |
Turns the JSON resources data into a PHP array of resources with links being translated into front-end readable links. |
drawHeadTags |
Draws the <title>, meta description, and open graph tags for the given context. |
drawXMLSitemap |
Outputs an XML sitemap. |
extensionSettingCheck |
Checks to see if we're in an extension and if we're requesting a setting attached to it. |
generateReplaceableRoots |
Caches a list of tokens and the values that are related to them. |
getBreadcrumb |
Returns an array of titles, links, and ids for pages above and including the current page. |
getBreadcrumbByPage |
Returns an array of titles, links, and ids for the pages above and including the given page. |
getFeed |
Gets a feed's information from the database. |
getFeedByRoute |
Gets a feed's information from the database |
getHiddenNavByParent |
Returns an alphabetical list of pages that are not visible in navigation. |
getInternalPageLink |
Returns a hard link to the page's publicly accessible URL from its encoded soft link URL. |
getLink |
Returns the public link to a page in the database. |
getNavByParent |
Returns a multi-level navigation array of pages visible in navigation |
getNavId |
Provides the page ID for a given path array. |
getOpenGraph |
Returns Open Graph data for the specified table/id combination. |
getPage |
Returns a page along with its resources and callouts decoded. |
getPendingPage |
Returns a page along with pending changes applied. |
getPreviewLink |
Returns a URL to where this page can be previewed. |
getRelatedPagesByTags |
Returns pages related to the given set of tags. |
getResource |
Returns a resource. |
getSetting |
Gets the value of a setting. |
getSettings |
Gets the value of multiple settings. |
getTag |
Returns a tag for a given tag id. |
getTagByRoute |
Returns a tag for a given tag route. |
getTagsForPage |
Returns a list of tags the page was tagged with. |
getTemplate |
Returns a template from the database with resources decoded. |
getToplevelNavigationId |
Returns the highest level ancestor for the current page. |
getToplevelNavigationIdForPage |
Returns the highest level ancestor for a given page. |
handle404 |
Handles a 404. |
linkForPath |
Returns a correct link for a page's path for the current site in a multi-domain setup. |
makeSecure |
Forces the site into Secure mode. |
replaceHardRoots |
Replaces all hard roots in a URL with relative ones (i.e. {wwwroot}). |
replaceInternalPageLinks |
Replaces the internal page links in an HTML block with hard links. |
replaceRelativeRoots |
Replaces all relative roots in a URL (i.e. {wwwroot}) with hard links. |
setHeadContext |
Sets the context for the drawHeadTags method. |
urlify |
Turns a string into one suited for URL routes. |
cacheDelete
Deletes data from BigTree's cache table.
static cacheDelete($identifier, $key = false)
Parameter | Description |
---|---|
$identifier |
Uniquid identifier for your data type (i.e. org.bigtreecms.geocoding) |
$key |
The key for your data (if no key is passed, deletes all data for a given identifier) |
cacheGet
Retrieves data from BigTree's cache table.
Return Value: Data from the table (json decoded, objects convert to keyed arrays) if it exists or false.
static cacheGet($identifier, $key, $max_age = false, $decode = true)
Parameter | Description |
---|---|
$identifier |
Uniquid identifier for your data type (i.e. org.bigtreecms.geocoding) |
$key |
The key for your data. |
$max_age |
The maximum age (in seconds) for the data, defaults to any age. |
$decode |
Decode JSON (defaults to true, specify false to return JSON) |
cachePut
Puts data into BigTree's cache table.
Return Value: True if successful, false if the indentifier/key combination already exists and replace was set to false.
static cachePut($identifier, $key, $value, $replace = true)
Parameter | Description |
---|---|
$identifier |
Uniquid identifier for your data type (i.e. org.bigtreecms.geocoding) |
$key |
The key for your data. |
$value |
The data to store. |
$replace |
Whether to replace an existing value (defaults to true). |
cacheUnique
Puts data into BigTree's cache table with a random unqiue key and returns the key.
Return Value: They unique cache key.
static cacheUnique($identifier, $value)
Parameter | Description |
---|---|
$identifier |
Uniquid identifier for your data type (i.e. org.bigtreecms.geocoding) |
$value |
The data to store |
catch404
Manually catch and display the 404 page from a routed template; logs missing page with handle404
static catch404()
checkOldRoutes
Checks the old route table, redirects if the page is found.
static checkOldRoutes($path)
Parameter | Description |
---|---|
$path |
An array of routes |
decodeResources
Turns the JSON resources data into a PHP array of resources with links being translated into front-end readable links.
This function is called by BigTree's router and is generally not a function needed to end users.
Return Value: An array of resources.
static decodeResources($data)
Parameter | Description |
---|---|
$data |
JSON encoded callout data. |
drawHeadTags
Draws the <title>, meta description, and open graph tags for the given context.
The context defaults to the current page and can be changed via BigTreeCMS::setHeadContext
static drawHeadTags($site_title = "", $divider = "|")
Parameter | Description |
---|---|
$site_title |
A site title that draws after the page title if entered, also used for og:site_name |
$divider |
The divider between the page title and site title, defaults to | |
drawXMLSitemap
Outputs an XML sitemap.
static drawXMLSitemap()
extensionSettingCheck
Checks to see if we're in an extension and if we're requesting a setting attached to it.
For example, if "test-setting" is requested and "com.test.extension*test-setting" exists it will be used.
Return Value: An extension setting ID if one is found.
static extensionSettingCheck($id)
Parameter | Description |
---|---|
$id |
Setting id |
generateReplaceableRoots
Caches a list of tokens and the values that are related to them.
static generateReplaceableRoots()
getBreadcrumb
Returns an array of titles, links, and ids for pages above and including the current page.
Return Value: An array of arrays with "title", "link", and "id" of each of the pages above the current (or passed in) page.
static getBreadcrumb($ignore_trunk = false)
Parameter | Description |
---|---|
$ignore_trunk |
Ignores trunk settings when returning the breadcrumb |
getBreadcrumbByPage
Returns an array of titles, links, and ids for the pages above and including the given page.
Return Value: If a trunk is hit, BigTreeCMS::$BreadcrumbTrunk is set to the trunk.
static getBreadcrumbByPage($page, $ignore_trunk = false)
Parameter | Description |
---|---|
$page |
A page array (containing at least the "path" from the database) *(optional)* |
$ignore_trunk |
Ignores trunk settings when returning the breadcrumb |
getFeed
Gets a feed's information from the database.
Return Value: An array of feed information.
static getFeed($id)
Parameter | Description |
---|---|
$id |
A feed ID |
getFeedByRoute
Gets a feed's information from the database
Return Value: An array of feed information with settings and fields decoded from JSON.
static getFeedByRoute($route)
Parameter | Description |
---|---|
$route |
The route of the feed to pull. |
getInternalPageLink
Returns a hard link to the page's publicly accessible URL from its encoded soft link URL.
Return Value: Public facing URL.
static getInternalPageLink($ipl)
Parameter | Description |
---|---|
$ipl |
Internal Page Link (ipl://, irl://, {wwwroot}, or regular URL encoding) |
getLink
Returns the public link to a page in the database.
Return Value: Public facing URL.
static getLink($id)
Parameter | Description |
---|---|
$id |
The ID of the page. |
getOpenGraph
Returns Open Graph data for the specified table/id combination.
Paremeters:
table - The table for the entry
id - The ID of the entry
Return Value: An array of Open Graph data.
static getOpenGraph()
getPage
Returns a page along with its resources and callouts decoded.
Return Value: A page array from the database.
static getPage($id, $decode = true)
Parameter | Description |
---|---|
$id |
The ID of the page. |
$decode |
Whether to decode resources and callouts or not and retrieve open graph info (setting to false saves processing time) |
getPendingPage
Returns a page along with pending changes applied.
Return Value: A page array from the database.
static getPendingPage($id, $decode = true, $return_tags = false)
Parameter | Description |
---|---|
$id |
The ID of the page. |
$decode |
Whether to decode resources and callouts or not (setting to false saves processing time, defaults true). |
$return_tags |
Whether to return tags for the page (defaults false). |
getPreviewLink
Returns a URL to where this page can be previewed.
Return Value: A URL.
static getPreviewLink($id)
Parameter | Description |
---|---|
$id |
The ID of the page (or pending page) |
getRelatedPagesByTags
Returns pages related to the given set of tags.
Return Value: An array of related pages sorted by relevance (how many tags get matched).
static getRelatedPagesByTags($tags)
Parameter | Description |
---|---|
$tags |
An array of tags to search for. |
getResource
Returns a resource.
Return Value: A resource entry.
static getResource($id)
Parameter | Description |
---|---|
$id |
The id of the resource. |
getSetting
Gets the value of a setting.
Return Value: A string or array of the setting's value.
static getSetting($id)
Parameter | Description |
---|---|
$id |
The ID of the setting. |
getSettings
Gets the value of multiple settings.
Return Value: Array containing the string or array of each setting's value.
static getSettings($id)
Parameter | Description |
---|---|
$id |
Array containing the ID of the settings. |
getTag
Returns a tag for a given tag id.
Return Value: A tag entry from bigtree_tags.
static getTag($id)
Parameter | Description |
---|---|
$id |
The id of the tag to retrieve. |
getTagByRoute
Returns a tag for a given tag route.
Return Value: A tag entry from bigtree_tags.
static getTagByRoute($route)
Parameter | Description |
---|---|
$route |
The route of the tag to retrieve. |
getTagsForPage
Returns a list of tags the page was tagged with.
Return Value: An array of tags.
static getTagsForPage($page, $full = true)
Parameter | Description |
---|---|
$page |
Either a page array (containing at least the page's ID) or a page ID. |
$full |
Whether to return a full tag array or just the tag string (defaults to full tag array) |
getTemplate
Returns a template from the database with resources decoded.
Return Value: The template row from the database with resources decoded.
static getTemplate($id)
Parameter | Description |
---|---|
$id |
The ID of the template. |
handle404
Handles a 404.
static handle404($url)
Parameter | Description |
---|---|
$url |
The URL you hit that's a 404. |
linkForPath
Returns a correct link for a page's path for the current site in a multi-domain setup.
Return Value: A fully qualified URL
static linkForPath($path)
Parameter | Description |
---|---|
$path |
A page path |
makeSecure
Forces the site into Secure mode.
When Secure mode is enabled, BigTree will enforce the user being at HTTPS and will rewrite all insecure resources (like CSS, JavaScript, and images) to use HTTPS.
static makeSecure()
replaceHardRoots
Replaces all hard roots in a URL with relative ones (i.e. {wwwroot}).
Return Value: A string with relative roots.
static replaceHardRoots($string)
Parameter | Description |
---|---|
$string |
A string with hard roots. |
replaceInternalPageLinks
Replaces the internal page links in an HTML block with hard links.
Return Value: An HTML block with links hard-linked.
static replaceInternalPageLinks($html)
Parameter | Description |
---|---|
$html |
An HTML block |
replaceRelativeRoots
Replaces all relative roots in a URL (i.e. {wwwroot}) with hard links.
Return Value: A string with hard links.
static replaceRelativeRoots($string)
Parameter | Description |
---|---|
$string |
A string with relative roots. |
setHeadContext
Sets the context for the drawHeadTags method.
static setHeadContext($table, $entry, $title = null, $description = null, $image = null, $type = null)
Parameter | Description |
---|---|
$table |
A data table to pull open graph information from |
$entry |
The ID of the entry to pull open graph information for |
$title |
A page title to use (optional, will use Open Graph information if not entered) |
$description |
A meta description to use (optional, will use Open Graph information if not entered) |
$image |
An image to use for Open Graph (if OG data is empty) |
$type |
An Open Graph type to default to (if left empty and OG data is empty, will use "website") |
urlify
Turns a string into one suited for URL routes.
Return Value: A string suited for a URL route.
static urlify($title)
Parameter | Description |
---|---|
$title |
A short string. |