XMF Cookbook
  • Introduction
  • XMF Cookbook
  • Basic Ingredients
    • Namespaces
    • Autoloading
    • Debugging
    • Forward Compatibility
  • Recipes
    • Introducing Module Helpers
    • Using the Permission Helper
      • Checking Permissions
      • Managing Item Permissions
    • Using the Session Helper
    • Using JSON Web Tokens
    • Altering Database Tables
    • Migrating a Module's Database
    • Loading Initial Data
    • Module Admin Pages
      • Hide and Seek with Icons
      • Standard Admin Pages
    • Manage Metadata
    • Highlighting Content
  • Reference
    • Assert
      • Assertions
    • Database
      • Migrate
      • TableLoad
      • Tables
        • Getting Started
        • Table Operations
        • Working with Columns
        • Working with Indexes
        • Changing Table Data
        • Interacting with the Work Queue
        • Error Info and Debugging
    • Debug
    • FilterInput
    • Highlighter
    • IPAddress
    • Jwt
      • JsonWebToken
      • KeyFactory
      • TokenFactory
      • TokenReader
    • Key
      • ArrayStorage
      • Basic
      • FileStorage
      • KeyAbstract
      • StorageInterface
    • Language
    • Metagen
      • Extracting Data
      • Applying Data
    • Module
      • Admin
      • Helper
      • Helper
        • AbstractHelper
        • Cache
        • GenericHelper
        • Permission
        • Session
    • ProxyCheck
    • Random
    • Request
    • StopWords
    • Uuid
    • Yaml
  • Credits
  • License:
  • Table of Content
Powered by GitBook
On this page
  • FilterInput::getInstance()
  • process($source)
  • FilterInput::clean($source, $type)
  • cleanVar($source, $type)
  1. Reference

FilterInput

The Xmf\FilterInput class support cleaning and filtering data

FilterInput::getInstance()

Returns a Xmf\FilterInput object, only creating it if it does not already exist.

It is possible to customize the behavior of FilterInput by passing configuration variables to getInstance(). See the source for more information.

process($source)

Clean the $source, a string or array of values, processing to remove XSS and other bad code.

Returns the cleaned version of $source.

FilterInput::clean($source, $type)

Cleans the input $source removing XSS and other bad code using the defaults. Also, filters the input, conforming to the specified $type. 'STRING' is the default $type.

Available type are the same as documented with the cleanVar() method.

cleanVar($source, $type)

Cleans the input $source with rules established when the instance of FilterInput was instantiated. Also, filters the input, conforming it to the specified $type. 'STRING' is the default $type.

Available type are:

Type

Allowed value

ALPHANUM or ALNUM

Alphanumeric

ARRAY

Recursively cleans each element

BASE64

Base64 encoded

BOOLEAN or BOOL

true or false

CMD

Command - only characters A-Z, 0-9, underscore, dash and period, forced to lower case.

EMAIL

a valid email address

FLOAT or DOUBLE

floating point number

INTEGER or INT

an integer

IP

a valid IP address

PATH

a filesystem or web path

STRING

a string

USERNAME

Username

WEBURL

a web URL

WORD

only letters A-Z and underscore

Returns the cleaned version of $source.

PreviousDebugNextHighlighter

Last updated 6 years ago