__construct()
__toString()
addAttribute()
addFilter()
addRule()
getAttribute()
getAttributeStr()
getAttributes()
getHtml()
getLabel()
getName()
getSession()
getUnfilteredValue()
getValue()
getViolatedRules()
hasFilter()
hasRule()
isDisabled()
isHidden()
isIgnored()
printInfo()
setAttributes()
setDisabled()
setFixed()
setHidden()
setIgnore()
setReadonly()
setRequiredAttributes()
setSession()
setValue()
validate()
_buildAttributeStr()
_filterValue()
_init()
_initToken()
_validateItemValue()
_makeDomId()
$_attributes
$_filters
$_isDisabled
$_isFixed
$_isHidden
$_isIgnored
$_isReadonly
$_label
$_name
$_requiredAttributes
$_rules
$_session
$_value
$_filteredValue
$_ruleAdded
$_violatedRules
Protects a form from XSRF attacks.
| category | Formagic |
|---|---|
| package | Item |
| author | Florian Sonnenburg |
| copyright | Copyright (c) 2007-2009 Florian Sonnenburg |
| version | $Id: XsrfProtection.php 167 2012-05-01 13:37:06Z meweasle $ |
__construct(string $name, array $arguments) : void
| inherited_from | \Formagic_Item_Abstract::__construct() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::__construct() |
stringName of item
arrayAdditional arguments
\Formagic_Exception |
|---|
__toString() : string
| inherited_from | \Formagic_Item_Abstract::__toString() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::__toString() |
stringThe HTML string representation.addAttribute(string $name, string $value) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::addAttribute() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::addAttribute() |
stringAttribute name
stringAttribute value
\Formagic_Item_AbstractThis object.addFilter(mixed $filter, array $args) : \Formagic_Item_Abstract
Formagic items can have multiple filters which will be applied in the order they are passed to the object.
First parameter $filter can either be a string or an object of a class that extends Formagic_Filter_Interface. A string value is assumed to be the type of filter to be added.
This method throws an exception if no valid role object can be identified.
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::addFilter() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::addFilter() |
mixedFilter type string or Formagic_Filter_Interface object.
arrayOptional array of arguments. Will be passed to the filter constructor as array.
\Formagic_Exception |
|---|
\Formagic_Item_AbstractFluent interfaceaddRule(mixed $rule, array $args) : \Formagic_Item_Abstract
Formagic items can have multiple rules which will be applied in the order they are passed to the object.
First parameter $rule can either be a string or an instance of a class that extends Formagic_Rule_Abstract. A string value is assumed to be the type of rule to be added.
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::addRule() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::addRule() |
mixedRule type string or Formagic_Rule_Abstract object.
arrayOptional array of arguments. Will be passed to the rule constructor as array.
\Formagic_Exception |
If no valid role object can be identified. |
|---|
\Formagic_Item_AbstractThis object.getAttribute(string $name) : string
| see | \Formagic_Item_Abstract::setAttributes() |
|---|---|
| see | \Formagic_Item_Abstract::addAttribute() |
| inherited_from | \Formagic_Item_Abstract::getAttribute() |
| inherited_from | \Formagic_Item_Hidden::getAttribute() |
stringName of the attribute value to fetch
stringAttribute valuegetAttributeStr() : string
Takes the attributes array and transforms it into a string that can be directly inserted into a HTML tag. The string will be built with a trailing space character.
Two default attributes are added to the attributes string: "name" and "id". If you want to skip these, add them to your attributes on item generation or via setAttributes() or addAttribute() with NULL as value.
$item->setAttributes(array('class' => 'myclass', 'onclick' => 'alert('Formagic');'));
$string = $item->getAttributeStr();
echo '';
// output will be:
//
| see | \Formagic_Item_Abstract::setAttributes() |
|---|---|
| see | \Formagic_Item_Abstract::addAttribute() |
| inherited_from | \Formagic_Item_Abstract::getAttributeStr() |
| inherited_from | \Formagic_Item_Hidden::getAttributeStr() |
stringThe attributes string.getAttributes() : array
| see | \Formagic_Item_Abstract::setAttributes() |
|---|---|
| see | \Formagic_Item_Abstract::addAttribute() |
| inherited_from | \Formagic_Item_Abstract::getAttributes() |
| inherited_from | \Formagic_Item_Hidden::getAttributes() |
arrayThe attributes array.getHtml() : string
Should be overwritten by subclasses.
stringField HTMLgetLabel() : string
| inherited_from | \Formagic_Item_Abstract::getLabel() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::getLabel() |
stringThe label string.getName() : string
| inherited_from | \Formagic_Item_Abstract::getName() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::getName() |
stringThe item namegetSession() : \Formagic_Session_Interface
\Formagic_Session_InterfaceSession objectgetUnfilteredValue() : mixed
| inherited_from | \Formagic_Item_Abstract::getUnfilteredValue() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::getUnfilteredValue() |
mixedThe unfiltered item valuegetValue() : mixed
| inherited_from | \Formagic_Item_Abstract::getValue() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::getValue() |
mixedThe filtered item valuegetViolatedRules() : array
If no rules were violated or if no validation has been performed yet, an empty array will be returned.
| inherited_from | \Formagic_Item_Abstract::getViolatedRules() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::getViolatedRules() |
arrayThe violated rules.hasFilter(string $filterName) : boolean
| inherited_from | \Formagic_Item_Abstract::hasFilter() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::hasFilter() |
stringFilter name
booleanCheck valuehasRule(string $ruleName) : boolean
The $ruleName parameter has to be a string with the name of rule that is looked for. If you want to know for example if the item has the mandatory rule added, $ruleName would have to be 'mandatory'.
The search string is case insensitive.
addRule($mandatory);
// look for the rule
$ruleExists = $item->hasRule('mandatory'); // would return TRUE
$ruleExists = $item->hasRule('Mandatory'); // would return TRUE
$ruleExists = $item->hasRule('Formagic_Rule_Mandatory'); // would return FALSE
?>
| inherited_from | \Formagic_Item_Abstract::hasRule() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::hasRule() |
stringRule name, eg. 'Mandatory'
booleanisDisabled() : boolean
| inherited_from | \Formagic_Item_Abstract::isDisabled() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::isDisabled() |
booleanThe disabled status.isHidden() : boolean
| inherited_from | \Formagic_Item_Abstract::isHidden() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::isHidden() |
booleanThe hidden status.isIgnored() : boolean
| inherited_from | \Formagic_Item_Abstract::isIgnored() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::isIgnored() |
booleanThe ignored status.printInfo() : string
| inherited_from | \Formagic_Item_Abstract::printInfo() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::printInfo() |
stringThe item information stringsetAttributes(array $attArray) : \Formagic_Item_Abstract
Mainly used for additional HTML attributes other than "name", "id" or "value", such as "style", "class", javascript-handlers etc. Attributes are added corresponding to key->value-pairs in $attArray.
setAttributes() will overwrite any previously added item attributes.
Implements a fluent interface pattern.
| see | \Formagic_Item_Abstract::addAttribute() |
|---|---|
| inherited_from | \Formagic_Item_Abstract::setAttributes() |
| inherited_from | \Formagic_Item_Hidden::setAttributes() |
arrayThe new
\Formagic_Item_AbstractThis object.setDisabled(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::setDisabled() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::setDisabled() |
booleanDefined item's disabled status.
\Formagic_Item_AbstractFluent interfacesetFixed(boolean $flag) : \Formagic_Item_Abstract
If set to true, all following calls to setValue() will be ignored.
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::setFixed() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::setFixed() |
booleanIsFixed flag value.
\Formagic_Item_AbstractThis object.setHidden(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::setHidden() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::setHidden() |
booleanHidden status flag.
\Formagic_Item_AbstractThis object.setIgnore(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::setIgnore() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::setIgnore() |
booleanIgnored status flag.
\Formagic_Item_AbstractThis object.setReadonly(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::setReadonly() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::setReadonly() |
booleanReadonly status flag.
\Formagic_Item_AbstractThis object.setRequiredAttributes(array $requiredAttributes) : \Formagic_Item_Abstract
Default required attributes are "id" and "name".
| inherited_from | \Formagic_Item_Abstract::setRequiredAttributes() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::setRequiredAttributes() |
arrayNumeric array of required attributes.
\Formagic_Item_AbstractFluent interface.setValue(mixed $value) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
| inherited_from | \Formagic_Item_Abstract::setValue() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::setValue() |
mixedThe new item value.
\Formagic_Item_AbstractThis object.validate() : boolean
Iterates through all defined rules of Formagic item. Returns true if all rules apply or false otherwise.
boolean_buildAttributeStr(array $attributes) : string
| inherited_from | \Formagic_Item_Abstract::_buildAttributeStr() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::_buildAttributeStr() |
arrayarray of attributes
stringAttributes string_filterValue(Formagic_Filter_Interface $filter, mixed $subject) : mixed
| inherited_from | \Formagic_Item_Abstract::_filterValue() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::_filterValue() |
mixedScalar or array
mixedFiltered scalar or array_init(array $additionalArgs) : void
_initToken() : void
_validateItemValue(Formagic_Rule_Abstract $rule, string | array $subject) : boolean
| inherited_from | \Formagic_Item_Abstract::_validateItemValue() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::_validateItemValue() |
stringarrayValidation subject
booleanValidation result_makeDomId(string $str) : string
| inherited_from | \Formagic_Item_Abstract::_makeDomId() |
|---|---|
| inherited_from | \Formagic_Item_Hidden::_makeDomId() |
stringString to convert to a DOM ID
stringValid DOM ID$_attributes : array
| inherited_from | \Formagic_Item_Abstract::$$_attributes |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_attributes |
$_filters : array
| inherited_from | \Formagic_Item_Abstract::$$_filters |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_filters |
$_isDisabled : boolean
| inherited_from | \Formagic_Item_Abstract::$$_isDisabled |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_isDisabled |
$_isFixed : boolean
| inherited_from | \Formagic_Item_Abstract::$$_isFixed |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_isFixed |
$_isHidden : boolean
| inherited_from | \Formagic_Item_Abstract::$$_isHidden |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_isHidden |
$_isIgnored : boolean
| inherited_from | \Formagic_Item_Abstract::$$_isIgnored |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_isIgnored |
$_isReadonly : boolean
| inherited_from | \Formagic_Item_Abstract::$$_isReadonly |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_isReadonly |
$_label : boolean
| inherited_from | \Formagic_Item_Abstract::$$_label |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_label |
$_name : string
| inherited_from | \Formagic_Item_Abstract::$$_name |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_name |
$_requiredAttributes : array
| inherited_from | \Formagic_Item_Abstract::$$_requiredAttributes |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_requiredAttributes |
$_rules : array
| inherited_from | \Formagic_Item_Abstract::$$_rules |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_rules |
$_value : mixed
| inherited_from | \Formagic_Item_Abstract::$$_value |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_value |
$_filteredValue : mixed
| inherited_from | \Formagic_Item_Abstract::$$_filteredValue |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_filteredValue |
$_ruleAdded : boolean
$_violatedRules : \Form_Rule_Abstract
| inherited_from | \Formagic_Item_Abstract::$$_violatedRules |
|---|---|
| inherited_from | \Formagic_Item_Hidden::$$_violatedRules |