Class iPhorm

Description

Located in /iPhorm.php (line 3)


	
			
Variable Summary
Method Summary
 static void autoload (string $class)
 static void registerAutoload ()
 void addElement (iPhorm_Element $element)
 void addElements ( $elements)
 string escape (string $value)
 string getCharset ()
 array getElements ()
 array getErrors ()
 string getSuccessMessage ()
 string getSuccessRedirect ()
 mixed getValue (string $name)
 array getValues ()
 boolean isValid ([ $values = array()])
 string jsonEncode (mixed $data)
 string process ()
 void setCharset (string $charset)
 void setSuccessMessage (string $successMessage)
 void setSuccessRedirect ( $successRedirect)
 string _dissolveArrayValue (array $value, string $arrayPath)
 string _formatMessage (string $message, [string $type = ''])
 string _prettyName (string $name)
Variables
string $_charset = 'UTF-8' (line 39)

Character encoding to use

  • access: protected
array $_elements = array() (line 10)

The elements of the form

  • access: protected
array $_successHandlers = array() (line 25)

Form success handlers

  • access: protected
string $_successMessage (line 18)

The message to display when the form is successfully submitted

  • access: protected
string $_successRedirect (line 32)

URL to redirect to on success

  • access: protected
Methods
static autoload (line 264)

Internal autoloader for spl_autoload_register().

  • access: public
void autoload (string $class)
  • string $class
static registerAutoload (line 283)

Configure autoloading of iPhorm classes

  • access: public
void registerAutoload ()
addElement (line 66)

Add a single element to the form

  • access: public
void addElement (iPhorm_Element $element)
  • $element $element: iPhorm_Element The element to add
addElements (line 77)

Add multiple elements to the form

  • access: public
void addElements ( $elements)
  • $elements $elements: array The array of elements
addSuccessHandler (line 293)

Add a success handler to the form

  • access: public
void addSuccessHandler (iPhorm_SuccessHandler_Interface $successHandler)
escape (line 254)

Escapes a value for output to browser. Uses the set character encoding.

  • return: The escaped value
  • access: public
string escape (string $value)
  • string $value: The value to escape
getCharset (line 46)

Get the character encoding

  • access: public
string getCharset ()
getElements (line 156)

Get all of the form elements

  • return: The form elements
  • access: public
array getElements ()
getErrors (line 166)

Get the elements and any errors they have

  • access: public
array getErrors ()
getSuccessHandlers (line 304)

Get all success handlers

  • return: The array of success handlers
  • access: public
array getSuccessHandlers ()
getSuccessMessage (line 242)

Get the success message

  • return: The success message
  • access: public
string getSuccessMessage ()
getSuccessRedirect (line 322)

Get the URL to redirect to on success

  • access: public
string getSuccessRedirect ()
getValue (line 213)

Get the values of a single field

  • return: The value of the given field or null
  • access: public
mixed getValue (string $name)
  • string $name: The name of the field
getValues (line 196)

Get the values of all fields

  • return: The values of all fields
  • access: public
array getValues ()
isValid (line 131)

Is the form valid?

  • return: True if valid, false otherwise
  • access: public
boolean isValid ([ $values = array()])
  • array $values: The values to check against
jsonEncode (line 184)

Encode PHP data in JSON

  • return: The JSON encoded response
  • access: public
string jsonEncode (mixed $data)
  • mixed $data: The data to encode
process (line 91)

Process the form. Checks the validity of the form.

If the form is valid the all success handlers will be run. If the form is not valid, errors are returned to the browser.

  • return: The response to display
  • access: public
string process ()
setCharset (line 56)

Set the character encoding

  • access: public
void setCharset (string $charset)
  • string $charset
setSuccessMessage (line 232)

Set the success message show after the form is successfully submitted

  • access: public
void setSuccessMessage (string $successMessage)
  • string $successMessage: The success message
setSuccessRedirect (line 312)

Set the URL to redirect to on success

  • access: public
void setSuccessRedirect ( $successRedirect)
  • $successRedirect
_dissolveArrayValue (line 352)

Extract the value by walking the array using given array path.

Given an array path such as foo[bar][baz], returns the value of the last element (in this case, 'baz').

  • access: protected
string _dissolveArrayValue (array $value, string $arrayPath)
  • array $value: Array to walk
  • string $arrayPath: Array notation path of the part to extract
_formatMessage (line 384)

Format a message with wrapping HTML <div> with classes. The message should be escaped beforehand for display in the browser, using htmlentities() for example

  • return: The HTML
  • access: protected
string _formatMessage (string $message, [string $type = ''])
  • string $message
  • string $type: Additional class to add to the wrapper
_prettyName (line 335)

Get the pretty version of the form element name. Translates the machine name to a more human readable format. E.g.

"email_address" becomes "Email address".

  • return: The pretty version of the name
  • access: protected
string _prettyName (string $name)
  • string $name: The form element name

Documentation generated on Thu, 24 Feb 2011 22:19:38 +0000 by phpDocumentor 1.4.3