Chyrp

Theme

Various helper functions for the theming engine.

Summary
Theme Various helper functions for the theming engine.
Variables
$title The title for the current page.
Functions
__construct Loads the Twig parser into Theme, and sets up the theme l10n domain.
pages_list Returns a simple array of list items to be used by the theme to generate a recursive array of pages.
get_last_linear_child Gets the last linear child of a page.
recurse_pages Prepares the pages into <Theme.$pages_flat>.
archive_list Generates an array of all of the archives, by month.
file_exists Returns whether the specified Twig file exists or not.
stylesheets Outputs the default stylesheet links.
javascripts Outputs the default JavaScript script references.
feeds Outputs the Feed references.
current Returns a singleton reference to the current class.

Variables

$title

public $title

The title for the current page.

Functions

__construct

private function __construct()

Loads the Twig parser into Theme, and sets up the theme l10n domain.

pages_list

public function pages_list( $start  =  0,
$exclude  =  null )

Returns a simple array of list items to be used by the theme to generate a recursive array of pages.

Parameters

$start Page ID or slug to start at.
$exclude Page ID to exclude from the list.  Used in the admin area.

get_last_linear_child

public function get_last_linear_child( $page,   
$origin  =  null )

Gets the last linear child of a page.

Parameters

$page Page to get the last linear child of.
$origin Where to start.

recurse_pages

public function recurse_pages( $page )

Prepares the pages into <Theme.$pages_flat>.

Parameters

$page Page to start recursion at.

archive_list

Generates an array of all of the archives, by month.

Parameters

$limit Amount of months to list
$order_by What to sort it by
$order ”asc” or “desc”

Returns

The array.  Each entry as “month”, “year”, and “url” values, stored as an array.

file_exists

public function file_exists( $file )

Returns whether the specified Twig file exists or not.

Parameters

$file The file’s name

stylesheets

public function stylesheets()

Outputs the default stylesheet links.

javascripts

public function javascripts()

Outputs the default JavaScript script references.

feeds

public function feeds()

Outputs the Feed references.

current

public static function & current()

Returns a singleton reference to the current class.