Functions

__()

__($text, $domain = 'default'
package BackPress

Parameters

$text

$domain

__n()

__n($singular, $plural, $count, $domain = 'default'
package BackPress

Parameters

$singular

$plural

$count

$domain

Returns an empty array.

__return_empty_array() : array

Useful for returning an empty array to filters easily.

package BackPress
since 3.0.0
see

Returns

arrayEmpty array

Returns false.

__return_false() : boolean

Useful for returning false to filters easily.

package BackPress
since 3.0.0
see

Returns

booleanfalse

Returns null.

__return_null() : null

Useful for returning null to filters easily.

package BackPress
since 3.4.0

Returns

null

Returns true.

__return_true() : boolean

Useful for returning true to filters easily.

package BackPress
since 3.0.0
see

Returns

booleantrue

Returns 0.

__return_zero() : integer

Useful for returning 0 to filters easily.

package BackPress
since 3.0.0
see

Returns

integer0

Strip close comment and close php tags from file headers used by WP See http://core.trac.wordpress.org/ticket/8497

_cleanup_header_comment($str) 
package BackPress
since 2.8

Parameters

$str

Perform a deep string replace operation to ensure the values in $search are no longer present

_deep_replace(string|array $search, string $subject) : string

Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that str_replace would return

package BackPress
since 2.8.1
access private

Parameters

$search

stringarray

$subject

string

Returns

stringThe processed string

_e()

_e($text, $domain = 'default'
package BackPress

Parameters

$text

$domain

Callback to convert email address match to HTML A element.

_make_email_clickable_cb(array $matches) : string

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link make_clickable()}.

package BackPress
since 2.3.2
access private

Parameters

$matches

array

Single Regex Match.

Returns

stringHTML A element with email address.

Callback to convert URI match to HTML A element.

_make_url_clickable_cb(array $matches) : string

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link make_clickable()}.

package BackPress
since 2.3.2
access private

Parameters

$matches

array

Single Regex Match.

Returns

stringHTML A element with URI address.

Callback to convert URL match to HTML A element.

_make_web_ftp_clickable_cb(array $matches) : string

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link make_clickable()}.

package BackPress
since 2.3.2
access private

Parameters

$matches

array

Single Regex Match.

Returns

stringHTML A element with URL address.

Breaks a string into chunks by splitting at whitespace characters.

_split_str_by_whitespace(string $string, integer $goal) : array

The length of each returned chunk is as close to the specified length goal as possible, with the caveat that each chunk includes its trailing delimiter. Chunks longer than the goal are guaranteed to not have any inner whitespace.

Joining the returned chunks with empty delimiters reconstructs the input string losslessly.

Input string must have no null characters (or eventual transformations on output chunks must not care about null characters)

