Functions

is_client_error()

is_client_error($sc) 
package External

Parameters

$sc

is_error()

is_error($sc) 
package External

Parameters

$sc

is_info()

is_info($sc) 
package External

Parameters

$sc

is_redirect()

is_redirect($sc) 
package External

Parameters

$sc

is_server_error()

is_server_error($sc) 
package External

Parameters

$sc

is_success()

is_success($sc) 
package External

Parameters

$sc

Sets up most of the KSES filters for input form content.

kses_init() 

First removes all of the KSES filters in case the current user does not need to have KSES filter the content. If the user does not have unfiltered_html capability, then KSES filters are added.

package External
since 2.0.0

Adds all KSES input form content filters.

kses_init_filters() 

All hooks have default priority. The wp_filter_kses() function is added to the 'pre_comment_content' and 'title_save_pre' hooks.

The wp_filter_post_kses() function is added to the 'content_save_pre', 'excerpt_save_pre', and 'content_filtered_save_pre' hooks.

package External
since 2.0.0

Removes all KSES input form content filters.

kses_remove_filters() 

A quick procedural method to removing all of the filters that KSES uses for content in WordPress Loop.

Does not remove the kses_init() function from \'init' hook (priority is default). Also does not remove kses_init() function from \'set_current_user' hook (priority is also default).

package External
since 2.0.6

parse_w3cdtf()

parse_w3cdtf($date_str) 
package External

Parameters

$date_str

Filters an inline style attribute and removes disallowed rules.

safecss_filter_attr(string $css, string $deprecated = '') : string
package External
since 2.8.1

Parameters

$css

string

A string of CSS rules.

$deprecated

string

Not used.

Returns

stringFiltered string of CSS rules.

Determines if a Unicode codepoint is valid.

valid_unicode(integer $i) : boolean
package External
since 2.7.0

Parameters

$i

integer

Unicode codepoint.

Returns

booleanWhether or not the codepoint is a valid Unicode codepoint.

Sanitize content with allowed HTML KSES rules.

wp_filter_kses(string $data) : string

This function expects slashed data.

package External
since 1.0.0

Parameters

$data

string

Content to filter, expected to be escaped with slashes.

Returns

stringFiltered content.

Strips all HTML from a text string.

wp_filter_nohtml_kses(string $data) : string

This function expects slashed data.

package External
since 2.1.0

Parameters

$data

string

Content to strip all HTML from.

Returns

stringFiltered content without any HTML.

Sanitizes content for allowed HTML tags for post content.

wp_filter_post_kses(string $data) : string

Post content refers to the page contents of the 'post' type and not $_POST data from forms.

This function expects slashed data.

package External
since 2.0.0

Parameters

$data

string

Post content to filter, expected to be escaped with slashes.

Returns

stringFiltered post content with allowed HTML tags and attributes intact.

Filters text content and strips out disallowed HTML.

wp_kses(string $string, array<mixed,array>|string $allowed_html, array<mixed,string> $allowed_protocols = array()) : string

This function makes sure that only the allowed HTML element names, attribute names, attribute values, and HTML entities will occur in the given text string.

This function expects unslashed data.

package External
see for specifically filtering post content and fields.
see for the default allowed protocols in link URLs.
since 1.0.0

Parameters

$string

string

Text content to filter.

$allowed_html

array<mixed,array>string

An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.

$allowed_protocols

array<mixed,string>

Array of allowed URL protocols.

Returns

stringFiltered content containing only the allowed HTML.

Returns an array of allowed HTML tags and attributes for a given context.

wp_kses_allowed_html(string|array $context = '') : array
package External
since 3.5.0
since 5.0.1 `form` removed as allowable HTML tag.
global array $allowedposttags
global array $allowedtags
global array $allowedentitynames

Parameters

$context

stringarray

The context for which to retrieve tags. Allowed values are 'post', 'strip', 'data', 'entities', or the name of a field filter such as 'pre_user_description'.

Returns

arrayArray of allowed HTML tags and their allowed attributes.

Converts the keys of an array to lowercase.

wp_kses_array_lc(array $inarray) : array
package External
since 1.0.0

Parameters

$inarray

array

Unfiltered array.

Returns

arrayFixed array with all lowercase keys.

Removes all attributes, if none are allowed for this element.

wp_kses_attr(string $element, string $attr, array<mixed,array>|string $allowed_html, array<mixed,string> $allowed_protocols) : string

