GitHub

Global functions

Helper functions and utils for working with HTML output. All functions are in AdminNeo namespace.

HTML helpers
h Escapes string for HTML.
script Returns <script> element.
script_src Returns <script src> element.
nonce Returns a nonce="" attribute with CSP nonce.
target_blank Returns a target="_blank" attribute with appropriate rel attribute.
HTML elements
icon_solo Returns HTML for solo icon with given ID.
icon_chevron_down Returns HTML for chevron icon.
icon_chevron_right Returns HTML for chevron icon.
icon Returns HTML for an icon.
print_fieldset_start Prints beginning for a fieldset.
print_fieldset_end Prints ending for a fieldset.
help_script Returns initializing <script> for help popup with given text.
help_script_command Returns initializing <script> for help popup with text resolved by JavaScript expression.
Translations
lang Returns translated text.
get_available_languages Returns the list of available languages.

Functions secification

h

Escapes string for HTML.

function h($string)
Params: ?string $string
Returns: string

Source code (PHP 7.1+)

script

Returns <script> element.

function script($source, $trailing = "\n")
Params: string $source
string $trailing
Returns: string

Source code (PHP 7.1+)

script_src

Returns <script src> element.

function script_src($url, $defer = false)
Params: string $url
bool $defer
Returns: string

Source code (PHP 7.1+)

nonce

Returns a nonce="" attribute with CSP nonce.

function nonce()
Returns: string

Source code (PHP 7.1+)

target_blank

Returns a target="_blank" attribute with appropriate rel attribute.

function target_blank()
Returns: string

Source code (PHP 7.1+)

icon_solo

Returns HTML for solo icon with given ID.

function icon_solo($id)
Params: string $id
Returns: string

Source code (PHP 7.1+)

icon_chevron_down

Returns HTML for chevron icon.

function icon_chevron_down()
Returns: string

Source code (PHP 7.1+)

icon_chevron_right

Returns HTML for chevron icon.

function icon_chevron_right()
Returns: string

Source code (PHP 7.1+)

icon

Returns HTML for an icon.

function icon($id, $class = null)
Params: string $id
?string $class
Returns: string

Source code (PHP 7.1+)

Prints beginning for a fieldset.

function print_fieldset_start($id, $legend, $icon, $visible = false, $sortable = false)
Params: string $id
string $legend
string $icon
bool $visible
bool $sortable

Source code (PHP 7.1+)

Prints ending for a fieldset.

function print_fieldset_end($id, $sortable = false)
Params: string $id
bool $sortable

Source code (PHP 7.1+)

help_script

Returns initializing <script> for help popup with given text.

function help_script($text, $side = false)
Params: string $text Help text.
bool $side Side position.
Returns: string

Source code (PHP 7.1+)

help_script_command

Returns initializing <script> for help popup with text resolved by JavaScript expression.

function help_script_command($command, $side = false)
Params: string $command JS expression for returning the help text.
bool $side Side position.
Returns: string

Source code (PHP 7.1+)

lang

Returns translated text.

function lang($key, $number = null)
Params: string|int $key Numeric key is used in compiled version.
int|string|null $number
Returns: string

Source code (PHP 7.1+)

get_available_languages

Returns the list of available languages.

function get_available_languages()
Returns: bool[]

Source code (PHP 7.1+)