[ 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
since: 1.6
param: string $string Content to normalize entities

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
since: 1.6
param: array $matches preg_replace_callback() matches array

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
since: 1.6
param: array $matches preg_replace_callback() matches array

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
since: 1.6
param: array $matches preg_replace_callback() matches array

_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.
since: 1.6
param: array $value An array of attributes.

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
since: 1.6
param: int $i Unicode value

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
since: 1.6
param: array $inarray Unfiltered array

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
since: 1.6
param: string $string Content to change entities

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

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

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

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

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

return: string
since: 1.6
param: string $string



Generated: Wed May 14 05:10:02 2025 Cross-referenced by PHPXref 0.7.1