SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » sanitize()

sanitize()

Description

class SimplePie {
	sanitize ( mixed $data, integer $type, [ string $base = '' ] )
}

Sanitizes the incoming data to ensure that it matches the type of data expected. Also absolutizes relative URLs, and a few other things to ensure the data is of the best quality.

Availability

  • Available since SimplePie 1.0.

Parameters

data

The data that needs to be sanitized.

type

The type of data that it's supposed to be.

  • SIMPLEPIE_CONSTRUCT_NONE
    No construct (:?: This could use a better description)
  • SIMPLEPIE_CONSTRUCT_TEXT
    Plain text content
  • SIMPLEPIE_CONSTRUCT_HTML
    HTML content
  • SIMPLEPIE_CONSTRUCT_XHTML
    XHTML content
  • SIMPLEPIE_CONSTRUCT_BASE64
    Base64 content
  • SIMPLEPIE_CONSTRUCT_IRI
    IRI content (e.g. URLs, URIs, etc.)
  • SIMPLEPIE_CONSTRUCT_MAYBE_HTML
    Might be HTML, so let's treat it as such.
  • SIMPLEPIE_CONSTRUCT_ALL
    All types of content

base

The xml:base value to use when converting relative URLs to absolute ones.

Examples

Sanitize the data as a URL

$data = $feed->sanitize('http://simplepie.org/wiki/', SIMPLEPIE_CONSTRUCT_IRI);

See Also


reference/simplepie/sanitize.txt · Last modified: 2011/03/06 03:56 (external edit)