Properties

$html_template

$html_template : string

The root HTML template that all pages are built from.

Type

string

$main_content_template

$main_content_template : string

The main content template that is used to render normal wiki pages.

Type

string

$minimal_content_template

$minimal_content_template : string

A specially minified content template that doesn't include the navbar and other elements not suitable for printing.

Type

string

$nav_divider

$nav_divider : string

The navigation bar divider.

Type

string

Methods

register_part_preprocessor()

register_part_preprocessor(\function  $function) 

Registers a function as a part post processor.

This function's use is more complicated to explain. Pepperminty Wiki renders pages with a very simple templating system. For example, in the template a page's content is denoted by {content}. A function registered here will be passed all the components of a page just before they are dropped into the template. Note that the function you pass in here should take a reference to the components, as the return value of the function passed is discarded.

Parameters

\function $function

The part preprocessor to register.

render()

render(string  $title, string  $content, boolean  $body_template = false) : string

Renders a HTML page with the content specified.

Parameters

string $title

The title of the page.

string $content

The (HTML) content of the page.

boolean $body_template

The HTML content template to use.

Returns

string —

The rendered HTML, ready to send to the client :-)

render_main()

render_main(string  $title, string  $content) : string

Renders a normal HTML page.

Parameters

string $title

The title of the page.

string $content

The content of the page.

Returns

string —

The rendered page.

render_minimal()

render_minimal(string  $title, string  $content) : string

Renders a minimal HTML page. Useful for printable pages.

Parameters

string $title

The title of the page.

string $content

The content of the page.

Returns

string —

The rendered page.

send_server_push_indicators()

send_server_push_indicators() : integer|FALSE

Sends the currently registered HTTP2 server push items to the client.

Returns

integer|FALSE —

The number of resource hints included in the link: header, or false if server pushing is disabled.

get_header_html()

get_header_html() : string

Renders the header HTML.

Returns

string —

The rendered HTML that goes in the header.

is_css_url()

is_css_url() : boolean

Figures out whether $settings->css is a url, or a string of css.

A url is something starting with "protocol://" or simply a "/".

Returns

boolean —

True if it's a url - false if we assume it's a string of css.

get_css_as_html()

get_css_as_html() : string

Renders all the CSS as HTML.

Returns

string —

The css as HTML, ready to be included in the HTML header.

AddJSLink()

AddJSLink(string  $scriptUrl) 

Adds the specified url to a javascript file as a reference to the page.

Parameters

string $scriptUrl

The url of the javascript file to reference.

AddJSSnippet()

AddJSSnippet(string  $script) 

Adds a javascript snippet to the page.

Parameters

string $script

The snippet of javascript to add.

AddServerPushIndicator()

AddServerPushIndicator(string  $type, string  $path) 

Adds a resource to the list of items to indicate that the web server should send via HTTP/2.0 Server Push.

Note: Only specify static files here, as you might end up with strange (and possibly dangerous) results!

Parameters

string $type

The resource type. See https://fetch.spec.whatwg.org/#concept-request-destination for more information.

string $path

The relative url path to the resource.

render_navigation_bar()

render_navigation_bar(array  $nav_links, array  $nav_links_extra, string  $class = "") 

Renders a navigation bar from an array of links. See $settings->nav_links for format information.

Parameters

array $nav_links

The links to add to the navigation bar.

array $nav_links_extra

The extra nav links to add to the "More..." menu.

string $class

The class(es) to assign to the rendered navigation bar.

render_username()

render_username(string  $name) : string

Renders a username for inclusion in a page.

Parameters

string $name

The username to render.

Returns

string —

The username rendered in HTML.

generate_all_pages_datalist()

generate_all_pages_datalist() : string

Renders the datalist for the search box as HTML.

Returns

string —

The search box datalist as HTML.