Functions

Get a nice formatted XHTML list of all the children beneath the specified Wiki+ page. This function is recursive.

create_selection_list_wiki_page_tree(\?AUTO_LINK $select = null, \?AUTO_LINK $id = null, string $breadcrumbs = '', boolean $include_orphans = true, boolean $use_compound_list = false, boolean $ins_format = false) : mixed
package wiki

Parameters

$select

\?AUTO_LINK

The Wiki+ page to select by default (null: none)

$id

\?AUTO_LINK

The Wiki+ page to look beneath (null: the root)

$breadcrumbs

string

Breadcrumbs built up so far, in recursion (blank: starting recursion)

$include_orphans

boolean

Whether to include orphaned pages in the breadcrumbs

$use_compound_list

boolean

Whether to create a compound list (gets pairs: Tempcode, and comma-separated list of children)

$ins_format

boolean

Whether to use titles in IDs after a ! (used on tree edit page)

Returns

mixedTempcode for the list / pair of Tempcode and compound

Dispatch a notification about a Wiki+ page

dispatch_wiki_page_notification(\AUTO_LINK $page_id, \ID_TEXT $type) 
package wiki
set ADD EDIT

Parameters

$page_id

\AUTO_LINK

The page ID

$type

\ID_TEXT

The action type

Dispatch a notification about a Wiki+ post

dispatch_wiki_post_notification(\AUTO_LINK $post_id, \ID_TEXT $type) 
package wiki
set ADD EDIT

Parameters

$post_id

\AUTO_LINK

The post ID

$type

\ID_TEXT

The action type

Get the number of Wiki+ pages currently in the database.

get_num_wiki_pages() : integer
package wiki

Returns

integerThe number of pages in the Wiki+ database

Get the number of Wiki+ posts currently in the database.

get_num_wiki_posts() : integer
package wiki

Returns

integerThe number of posts in the Wiki+ database

Get a chain script parameter or just an ID, in which case it does more work), and converts it into a ID/chain pair

get_param_wiki_chain(\ID_TEXT $parameter_name, \?string $default_value = null) : array
package wiki

Parameters

$parameter_name

\ID_TEXT

The name of the GET parameter that stores the chain

$default_value

\?string

The default value for the chain (null: no default)

Returns

arrayAn array of two elements: an ID and a chain

Get a list of maps containing all the subpages, and path information, of the specified page - and those beneath it, recursively.

get_wiki_page_tree(array $wiki_seen, \?AUTO_LINK $page_id = null, \?string $breadcrumbs = null, \?array $page_details = null, boolean $do_stats = false, boolean $use_compound_list = false, \?integer $levels = null) : array
package wiki

Parameters

$wiki_seen

array

A list of pages we've already seen (we don't repeat them in multiple list positions)

$page_id

\?AUTO_LINK

The page being at the root of our recursion (null: true root page)

$breadcrumbs

\?string

The breadcrumbs up to this point in the recursion (null: blank, as we are starting the recursion)

$page_details

\?array

The details of the $page_id we are currently going through (null: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the childs title

$do_stats

boolean

Whether to collect post counts with our breadcrumbs information

$use_compound_list

boolean

Whether to make a compound list (a pair of a comma-separated list of children, and the child array)

$levels

\?integer

The number of recursive levels to search (null: all)

Returns

arrayA list of maps for all subcategories. Each map entry containins the fields 'id' (category ID) and 'breadcrumbs' (path to the category, including the categories own title). There is also an additional 'downloadcount' entry if stats were requested

Get Tempcode for a Wiki+ post 'feature box' for the given row

render_wiki_page_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, boolean $include_breadcrumbs = true, \?AUTO_LINK $root = null, \ID_TEXT $guid = '') : \Tempcode
package wiki

Parameters

$row

array

The database field row of it

$zone

\ID_TEXT

The zone to use

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$include_breadcrumbs

boolean

Whether to include breadcrumbs (if there are any)

$root

\?AUTO_LINK

Virtual root to use (null: none)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeA box for it, linking to the full page

Get Tempcode for a Wiki+ post 'feature box' for the given row

render_wiki_post_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, boolean $include_breadcrumbs = true, \?AUTO_LINK $root = null, \ID_TEXT $guid = '') : \Tempcode
package wiki

Parameters

$row

array

The database field row of it

$zone

\ID_TEXT

The zone to use

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$include_breadcrumbs

boolean

Whether to include breadcrumbs (if there are any)

$root

\?AUTO_LINK

Virtual root to use (null: none)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeA box for it, linking to the full page

Add a Wiki+ page

wiki_add_page(\SHORT_TEXT $title, \LONG_TEXT $description, \LONG_TEXT $notes, \BINARY $hide_posts, \?MEMBER $member = null, \?TIME $add_time = null, integer $views = 0, \?SHORT_TEXT $meta_keywords = '', \?LONG_TEXT $meta_description = '', \?TIME $edit_date = null, boolean $send_notification = true) : \AUTO_LINK
package wiki

Parameters

$title

\SHORT_TEXT

The page title

$description

\LONG_TEXT