If some are allowed it calls wp_kses_hair() to split them further, and then it builds up new HTML code from the data that kses_hair() returns. It also removes < and > characters, if there are any left. One more thing it does is to check if the tag has a closing XHTML slash, and if it does, it puts one in the returned code as well.

package External
since 1.0.0

Parameters

$element

string

HTML element/tag.

$attr

string

HTML attributes from HTML element to closing HTML element tag.

$allowed_html

array<mixed,array>string

An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.

$allowed_protocols

array<mixed,string>

Array of allowed URL protocols.

Returns

stringSanitized HTML element.

Determines whether an attribute is allowed.

wp_kses_attr_check(string $name, string $value, string $whole, string $vless, string $element, array $allowed_html) : boolean
package External
since 4.2.3
since 5.0.0 Add support for `data-*` wildcard attributes.

Parameters

$name

string

The attribute name. Passed by reference. Returns empty string when not allowed.

$value

string

The attribute value. Passed by reference. Returns a filtered value.

$whole

string

The name=value input. Passed by reference. Returns filtered input.

$vless

string

Whether the attribute is valueless. Use 'y' or 'n'.

$element

string

The name of the element to which this attribute belongs.

$allowed_html

array

The full list of allowed elements and attributes.

Returns

booleanWhether or not the attribute is allowed.

Finds all attributes of an HTML element.

wp_kses_attr_parse(string $element) : array | boolean

Does not modify input. May return "evil" output.

Based on wp_kses_split2() and wp_kses_attr().

package External
since 4.2.3

Parameters

$element

string

HTML element.

Returns

arraybooleanList of attributes found in the element. Returns false on failure.

Sanitizes a string and removed disallowed URL protocols.

wp_kses_bad_protocol(string $string, array<mixed,string> $allowed_protocols) : string

This function removes all non-allowed protocols from the beginning of the string. It ignores whitespace and the case of the letters, and it does understand HTML entities. It does its work recursively, so it won't be fooled by a string like javascript:javascript:alert(57).

package External
since 1.0.0

Parameters

$string

string

Content to filter bad protocols from.

$allowed_protocols

array<mixed,string>

Array of allowed URL protocols.

Returns

stringFiltered content.

Sanitizes content from bad protocols and other characters.

wp_kses_bad_protocol_once(string $string, array<mixed,string> $allowed_protocols, integer $count = 1) : string

This function searches for URL protocols at the beginning of the string, while handling whitespace and HTML entities.

package External
since 1.0.0

Parameters

$string

string

Content to check for bad protocols.

$allowed_protocols

array<mixed,string>

Array of allowed URL protocols.

$count

integer

Depth of call recursion to this function.

Returns

stringSanitized content.

Performs different checks for attribute values.

wp_kses_check_attr_val(string $value, string $vless, string $checkname, mixed $checkvalue) : boolean

The currently implemented checks are "maxlen", "minlen", "maxval", "minval", and "valueless".

package External
since 1.0.0

Parameters

$value

string

Attribute value.

$vless

string

Whether the attribute is valueless. Use 'y' or 'n'.

$checkname

string

What $checkvalue is checking for.

$checkvalue

mixed

What constraint the value should pass.

Returns

booleanWhether check passes.

Sanitize content with allowed HTML KSES rules.

wp_kses_data(string $data) : string

This function expects unslashed data.

package External
since 2.9.0

Parameters

$data

string

Content to filter, expected to not be escaped.

Returns

stringFiltered content.

Converts all numeric HTML entities to their named counterparts.

wp_kses_decode_entities(string $string) : string