_split_str_by_whitespace( "1234 67890 1234 67890a cd 1234 890 123456789 1234567890a 45678 1 3 5 7 90 ", 10 ) == array ( 0 => '1234 67890 ', // 11 characters: Perfect split 1 => '1234 ', // 5 characters: '1234 67890a' was too long 2 => '67890a cd ', // 10 characters: '67890a cd 1234' was too long 3 => '1234 890 ', // 11 characters: Perfect split 4 => '123456789 ', // 10 characters: '123456789 1234567890a' was too long 5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split 6 => ' 45678 ', // 11 characters: Perfect split 7 => '1 3 5 7 9', // 9 characters: End of $string );

package BackPress
since 3.4.0
access private

Parameters

$string

string

The string to split

$goal

integer

The desired chunk length.

Returns

arrayNumeric array of chunks.

Converts a number of special characters into their HTML entities.

_wp_specialchars(string $string, mixed $quote_style = ENT_NOQUOTES, string $charset = false, boolean $double_encode = false) : string

Specifically deals with: &, <, >, ", and '.

$quote_style can be set to ENT_COMPAT to encode " to ", or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.

package BackPress
since 1.2.2

Parameters

$string

string

The text which is to be encoded.

$quote_style

mixed

Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.

$charset

string

Optional. The character encoding of the string. Default is false.

$double_encode

boolean

Optional. Whether to encode existing html entities. Default is false.

Returns

stringThe encoded text with HTML entities.

_wp_timezone_choice_usort_callback()

_wp_timezone_choice_usort_callback($a, $b) 
package BackPress

Parameters

$a

$b

Search for disabled element tags. Push element to stack on tag open and pop on tag close. Assumes first character of $text is tag opening.

_wptexturize_pushpop_element(string $text, array $stack, string $disabled_elements, string $opening = '<', $closing = '>') : object
package BackPress
access private
since 2.9.0

Parameters

$text

string

Text to check. First character is assumed to be $opening

$stack

array

Array used as stack of opened tag elements

$disabled_elements

string

Tags to match against formatted as regexp sub-expression

$opening

stringstring

Tag opening character, assumed to be 1 character long

$closing

Returns

object

Converts value to nonnegative integer.

absint(mixed $maybeint) : integer
package BackPress
since 2.5.0

Parameters

$maybeint

mixed

Data you wish to have convered to an nonnegative integer

Returns

integerAn nonnegative integer

Retrieve a modified URL query string.

add_query_arg() : string

You can rebuild the URL and append a new query variable to the URL query by using this function. You can also retrieve the full URL with query data.

Adding a single key & value or an associative array. Setting a key value to emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER value.

package BackPress
since 1.5.0

Returns

stringNew URL query string.

Does the specified module exist in the apache config?

apache_mod_loaded(string $mod, boolean $default = false) : boolean
package BackPress
since 2.5.0

Parameters

$mod

string

e.g. mod_rewrite

$default

boolean

The default return value if the module is not found

Returns

boolean

Escaping for HTML attributes.

attribute_escape(string $text) : string
package BackPress
since 2.0.6
deprecated 2.8.0
see

Parameters

$text

string

Returns

string

backpress_add_option()

backpress_add_option($option, $value) 
package BackPress

Parameters

$option

$value

backpress_convert_object()

backpress_convert_object($object, $output) 
package BackPress

Parameters

$object

$output

backpress_delete_option()

backpress_delete_option($option) 
package BackPress

Parameters

$option

backpress_delete_transient()

backpress_delete_transient($transient) 
package BackPress

Parameters

$transient

Kill BackPress execution and display HTML message with error message.

backpress_die(string $message, string $title = '', string|array $args = array()

This function calls the die() PHP function. The difference is that a message in HTML will be displayed to the user. It is recommended to use this function only when the execution should not continue any further. It is not recommended to call this function very often and normally you should try to handle as many errors as possible silently.

package BackPress

Parameters

$message

string

Error message.

$title

string

Error title.

$args

stringarray

Optional arguments to control behaviour.

backpress_get_option()

backpress_get_option($option) 
package BackPress

Parameters

$option

backpress_get_transient()

backpress_get_transient($transient) 
package BackPress

Parameters

$transient

backpress_gmt_strtotime()

backpress_gmt_strtotime($string) 
package BackPress

Parameters

$string

backpress_set_transient()

backpress_set_transient($transient, $value, $expiration = 0
package BackPress

Parameters

$transient

$value

$expiration

backpress_update_option()

backpress_update_option($option, $value) 
package BackPress

Parameters

$option

$value

Adds backslashes before letters and before a number at the start of a string.

backslashit(string $string) : string
package BackPress
since 0.71

Parameters

$string

string

Value to which backslashes will be added.

Returns

stringString with backslashes inserted.

Build URL query based on an associative and, or indexed array.

build_query(array $data) : string

This is a convenient function for easily building url queries. It sets the separator to '&' and uses _http_build_query() function.

package BackPress
see Used to build the query
link more on what http_build_query() does.
since 2.3.0

Parameters

$data

array

URL-encode key/value pairs.

Returns

stringURL encoded string

Set the headers for caching for 10 days with JavaScript content type.

cache_javascript_headers() 
package BackPress
since 2.1.0

Accepts matches array from preg_replace_callback in wpautop() or a string.

clean_pre(array|string $matches) : string

Ensures that the contents of a <

>...<
> HTML block are not converted into paragraphs or line-breaks.

package BackPress
since 1.2.0

Parameters

$matches

arraystring

The array or string

Returns

stringThe pre block without paragraph/line-break conversion.

Checks and cleans a URL.

clean_url(string $url, array $protocols = null, string $context = 'display') : string

A number of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands are also replaced. The 'clean_url' filter is applied to the returned cleaned URL.

package BackPress
since 1.2.0
deprecated 3.0.0
deprecated Use esc_url()
see for esc_url()

Parameters

$url

string

The URL to be cleaned.

$protocols

array

Optional. An array of acceptable protocols.

$context

string

Optional. How the URL will be used. Default is 'display'.

Returns

stringThe cleaned $url after the 'clean_url' filter is applied.

Retrieve the current time based on specified type.

current_time(string $type, integer|boolean $gmt = 0) : integer | string

The 'mysql' type will return the time in the format for MySQL DATETIME field. The 'timestamp' type will return the current timestamp.

If $gmt is set to either '1' or 'true', then both types will use GMT time. if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.

package BackPress
since 1.0.0

Parameters

$type

string

Either 'mysql' or 'timestamp'.

$gmt

integerboolean

Optional. Whether to use GMT timezone. Default is false.

Returns

integerstringString if $type is 'gmt', int if $type is 'timestamp'.

Converts named entities into numbered entities.

ent2ncr(string $text) : string
package BackPress
since 1.5.1

Parameters

$text

string

The text within which entities will be converted.

Returns

stringText with converted entities.

Escaping for HTML attributes.

esc_attr(string $text) : string
package BackPress
since 2.8.0

Parameters

$text

string

Returns

string

Escaping for HTML blocks.

esc_html(string $text) : string
package BackPress
since 2.8.0

Parameters

$text

string

Returns

string

Escape single quotes, htmlspecialchar " < > &, and fix line endings.

esc_js(string $text) : string

Escapes text strings for echoing in JS, both inline (for example in onclick="...") and inside