[ 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)

since: 1.6
return: void

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.

since: 1.6
return: array All tags

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

since: 1.6
return: array Allowed tags

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

since: 1.6
return: array Allowed entities

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

since: 1.6
return: array Allowed protocols

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.

since: 1.6
param: string $string Content to normalize entities
return: string Content with normalized 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.

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

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.

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

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.

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

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

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

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

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

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

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

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.

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

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

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

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

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

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

since: 1.6
param: string $string
return: string



Generated: Fri Apr 18 05:10:03 2025 Cross-referenced by PHPXref 0.7.1