formit.class.php

FormIt

Copyright 2009-2011 by Shaun McCormick shaun@modx.com

FormIt is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

FormIt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with FormIt; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package
formit

\FormIt

Base class for FormIt. Used for initializing the form processing engine, handling templating and running snippets.

package
formit

Properties

Propertyprivateboolean  $_initialized= 'false'

True if the class has been initialized or not.

Default valuefalseDetails
Type
boolean
Propertypublicarray  $chunks= ''

An array of cached chunk tpls for processing

Details
Type
array
Propertypublicarray  $config= ''

A configuration array

Details
Type
array
Propertypublicint  $debugTimer= '0'

In debug mode, will monitor execution time.

Default value0Details
Type
int
access
public
Propertypublicboolean  $inTestMode= 'false'

Used when running unit tests to prevent emails/headers from being sent

Default valuefalseDetails
Type
boolean
Propertypublic\modX  $modx= ''

A reference to the modX instance

Details
Type
\modX
Propertypublic\fiHooks  $postHooks= ''

The fiHooks instance for processing postHooks

Details
Type
\fiHooks
Propertypublic\fiHooks  $preHooks= ''

The fiHooks instance for processing preHooks

Details
Type
\fiHooks
Propertypublic\fiRequest  $request= ''

The request handling class

Details
Type
\fiRequest

Methods

methodpublic  __construct( \modX $modx, array $config = array ) :
FormIt constructor
Parameters
Name Type Description
$modx \modX

&$modx A reference to the modX instance.

$config array An array of configuration options. Optional.
methodprivate  _getTplChunk( string $name ) : \modChunk/boolean
Returns a modChunk object from a template file.
Parameters
Name Type Description
$name string The name of the Chunk. Will parse to name.chunk.tpl
Returns
Type Description
\modChunk/boolean
Details
access
private
methodprotected  endDebugTimer( ) : int
Ends the debug timer and returns the total number of seconds script took to run.
Returns
Type Description
int
Details
access
protected
methodpublic  getChunk( string $name, array $properties = array ) : string
Gets a Chunk and caches it; also falls back to file-based templates for easier debugging.

Will always use the file-based chunk if $debug is set to true.

Parameters
Name Type Description
$name string The name of the Chunk
$properties array The properties for the Chunk
Returns
Type Description
string
Details
access
public
methodpublic  getStoreKey( ) : string
Gets a unique session-based store key for storing form submissions.
Returns
Type Description
string
methodpublic  initialize( string $context = web ) : mixed
Initialize the component into a context and provide context-specific handling actions.
Parameters
Name Type Description
$context string The context to initialize FormIt into
Returns
Type Description
mixed
Details
access
public
methodpublic  isInitialized( ) : boolean
Sees if the FormIt class has been initialized already
Returns
Type Description
boolean
methodpublic  loadHooks( \$type $type = post, \$config $config = array ) : \fiHooks
Loads the Hooks class.
Parameters
Name Type Description
$type \$type string The type of hook to load.
$config \$config array An array of configuration parameters for the hooks class
Returns
Type Description
\fiHooks
Details
access
public
methodpublic  loadModule( string $className, string $serviceName, array $config = array ) : \fiModule
Parameters
Name Type Description
$className string
$serviceName string
$config array
Returns
Type Description
\fiModule
methodpublic  loadRequest( ) : \fiRequest
Load the fiRequest class
Returns
Type Description
\fiRequest
methodpublic  output( string $output ) : string
Output the final output and wrap in the wrapper chunk. Optional, but recommended for debugging as it outputs the execution time to the output.

Also, it is good to output your snippet code with wrappers for easier CSS isolation and styling.

Parameters
Name Type Description
$output string The output to process
Returns
Type Description
string
Details
access
public
methodprotected  startDebugTimer( ) : int
Starts the debug timer.
Returns
Type Description
int
Details
access
protected
Documentation was generated by DocBlox 0.13-DEV.