This function decodes numeric HTML entities (&#65; and &#x41;). It doesn't do anything with named entities like &auml;, but we don't need them in the allowed URL protocols system anyway.

package External
since 1.0.0

Parameters

$string

string

Content to change entities.

Returns

stringContent after decoded entities.

Builds an attribute list from string containing attributes.

wp_kses_hair(string $attr, array<mixed,string> $allowed_protocols) : array<mixed,array>

This function does a lot of work. It parses an attribute list into an array with attribute data, and tries to do the right thing even if it gets weird input. It will add quotes around attribute values that don't have any quotes or apostrophes around them, to make it easier to produce HTML code that will conform to W3C's HTML specification. It will also remove bad URL protocols from attribute values. It also reduces duplicate attributes by using the attribute defined first (foo='bar' foo='baz' will result in foo='bar').

package External
since 1.0.0

Parameters

$attr

string

Attribute list from HTML element to closing HTML element tag.

$allowed_protocols

array<mixed,string>

Array of allowed URL protocols.

Returns

array<mixed,array>Array of attribute information after parsing.

Builds an attribute list from string containing attributes.

wp_kses_hair_parse(string $attr) : array | boolean

Does not modify input. May return "evil" output. In case of unexpected input, returns false instead of stripping things.

Based on wp_kses_hair() but does not return a multi-dimensional array.

package External
since 4.2.3

Parameters

$attr

string

Attribute list from HTML element to closing HTML element tag.

Returns

arraybooleanList of attributes found in $attr. Returns false on failure.

You add any KSES hooks here.

wp_kses_hook(string $string, array<mixed,array>|string $allowed_html, array<mixed,string> $allowed_protocols) : string

There is currently only one KSES WordPress hook, \'pre_kses', and it is called here. All parameters are passed to the hooks and expected to receive a string.

package External
since 1.0.0

Parameters

$string

string

Content to filter through KSES.

$allowed_html

array<mixed,array>string

An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.

$allowed_protocols

array<mixed,string>

Array of allowed URL protocols.

Returns

stringFiltered content through {@see 'pre_kses'} hook.

Handles parsing errors in `wp_kses_hair()`.

wp_kses_html_error(string $string) : string

The general plan is to remove everything to and including some whitespace, but it deals with quotes and apostrophes as well.

package External
since 1.0.0

Parameters

$string

string

Returns

string

Callback for `wp_kses_normalize_entities()` regular expression.

wp_kses_named_entities(array $matches) : string

This function only accepts valid named entity references, which are finite, case-sensitive, and highly scrutinized by HTML and XML validators.

package External
since 3.0.0
global array $allowedentitynames

Parameters

$matches

array

preg_replace_callback() matches array.

Returns

stringCorrectly encoded entity.

Removes any invalid control characters in a text string.

wp_kses_no_null(string $string, array $options = null) : string

Also removes any instance of the \0 string.

package External
since 1.0.0

Parameters

$string

string

Content to filter null characters from.

$options

array

Set 'slash_zero' => 'keep' when '\0' is allowed. Default is 'remove'.

Returns

stringFiltered content.

Converts and fixes HTML entities.

wp_kses_normalize_entities(string $string, string $context = 'html') : string

This function normalizes HTML entities. It will convert AT&T to the correct AT&amp;T, &#00058; to &#58;, &#XYZZY; to &amp;#XYZZY; and so on.

When $context is set to 'xml', HTML entities are converted to their code points. For example, AT&T&hellip;&#XYZZY; is converted to AT&amp;T…&amp;#XYZZY;.

package External
since 1.0.0
since 5.5.0 Added `$context` parameter.

Parameters

$string

string

Content to normalize entities.

$context

string

Context for normalization. Can be either 'html' or 'xml'. Default 'html'.

Returns

stringContent with normalized entities.

Filters one HTML attribute and ensures its value is allowed.

wp_kses_one_attr(string $string, string $element) : string

This function can escape data in some situations where wp_kses() must strip the whole attribute.

package External
since 4.2.3

Parameters

$string

string

The 'whole' attribute, including name and value.

$element

string

The HTML element name to which the attribute belongs.

Returns

stringFiltered attribute.

Sanitizes content for allowed HTML tags for post content.

wp_kses_post(string $data) : string

Post content refers to the page contents of the 'post' type and not $_POST data from forms.

This function expects unslashed data.

package External
since 2.9.0

Parameters

$data

string

Post content to filter.

Returns

stringFiltered post content with allowed HTML tags and attributes intact.

Navigates through an array, object, or scalar, and sanitizes content for allowed HTML tags for post content.

wp_kses_post_deep(mixed $data) : mixed
package External
since 4.4.2
see

Parameters

$data

mixed

The array, object, or scalar value to inspect.

Returns

mixedThe filtered content.

Searches for HTML tags, no matter how malformed.

wp_kses_split(string $string, array<mixed,array>|string $allowed_html, array<mixed,string> $allowed_protocols) : string

It also matches stray > characters.

package External
since 1.0.0
global array[]|string $pass_allowed_html An array of allowed HTML elements and attributes, or a context name such as 'post'.
global string[] $pass_allowed_protocols Array of allowed URL protocols.

Parameters

$string

string

Content to filter.

$allowed_html

array<mixed,array>string

An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.

$allowed_protocols

array<mixed,string>

Array of allowed URL protocols.

Returns

stringContent with fixed HTML tags

Strips slashes from in front of quotes.

wp_kses_stripslashes(string $string) : string

This function changes the character sequence \" to just ". It leaves all other slashes alone. The quoting from preg_replace(//e) requires this.

package External
since 1.0.0

Parameters

$string

string

String to strip slashes from.

Returns

stringFixed string with quoted slashes.

Returns an array of HTML attribute names whose value contains a URL.

wp_kses_uri_attributes() : array<mixed,string>

This function returns a list of all HTML attributes that must contain a URL according to the HTML specification.

This list includes URI attributes both allowed and disallowed by KSES.

package External
link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
since 5.0.1

Returns

array<mixed,string>HTML attribute names whose value contains a URL.

Returns the version number of KSES.

wp_kses_version() : string
package External
since 1.0.0

Returns

stringKSES version number.

Callback for `wp_kses_normalize_entities()` regular expression.

wp_kses_xml_named_entities(array $matches) : string

This function only accepts valid named entity references, which are finite, case-sensitive, and highly scrutinized by XML validators. HTML named entity references are converted to their code points.

package External
since 5.5.0
global array $allowedentitynames
global array $allowedxmlnamedentities

Parameters

$matches

array

preg_replace_callback() matches array.

Returns

stringCorrectly encoded entity.

Classes, interfaces, and traits

MagpieRSS

« More »

RSSCache

« More »

Constants

 

ATOM

ATOM = 'Atom' 
package External
 

CUSTOM_TAGS

CUSTOM_TAGS = false 
package External
 

MAGPIE_CACHE_AGE

MAGPIE_CACHE_AGE = 60 * 60 
package External
 

MAGPIE_CACHE_DIR

MAGPIE_CACHE_DIR = './cache' 
package External
 

MAGPIE_CACHE_FRESH_ONLY

MAGPIE_CACHE_FRESH_ONLY = 0 
package External
 

MAGPIE_CACHE_ON

MAGPIE_CACHE_ON = 1 
package External
 

MAGPIE_DEBUG

MAGPIE_DEBUG = 0 
package External
 

MAGPIE_FETCH_TIME_OUT

MAGPIE_FETCH_TIME_OUT = 2 
package External
 

MAGPIE_INITALIZED

MAGPIE_INITALIZED = 1 
package External
 

MAGPIE_USER_AGENT

MAGPIE_USER_AGENT = $ua 
package External
 

MAGPIE_USE_GZIP

MAGPIE_USE_GZIP = true 
package External
 

RSS feed constant.

RSS = 'RSS' 
package External

Functions

Retrieve URL headers and content using WP HTTP Request API.

_fetch_remote_file(string $url, array $headers = "") : \Snoopy
package External
package External
since 1.5.0
subpackage MagpieRSS

Parameters

$url

string

URL to retrieve

$headers

array

Optional. Headers to send to the URL.

Returns

\Snoopystyle response

Retrieve

_response_to_rss(array $resp) : \MagpieRSS | boolean
package External
package External
since 1.5.0
subpackage MagpieRSS

Parameters

$resp

array

Returns

\MagpieRSSboolean

Build Magpie object based on RSS from URL.

fetch_rss(string $url) : boolean | \MagpieRSS
package External
package External
since 1.5.0
subpackage MagpieRSS

Parameters

$url

string

URL to retrieve feed

Returns

boolean\MagpieRSSfalse on failure or MagpieRSS object on success.

Display RSS items in HTML list items.

get_rss(string $url, integer $num_items = 5) : boolean

You have to specify which HTML list you want, either ordered or unordered before using the function. You also have to specify how many items you wish to display. You can't display all of them like you can with wp_rss() function.

package External
package External
since 1.5.0
subpackage MagpieRSS

Parameters

$url

string

URL of feed to display. Will not auto sense feed URL.

$num_items

integer

Optional. Number of items to display, default is all.

Returns

booleanFalse on failure.

Set up constants with default values, unless user overrides.

init() 
package External
package External
since 1.5.0
subpackage MagpieRSS

Display all RSS items in a HTML ordered list.

wp_rss(string $url, integer $num_items = -1
package External
package External
since 1.5.0
subpackage MagpieRSS

Parameters

$url

string

URL of feed to display. Will not auto sense feed URL.

$num_items

integer

Optional. Number of items to display, default is all.