class CRM_Utils_API_HTMLInputCoder extends CRM_Utils_API_AbstractFieldCoder

This class captures the encoding practices of CRM-5667 in a reusable fashion. In this design, all submitted values are partially HTML-encoded before saving to the database. If a DB reader needs to output in non-HTML medium, then it should undo the partial HTML encoding.

This class should be short-lived -- 4.3 should introduce an alternative escaping scheme and consequently remove HTMLInputCoder.

Methods

array
getSkipFields()

Get skipped fields.

bool
isSkippedField(string $fldName)

Is field skipped.

encodeInput(array|string $values, bool $castToString = FALSE)

going to filter the submitted values across XSS vulnerability.

mixed
decodeOutput(string $values, bool $castToString = FALSE)

No description

array
fromApiInput(array $apiRequest)

No description

array
toApiOutput(array $apiRequest, array $result)

No description

bool
isApiControlField($key)

No description

singleton()

No description

Details

at line 64
array getSkipFields()

Get skipped fields.

Return Value

array List of field names

bool isSkippedField(string $fldName)

Is field skipped.

Parameters

string $fldName

Return Value

bool TRUE if encoding should be skipped for this field

at line 126
encodeInput(array|string $values, bool $castToString = FALSE)

going to filter the submitted values across XSS vulnerability.

Parameters

array|string $values the field value from the API
bool $castToString If TRUE, all scalars will be filtered (and therefore cast to strings). If FALSE, then non-string values will be preserved

at line 141
mixed decodeOutput(string $values, bool $castToString = FALSE)

Parameters

string $values
bool $castToString

Return Value

mixed

array fromApiInput(array $apiRequest)

Parameters

array $apiRequest

Return Value

array modified $apiRequest

array toApiOutput(array $apiRequest, array $result)

Parameters

array $apiRequest
array $result

Return Value

array modified $result

protected bool isApiControlField($key)

Parameters

$key

Return Value

bool

at line 51
static CRM_Utils_API_HTMLInputCoder singleton()