Functions

Add a theme.

actual_add_theme(\ID_TEXT $name) 
package core_themeing

Parameters

$name

\ID_TEXT

The theme name

Add a theme image.

actual_add_theme_image(\ID_TEXT $theme, \LANGUAGE_NAME $lang, \SHORT_TEXT $id, \URLPATH $path, boolean $fail_ok = false
package core_themeing

Parameters

$theme

\ID_TEXT

The theme the theme image is in

$lang

\LANGUAGE_NAME

The language the theme image is for

$id

\SHORT_TEXT

The theme image ID

$path

\URLPATH

The URL to the theme image

$fail_ok

boolean

Whether to allow failure without bombing out

Copy a theme.

actual_copy_theme(\ID_TEXT $theme, \ID_TEXT $to) 
package core_themeing

Parameters

$theme

\ID_TEXT

The original theme name

$to

\ID_TEXT

The copy's theme name

Delete a theme.

actual_delete_theme(\ID_TEXT $theme) 
package core_themeing

Parameters

$theme

\ID_TEXT

The theme name

Delete a theme image.

actual_delete_theme_image(\SHORT_TEXT $id, \?ID_TEXT $theme = null, \?LANGUAGE_NAME $lang = null
package core_themeing

Parameters

$id

\SHORT_TEXT

The theme image ID

$theme

\?ID_TEXT

The theme to delete in (null: all themes)

$lang

\?LANGUAGE_NAME

The language to delete in (null: all languages) (blank: all languages)

Edit a theme image.

actual_edit_theme_image(\SHORT_TEXT $old_id, \ID_TEXT $theme, \LANGUAGE_NAME $lang, \SHORT_TEXT $id, \URLPATH $path, boolean $quick = false
package core_themeing

Parameters

$old_id

\SHORT_TEXT

The current theme image ID

$theme

\ID_TEXT

The theme the theme image is in

$lang

\LANGUAGE_NAME

The language the theme image is for (blank: all languages)

$id

\SHORT_TEXT

The new theme image ID

$path

\URLPATH

The URL to the theme image

$quick

boolean

Whether to avoid cleanup, etc

Rename a theme.

actual_rename_theme(\ID_TEXT $theme, \ID_TEXT $to) 
package core_themeing

Parameters

$theme

\ID_TEXT

The original theme name

$to

\ID_TEXT

The new theme name

Try and find some CDNs to use.

autoprobe_cdns() : string
package core_themeing

Returns

stringList of CDNs

Delete uploaded theme image if not tied into anything.

cleanup_theme_images(\URLPATH $old_url) 
package core_themeing

Parameters

$old_url

\URLPATH

The URL to the theme image being deleted

Get Tempcode for a radio list to choose an image from the image FILES in the theme.

combo_get_image_paths(string $selected_path, \URLPATH $base_url, \PATH $base_path) : \Tempcode
package core_themeing

Parameters

$selected_path

string

The currently selected image path (blank for none)

$base_url

\URLPATH

The base-URL to where we are searching for images

$base_path

\PATH

The base-path to where we are searching for images

Returns

\TempcodeThe generated Tempcode

Get Tempcode for a dropdown to choose a theme from the themes present.

create_selection_list_theme_images(\?ID_TEXT $it = null, \?string $filter = null, boolean $do_id = false, boolean $include_all = false, string $under = '') : \Tempcode
package core_themeing

Parameters

$it

\?ID_TEXT

The currently selected image ID (null: none selected)

$filter

\?string

An SQL where clause (including the WHERE), that filters the query somehow (null: none)

$do_id

boolean

Whether to show IDs as the list entry captions, rather than paths

$include_all

boolean

Whether to include images not yet used (i.e not in theme_images map yet)

$under

string

Only include images under this path. Including a trailing slash unless you specifically want to filter allowing filename stubs as well as paths (blank: no limitation)

Returns

\TempcodeTempcode for a list selection of theme images

Get a UI list for choosing a theme.

create_selection_list_themes(\?ID_TEXT $theme = null, boolean $no_rely = false, boolean $show_everything = false, \ID_TEXT $default_message_string = 'RELY_FORUMS') : \Tempcode
package core_themeing

Parameters

$theme

\?ID_TEXT

The theme to select by default (null: no specific default)

$no_rely

boolean

Whether to skip the 'rely on forums' entry

$show_everything

boolean

Whether to forget about permissions for this list

$default_message_string

\ID_TEXT

The language string to use for the default answer

Returns

\TempcodeThe list

Replace colour codes with references (helper callback function)

css_preg(array $matches) : string
package core_themeing

Parameters

$matches

array

List of found regular expression matches (only index 0 relevant).

Returns

stringReplacement.

Lorem version of do_template. It will reprocess the template into something that is "stable XHTML" and thus can work inside an XHTML editor

do_lorem_template(\ID_TEXT $codename, \?array $parameters = null, \?LANGUAGE_NAME $lang = null, boolean $light_error = false, \?ID_TEXT $fallback = null, string $suffix = '.tpl', string $directory = 'templates') : \Tempcode
package core_themeing
set templates css javascript xml text

Parameters

$codename

\ID_TEXT

The codename of the template being loaded

$parameters

\?array

A map of parameters for the template (key to value) (null: no parameters)

$lang

\?LANGUAGE_NAME

The language to load the template in (templates can embed language references) (null: users own language)

$light_error

boolean

Whether to not produce a stack dump if the template is missing

$fallback

\?ID_TEXT

Alternate template to use if the primary one does not exist (null: none)

$suffix

string

File type suffix of template file (e.g. .tpl)

$directory

string

Subdirectory type to look in

Returns

\TempcodeThe Tempcode for this template

Export neatly named dump of all theme images for active theme.

export_theme_images() 
package core_themeing

Find the template/screen previews

find_all_previews__by_screen() : array
package core_themeing

Returns

arrayThe map of previews (screen to a list of templates)

Find the template/screen previews

find_all_previews__by_template() : array
package core_themeing

Returns

arrayThe map of previews (template to a tuple of preview details)

Get an array listing all the themes present.

find_all_themes(boolean $full_details = false) : array
package core_themeing

Parameters

$full_details

boolean

Whether to gather full details for each theme

Returns

arrayA map of all themes (name=>title) OR if requested a map of theme name to full theme details

Get all Comcode files.

find_comcodes() : array
package core_themeing

Returns

arrayList of Comcode files.

Get all HTML files.

find_html() : array
package core_themeing

Returns

arrayList of HTML files.

Recursively find theme images under the specified details. Does not find custom theme images, as it doesn't check the DB.

find_images_do_dir(\ID_TEXT $theme, string $subdir, array $langs) : array
package core_themeing

Parameters

$theme

\ID_TEXT

The theme

$subdir

string

The subdirectory to search under

$langs

array

A map (lang=>true) of the languages in the system, so the codes may be filtered out of the image codes in our result list

Returns

arrayA map, theme-image-code=>URL

Get all the themes image codes. THIS DOES NOT SEARCH THE DB - DO NOT USE UNLESS IT'S ON A PURE PACKAGED THEME

get_all_image_codes(\PATH $base_path, \PATH $search_under, boolean $recurse = true) : array
package core_themeing

Parameters

$base_path

\PATH

The base-path to where we are searching for images

$search_under

\PATH

The path to search under, relative to the base-path. This is not the same as the base-path, as we are cropping paths to the base-path

$recurse

boolean

Whether to search recursively from the given directory

Returns

arrayA list of image codes

Get all the image IDs (both already known, and those uncached) of a certain type (i.e. under a subdirectory).

get_all_image_ids_type(\ID_TEXT $type, boolean $recurse = false, \?object $db = null, \?ID_TEXT $theme = null, boolean $dirs_only = false, boolean $db_only = false, \?array $skip = null) : array
package core_themeing

Parameters

$type

\ID_TEXT

The type of image (e.g. 'cns_emoticons')

$recurse

boolean

Whether to search recursively; i.e. in subdirectories of the type subdirectory

$db

\?object

The database connection to work over (null: site db)

$theme

\?ID_TEXT

The theme to search in, in addition to the default theme (null: current theme)

$dirs_only

boolean

Whether to only return directories (advanced option, rarely used)

$db_only

boolean

Whether to only return from the database (advanced option, rarely used)

$skip

\?array

The list of files/directories to skip (null: none)

Returns

arrayThe list of image IDs

Search under a base path for image FILE URLs (not actually paths as function name would suggest).

get_image_paths(\URLPATH $base_url, \PATH $base_path) : array
package core_themeing

Parameters

$base_url

\URLPATH

The base-URL to where we are searching for images

$base_path

\PATH

The base-path to where we are searching for images

Returns

arraypath->url map of found images

Get an additional list of templates that should be previewed as text.

get_text_templates() : array
package core_themeing

Returns

arrayThe list of templates

Checks if the template is a full screen template

is_full_screen_template(\?string $temp_name = null, \?Tempcode $tempcode = null) : boolean
package core_themeing

Parameters

$temp_name

\?string

Name of the template (null: do not use as criteria, use other as criteria, which must iself be non-NULL)

$tempcode

\?Tempcode

The instantiated template (null: do not use as criteria, use other as criteria, which must iself be non-NULL)

Returns

booleanWhether it is

Checks if the template is to be previewed as a text template

is_plain_text_template(string $temp_name) : boolean
package core_themeing

Parameters

$temp_name

string

Name of the template

Returns

booleanWhether it is

Get suitable placeholder text.

lorem_chunk() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder text.

lorem_chunk_html() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Lorem version of globalise. It will wrap the input into something that is "stable XHTML" and thus can work inside an XHTML editor.

lorem_globalise(\Tempcode $middle, \?mixed $message = null, string $type = '', boolean $include_header_and_footer = false) : \Tempcode
package core_themeing
set inform warn ""

Parameters

$middle

\Tempcode

The Tempcode to put into a nice frame

$message

\?mixed

'Additional' message (null: none)

$type

string

The type of special message

$include_header_and_footer

boolean

Whether to include the header/footer/panels

Returns

\TempcodeStandalone page

Get suitable placeholder text.

lorem_paragraph() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder text.

lorem_paragraph_html() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get suitable placeholder text.

lorem_phrase() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder text.

lorem_phrase_html() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get suitable placeholder text.

lorem_sentence() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder text.

lorem_sentence_html() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get suitable placeholder text: title.

lorem_title() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get suitable placeholder text.

lorem_word() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder text.

lorem_word_2() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder text.

lorem_word_2_html() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get suitable placeholder text.

lorem_word_html() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get an array

placeholder_array(integer $num_elements = 3) : array
package core_themeing

Parameters

$num_elements

integer

Number of array elements.

Returns

arrayPlace holder array.

Get an avatar image.

placeholder_avatar() : \URLPATH
package core_themeing

Returns

\URLPATHImage

Get a blank screen, for a parameter which is not visible and typically blank.

placeholder_blank() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder breadcrumbs.

placeholder_breadcrumbs() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get a button

placeholder_button() : \Tempcode
package core_themeing

Returns

\TempcodeButton

Get suitable placeholder date.

placeholder_date() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder timestamp.

placeholder_date_raw() : string
package core_themeing

Returns

stringPlace holder text.

Get a table of emoticons.

placeholder_emoticon_chooser() : \Tempcode
package core_themeing

Returns

\TempcodeEmoticons

Get an array of emoticons.

placeholder_emoticons() : array
package core_themeing

Returns

arrayEmoticons

Get fields

placeholder_fields() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get fields, but composed of divs (used by forum)

placeholder_fields_as_divs() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get suitable placeholder filesize.

placeholder_filesize() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder text.

placeholder_form() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get form with a field

placeholder_form_with_field(\ID_TEXT $field_name) : \Tempcode
package core_themeing

Parameters

$field_name

\ID_TEXT

The field name wanted.

Returns

\TempcodePlace holder text.

Get suitable placeholder ID.

placeholder_id() : string
package core_themeing

Returns

stringPlace holder text.

Get an image

placeholder_image() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get image url

placeholder_image_url() : string
package core_themeing

Returns

stringImage url

Get a theme image code.

placeholder_img_code(string $type = '') : string
package core_themeing

Parameters

$type

string

The theme image directory to find a code under

Returns

stringThe code

Get suitable placeholder text: title.

placeholder_ip() : string
package core_themeing

Returns

stringPlace holder text.

Get javascript code

placeholder_javascript_code() : string
package core_themeing

Returns

stringPlace holder text.

Get a list

placeholder_list_item() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder number.

placeholder_number() : string
package core_themeing

Returns

stringPlace holder text.

Get options for drop-down box

placeholder_options() : string
package core_themeing

Returns

stringPlace holder text

Get pagination.

placeholder_pagination() : \Tempcode
package core_themeing

Returns

\TempcodePagination.

Get a random number

placeholder_random() : string
package core_themeing

Returns

stringRandom number

Get a random ID

placeholder_random_id() : string
package core_themeing

Returns

stringRandom ID

Get suitable placeholder text.

placeholder_table() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder text.

Get time

placeholder_time() : string
package core_themeing

Returns

stringPlace holder text.

Get some set of data

placeholder_types() : string
package core_themeing

Returns

stringPlace holder text.

Get suitable placeholder URL.

placeholder_url() : \Tempcode
package core_themeing

Returns

\TempcodePlace holder URL.

An image has been passed through by POST, either as a file (a new upload), a url, a reference to an existing theme image, or as a filedump reference.

post_param_image(\ID_TEXT $name = 'image', \?PATH $upload_to = null, \?ID_TEXT $theme_image_type = null, boolean $required = true, boolean $is_edit = false, \?string $filename = null, \?string $thumb_url = null) : \?URLPATH

Used with form_input_upload_multi_source. Get the image URL from the POST data.

package core_themeing

Parameters

$name

\ID_TEXT

Form field prefix (input type suffixes will be added automatically)

$upload_to

\?PATH

Where to upload to (null: the correct place for $theme_image_type)

$theme_image_type

\?ID_TEXT

The directory of theme images to store under (null: do not support theme images)

$required

boolean

Whether an image is required

$is_edit

boolean

Whether this is an edit operation

$filename

\?string

Pass the filename back by reference (null: do not pass)

$thumb_url

\?string

Pass the thumbnail back by reference (null: do not pass & do not collect a thumbnail)

Returns

\?URLPATHThe URL (either to an independent upload, or the theme image, or a filedump URL) (null: leave alone, when doing an edit operation)

A theme image has been passed through by POST, either as a file (a new theme image), or as a reference to an existing one. Get the image code from the POST data.

post_param_theme_img_code(\ID_TEXT $type, boolean $required = false, \ID_TEXT $field_file = 'file', \ID_TEXT $field_choose = 'theme_img_code', \?object $db = null, \?PATH $upload_to = null) : \ID_TEXT

Note that post_param_image is a more comprehensive function, if you accept other types of inputs too.

package core_themeing

Parameters

$type

\ID_TEXT

The type of theme image

$required

boolean

Whether a code is required

$field_file

\ID_TEXT

Form field for uploading

$field_choose

\ID_TEXT

Form field for choosing

$db

\?object

Database connection (null: site database)

$upload_to

\?PATH

Where to upload the theme images to (null: something sensible)

Returns

\ID_TEXTThe (possibly randomised) theme image code

Regenerate all the theme image paths in the database.

regen_theme_images(\ID_TEXT $theme, \?array $langs = null, \?ID_TEXT $target_theme = null
package core_themeing

Parameters

$theme

\ID_TEXT

The theme we're searching in.

$langs

\?array

A map of languages (lang=>true) (null: find it in-function).

$target_theme

\?ID_TEXT

The theme we're storing in (null: same as $theme).

Shows the preview of a screen

render_screen_preview(\ID_TEXT $template, \?ID_TEXT $hook, \ID_TEXT $function) : \Tempcode
package core_themeing

Parameters

$template

\ID_TEXT

The template to be previewed (e.g. templates/DOWNLOAD_BOX.tpl)

$hook

\?ID_TEXT

The hook the preview is in (null: search)

$function

\ID_TEXT

The name of the screen preview

Returns

\TempcodeThe previewed screen

Size down a category representative image.

resize_rep_image(\URLPATH $rep_image) : \URLPATH
package core_themeing

Parameters

$rep_image

\URLPATH

The rep image

Returns

\URLPATHThe rep image

AJAX script for rendering some Tempcode.

tempcode_tester_script() 
package core_themeing

Delete a theme image used for a resource that was added, but only if the theme image is now unused.

tidy_theme_img_code(\?ID_TEXT $new, \ID_TEXT $old, \ID_TEXT $table, \ID_TEXT $field, \?object $db = null
package core_themeing

Parameters

$new

\?ID_TEXT

The new theme image (null: no new one)

$old

\ID_TEXT

The old theme image we might be tidying up

$table

\ID_TEXT

Table to check against

$field

\ID_TEXT

Field in table

$db

\?object

Database connection to check against (null: site database)