1.20.x common.inc check_url($uri)

Strips dangerous protocols from a URI and encodes it for output to HTML.

Parameters

$uri: A plain-text URI that might contain dangerous protocols.

Return value

A URI stripped of dangerous protocols and encoded for output to an HTML: attribute value. Because it is already encoded, it should not be set as a value within a $attributes array passed to backdrop_attributes(), because backdrop_attributes() expects those values to be plain-text strings. To pass a filtered URI to backdrop_attributes(), call backdrop_strip_dangerous_protocols() instead.

See also

backdrop_strip_dangerous_protocols()

Related topics

File

includes/common.inc, line 1775
Common functions that many Backdrop modules will need to reference.

Code

function check_url($uri) {
  return check_plain(backdrop_strip_dangerous_protocols($uri));
}