The page description

$notes

\LONG_TEXT

Hidden notes pertaining to the page

$hide_posts

\BINARY

Whether to hide the posts on the page by default

$member

\?MEMBER

The member doing the action (null: current member)

$add_time

\?TIME

The add time (null: now)

$views

integer

The number of views so far

$meta_keywords

\?SHORT_TEXT

Meta keywords for this resource (null: do not edit) (blank: implicit)

$meta_description

\?LONG_TEXT

Meta description for this resource (null: do not edit) (blank: implicit)

$edit_date

\?TIME

The edit time (null: N/A)

$send_notification

boolean

Whether to send a notification

Returns

\AUTO_LINKThe page ID

Edit a Wiki+ post

wiki_add_post(\AUTO_LINK $page_id, string $message, \BINARY $validated = 1, \?MEMBER $member = null, boolean $send_notification = true, \?TIME $add_time = null, integer $views = 0, \?TIME $edit_date = null) : \AUTO_LINK
package wiki

Parameters

$page_id

\AUTO_LINK

The page ID

$message

string

The new post

$validated

\BINARY

Whether the post will be validated

$member

\?MEMBER

The member doing the action (null: current member)

$send_notification

boolean

Whether to send out a notification out

$add_time

\?TIME

The add time (null: now)

$views

integer

The number of views so far

$edit_date

\?TIME

The edit time (null: N/A)

Returns

\AUTO_LINKThe post ID

Convert a Wiki+ chain to a nice breadcrumb trail.

wiki_breadcrumbs(string $chain, \?string $current_title = null, boolean $final_link = false, boolean $links = true, boolean $this_link_virtual_root = false) : array
package wiki

Parameters

$chain

string

The chain to convert (which should include the current page ID)

$current_title

\?string

The title of the current Wiki+ page (if not given, it is looked up) (null: work it out)

$final_link

boolean

Whether to show the final breadcrumbs element with a link to it (all others will always have links if $links is true)

$links

boolean

Whether to show links to pages in the breadcrumbs

$this_link_virtual_root

boolean

Whether to make the link as a virtual-root link (only applies if $final_link is true)

Returns

arrayBreadcrumbs

Delete a Wiki+ page

wiki_delete_page(\AUTO_LINK $id) 
package wiki

Parameters

$id

\AUTO_LINK

The page ID

Delete a Wiki+ post

wiki_delete_post(\AUTO_LINK $post_id, \?MEMBER $member = null
package wiki

Parameters

$post_id

\AUTO_LINK

The post ID

$member

\?MEMBER

The member doing the action (null: current member)

Create a Wiki+ chain from the specified page ID

wiki_derive_chain(\AUTO_LINK $id, \?AUTO_LINK $root = null) : string
package wiki

Parameters

$id

\AUTO_LINK

The ID of the page to derive a chain for

$root

\?AUTO_LINK

Virtual root to use (null: none)

Returns

stringThe Wiki+ chain derived

Edit a Wiki+ page

wiki_edit_page(\AUTO_LINK $id, \SHORT_TEXT $title, \LONG_TEXT $description, \LONG_TEXT $notes, \BINARY $hide_posts, \SHORT_TEXT $meta_keywords, \LONG_TEXT $meta_description, \?MEMBER $member = null, \?TIME $edit_time = null, \?TIME $add_time = null, \?integer $views = null, boolean $null_is_literal = false
package wiki

Parameters

$id

\AUTO_LINK

The page ID

$title

\SHORT_TEXT

The page title

$description

\LONG_TEXT

The page description

$notes

\LONG_TEXT

Hidden notes pertaining to the page

$hide_posts

\BINARY

Whether to hide the posts on the page by default

$meta_keywords

\SHORT_TEXT

Meta keywords

$meta_description

\LONG_TEXT

Meta description

$member

\?MEMBER

The member doing the action (null: current member)

$edit_time

\?TIME

Edit time (null: either means current time, or if $null_is_literal, means reset to to NULL)

$add_time

\?TIME

Add time (null: do not change)

$views

\?integer

Views (null: do not change)

$null_is_literal

boolean

Determines whether some NULLs passed mean 'use a default' or literally mean 'set to NULL'

Edit a Wiki+ post

wiki_edit_post(\AUTO_LINK $id, string $message, \BINARY $validated, \?MEMBER $member = null, \?AUTO_LINK $page_id = null, \?TIME $edit_time = null, \?TIME $add_time = null, \?integer $views = null, boolean $null_is_literal = false
package wiki

Parameters

$id

\AUTO_LINK

The post ID

$message

string

The new post

$validated

\BINARY

Whether the post will be validated

$member

\?MEMBER

The member doing the action (null: current member)

$page_id

\?AUTO_LINK

The page ID (null: do not change)

$edit_time

\?TIME

Edit time (null: either means current time, or if $null_is_literal, means reset to to NULL)

$add_time

\?TIME

Add time (null: do not change)

$views

\?integer

Number of views (null: do not change)

$null_is_literal

boolean

Determines whether some NULLs passed mean 'use a default' or literally mean 'set to NULL'