HTML_QuickForm2
[ class tree: HTML_QuickForm2 ] [ index: HTML_QuickForm2 ] [ all elements ]

Class: HTML_QuickForm2_Factory

Source Location: /HTML_QuickForm2-0.2.0/QuickForm2/Factory.php

Class Overview


Static factory class


Author(s):

Version:

  • Release: 0.2.0

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 63]
Static factory class

The class handles instantiation of Element and Rule objects as well as registering of new Element and Rule classes.



[ Top ]


Class Variables

$elementTypes = array(
        'button'        => array('HTML_QuickForm2_Element_Button',
                                 'HTML/QuickForm2/Element/Button.php'),'checkbox'=>array('HTML_QuickForm2_Element_InputCheckbox','HTML/QuickForm2/Element/InputCheckbox.php'),'fieldset'=>array('HTML_QuickForm2_Container_Fieldset','HTML/QuickForm2/Container/Fieldset.php'),'file'=>array('HTML_QuickForm2_Element_InputFile','HTML/QuickForm2/Element/InputFile.php'),'hidden'=>array('HTML_QuickForm2_Element_InputHidden','HTML/QuickForm2/Element/InputHidden.php'),'image'=>array('HTML_QuickForm2_Element_InputImage','HTML/QuickForm2/Element/InputImage.php'),'inputbutton'=>array('HTML_QuickForm2_Element_InputButton','HTML/QuickForm2/Element/InputButton.php'),'password'=>array('HTML_QuickForm2_Element_InputPassword','HTML/QuickForm2/Element/InputPassword.php'),'radio'=>array('HTML_QuickForm2_Element_InputRadio','HTML/QuickForm2/Element/InputRadio.php'),'reset'=>array('HTML_QuickForm2_Element_InputReset','HTML/QuickForm2/Element/InputReset.php'),'select'=>array('HTML_QuickForm2_Element_Select','HTML/QuickForm2/Element/Select.php'),'submit'=>array('HTML_QuickForm2_Element_InputSubmit','HTML/QuickForm2/Element/InputSubmit.php'),'text'=>array('HTML_QuickForm2_Element_InputText','HTML/QuickForm2/Element/InputText.php'),'textarea'=>array('HTML_QuickForm2_Element_Textarea','HTML/QuickForm2/Element/Textarea.php'))

[line 69]

List of element types known to Factory
  • Access: protected

Type:   array


[ Top ]

$registeredRules = array(
        'nonempty'      => array('HTML_QuickForm2_Rule_Nonempty',
                                 'HTML/QuickForm2/Rule/Nonempty.php'),'empty'=>array('HTML_QuickForm2_Rule_Empty','HTML/QuickForm2/Rule/Empty.php'),'required'=>array('HTML_QuickForm2_Rule_Required','HTML/QuickForm2/Rule/Required.php'),'compare'=>array('HTML_QuickForm2_Rule_Compare','HTML/QuickForm2/Rule/Compare.php'),'eq'=>array('HTML_QuickForm2_Rule_Compare','HTML/QuickForm2/Rule/Compare.php',array('operator'=>'===')),'neq'=>array('HTML_QuickForm2_Rule_Compare','HTML/QuickForm2/Rule/Compare.php',array('operator'=>'!==')),'lt'=>array('HTML_QuickForm2_Rule_Compare','HTML/QuickForm2/Rule/Compare.php',array('operator'=>'<')),'lte'=>array('HTML_QuickForm2_Rule_Compare','HTML/QuickForm2/Rule/Compare.php',array('operator'=>'<=')),'gt'=>array('HTML_QuickForm2_Rule_Compare','HTML/QuickForm2/Rule/Compare.php',array('operator'=>'>')),'gte'=>array('HTML_QuickForm2_Rule_Compare','HTML/QuickForm2/Rule/Compare.php',array('operator'=>'>=')),'regex'=>array('HTML_QuickForm2_Rule_Regex','HTML/QuickForm2/Rule/Regex.php'),'callback'=>array('HTML_QuickForm2_Rule_Callback','HTML/QuickForm2/Rule/Callback.php'),'length'=>array('HTML_QuickForm2_Rule_Length','HTML/QuickForm2/Rule/Length.php'),'minlength'=>array('HTML_QuickForm2_Rule_Length','HTML/QuickForm2/Rule/Length.php',array('max'=>0)),'maxlength'=>array('HTML_QuickForm2_Rule_Length','HTML/QuickForm2/Rule/Length.php',array('min'=>0)),'maxfilesize'=>array('HTML_QuickForm2_Rule_MaxFileSize','HTML/QuickForm2/Rule/MaxFileSize.php'),'mimetype'=>array('HTML_QuickForm2_Rule_MimeType','HTML/QuickForm2/Rule/MimeType.php'))

