[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/includes/ -> functions-kses.php (summary)

YOURLS modification of a small subset from WordPress' KSES implementation. Straight from the Let's Not Reinvent The Wheel department.

File Size: 778 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 16 functions

  yourls_kses_init()
  yourls_kses_allowed_tags_all()
  yourls_kses_allowed_tags()
  yourls_kses_allowed_entities()
  yourls_kses_allowed_protocols()
  yourls_kses_normalize_entities()
  yourls_kses_named_entities()
  yourls_kses_normalize_entities2()
  yourls_kses_normalize_entities3()
  _yourls_add_global_attributes()
  yourls_valid_unicode()
  yourls_kses_array_lc()
  yourls_kses_decode_entities()
  _yourls_kses_decode_entities_chr()
  _yourls_kses_decode_entities_chr_hexdec()
  yourls_kses_no_null()

Functions
Functions that are not part of a class:

yourls_kses_init()   X-Ref
Init KSES globals if not already defined (by a plugin)

return: void
since: 1.6

yourls_kses_allowed_tags_all()   X-Ref
Kses global for all allowable HTML tags.

Complete (?) list of HTML tags. Keep this function available for any plugin or
future feature that will want to display lots of HTML.

return: array All tags
since: 1.6

yourls_kses_allowed_tags()   X-Ref
Kses global for default allowable HTML tags. TODO: trim down to necessary only.

Short list of HTML tags used in YOURLS core for display

return: array Allowed tags
since: 1.6

yourls_kses_allowed_entities()   X-Ref
Kses global for allowable HTML entities.

return: array Allowed entities
since: 1.6

yourls_kses_allowed_protocols()   X-Ref
Kses global for allowable protocols.

return: array Allowed protocols
since: 1.6

yourls_kses_normalize_entities($string)   X-Ref
Converts and fixes HTML entities.

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

return: string Content with normalized entities
param: string $string Content to normalize entities
since: 1.6

yourls_kses_named_entities($matches)   X-Ref
Callback for yourls_kses_normalize_entities() regular expression.

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

return: string Correctly encoded entity
param: array $matches preg_replace_callback() matches array
since: 1.6

yourls_kses_normalize_entities2($matches)   X-Ref
Callback for yourls_kses_normalize_entities() regular expression.

This function helps yourls_kses_normalize_entities() to only accept 16-bit values
and nothing more for &#number; entities.

return: string Correctly encoded entity
param: array $matches preg_replace_callback() matches array
since: 1.6

yourls_kses_normalize_entities3($matches)   X-Ref
Callback for yourls_kses_normalize_entities() for regular expression.

This function helps yourls_kses_normalize_entities() to only accept valid Unicode
numeric entities in hex form.

return: string Correctly encoded entity
param: array $matches preg_replace_callback() matches array
since: 1.6

_yourls_add_global_attributes( $value )   X-Ref
Helper function to add global attributes to a tag in the allowed html list.

return: array The array of attributes with global attributes added.
param: array $value An array of attributes.
since: 1.6

yourls_valid_unicode($i)   X-Ref
Helper function to determine if a Unicode value is valid.

return: bool True if the value was a valid Unicode number
param: int $i Unicode value
since: 1.6

yourls_kses_array_lc($inarray)   X-Ref
Goes through an array and changes the keys to all lower case.

return: array Fixed array with all lowercase keys
param: array $inarray Unfiltered array
since: 1.6

yourls_kses_decode_entities($string)   X-Ref
Convert all entities to their character counterparts.

This function decodes numeric HTML entities (A and A). It doesn't do
anything with other entities like ä, but we don't need them in the URL
protocol whitelisting system anyway.

return: string Content after decoded entities
param: string $string Content to change entities
since: 1.6

_yourls_kses_decode_entities_chr( $match )   X-Ref
Regex callback for yourls_kses_decode_entities()

return: string
param: array $match preg match
since: 1.6

_yourls_kses_decode_entities_chr_hexdec( $match )   X-Ref
Regex callback for yourls_kses_decode_entities()

return: string
param: array $match preg match
since: 1.6

yourls_kses_no_null($string)   X-Ref
Removes any null characters in $string.

return: string
param: string $string
since: 1.6



Generated: Sat Feb 22 05:10:06 2025 Cross-referenced by PHPXref 0.7.1