[line 104]

List of registered rules
  • Access: protected

Type:   array


[ Top ]



Method Detail

createElement   [line 230]

HTML_QuickForm2_Node createElement( string $type, [mixed $name = null], [mixed $attributes = null], [array $data = array()])

Creates a new element object of the given type
  • Return: A created element
  • Throws: HTML_QuickForm2_InvalidArgumentException If type name is unknown
  • Throws: HTML_QuickForm2_NotFoundException If class for the element can not be found and/or loaded from file
  • Access: public

Parameters:

string   $type   —  Type name (treated case-insensitively)
mixed   $name   —  Element name (passed to element's constructor)
mixed   $attributes   —  Element attributes (passed to element's constructor)
array   $data   —  Element-specific data (passed to element's constructor)

[ Top ]

createRule   [line 304]

HTML_QuickForm2_Rule createRule( string $type, HTML_QuickForm2_Node $owner, [string $message = ''], [mixed $options = null])

Creates a new Rule of the given type
  • Return: A created Rule
  • Throws: HTML_QuickForm2_InvalidArgumentException If rule type is unknown
  • Throws: HTML_QuickForm2_NotFoundException If class for the rule can't be found and/or loaded from file
  • Access: public

Parameters:

string   $type   —  Rule type name (treated case-insensitively)
HTML_QuickForm2_Node   $owner   —  Element to validate by the rule
string   $message   —  Message to display if validation fails
mixed   $options   —  Additional data for the rule

[ Top ]

fileExists   [line 156]

bool fileExists( string $fileName)

Checks whether the file exists in the include path
  • Access: protected

Parameters:

string   $fileName   —  file name

[ Top ]

getRuleConfig   [line 267]

mixed getRuleConfig( string $type)

Returns configuration data for rules of the given type
  • Return: Configuration data (set when registering the rule)
  • Throws: HTML_QuickForm2_InvalidArgumentException If rule type is unknown
  • Access: public

Parameters:

string   $type   —  Rule type name (treated case-insensitively)

[ Top ]

isElementRegistered   [line 212]

bool isElementRegistered( string $type)

Checks whether an element type is known to factory
  • Access: public

Parameters:

string   $type   —  Type name (treated case-insensitively)

[ Top ]

isRuleRegistered   [line 286]

bool isRuleRegistered( string $type)

Checks whether a rule type is known to Factory
  • Access: public

Parameters:

string   $type   —  Rule type name (treated case-insensitively)

[ Top ]

loadClass   [line 174]

void loadClass( string $className, string $includeFile)

Tries to load a given class from a given file
  • Throws: HTML_QuickForm2_NotFoundException If the file either can't be loaded or doesn't contain the given class
  • Access: protected

Parameters:

string   $className   —  Class name to load
string   $includeFile   —  Name of the file (supposedly) containing the given class

[ Top ]

registerElement   [line 200]

void registerElement( string $type, string $className, [string $includeFile = null])

Registers a new element type
  • Access: public

Parameters:

string   $type   —  Type name (treated case-insensitively)
string   $className   —  Class name
string   $includeFile   —  File containing the class, leave empty if class already loaded

[ Top ]

registerRule   [line 253]

void registerRule( string $type, string $className, [string $includeFile = null], [mixed $config = null])

Registers a new rule type
  • Access: public

Parameters:

string   $type   —  Rule type name (treated case-insensitively)
string   $className   —  Class name
string   $includeFile   —  File containing the class, leave empty if class already loaded
mixed   $config   —  Configuration data for rules of the given type

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:10:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.