Class modConnectorResponse

Description

Encapsulates an HTTP response from the MODx manager.

Includes functions to manipluate header data, such as status codes, as well as manipulating the response body.

  • extends: modResponse

Located in /model/modx/modconnectorresponse.class.php (line 16)

modResponse
   |
   --modConnectorResponse
Variable Summary
 string $_directory
Method Summary
 modConnectorResponse __construct (modX &$modx)
 string outputArray ( $array, [mixed $count = false])
 void outputContent ([ $options = array()])
 void setDirectory ([string $dir = ''])
 string toJSON (mixed $data)
 string _decodeLiterals (string $string)
 void _encodeLiterals (mixed &$value, integer|string $key)
Variables
string $_directory (line 23)

The base location of the processors called by the connectors.

  • access: protected

Inherited Variables

Inherited from modResponse

modResponse::$body
modResponse::$header
modResponse::$modx
Methods
Constructor __construct (line 30)

Creates a modConnectorResponse object.

modConnectorResponse __construct (modX &$modx)

Redefinition of:
modResponse::__construct()
outputArray (line 128)

Return arrays of objects (with count) converted to JSON.

Creates a modConnectorResponse object.

The JSON result includes two main elements, total and results. This format is used for list results.

  • return: The JSON output.
  • access: public
string outputArray ( $array, [mixed $count = false])
  • array $array: An array of data objects.
  • mixed $count: The total number of objects. Used for pagination.
outputContent (line 41)

Overrides modResponse::outputContent to provide connector-specific processing.

Creates a modConnectorResponse object.

  • access: public
void outputContent ([ $options = array()])
  • array $options

Redefinition of:
modResponse::outputContent()
Prepare the final response after the resource has been processed.
setDirectory (line 142)

Set the physical location of the processor directory for the response handler.

Creates a modConnectorResponse object.

This allows for dynamic processor locations.

  • access: public
void setDirectory ([string $dir = ''])
  • string $dir: The directory to set as the processors directory.
toJSON (line 160)

Converts PHP to JSON with JavaScript literals left in-tact.

Creates a modConnectorResponse object.

JSON does not allow JavaScript literals, but this function encodes certain identifiable literals and decodes them back into literals after modX::toJSON() formats the data.

  • return: The extended JSON-encoded string.
  • access: public
string toJSON (mixed $data)
  • mixed $data: The PHP data to be converted.
_decodeLiterals (line 193)

Decodes strings encoded by _encodeLiterals to restore JavaScript literals.

Creates a modConnectorResponse object.

  • return: The JSON-encoded string with literals restored.
  • access: protected
string _decodeLiterals (string $string)
  • string $string: The JSON-encoded string with encoded literals.
_encodeLiterals (line 174)

Encodes certain JavaScript literal strings for later decoding.

Creates a modConnectorResponse object.

  • access: protected
void _encodeLiterals (mixed &$value, integer|string $key)
  • mixed &$value: A reference to the value to be encoded if it is identified as a literal.
  • integer|string $key: The array key corresponding to the value.

Inherited Methods

Inherited From modResponse

 modResponse::__construct()
 modResponse::checkPreview()
 modResponse::outputContent()
 modResponse::sendRedirect()

Documentation generated on Fri, 17 Jun 2011 10:03:30 -0600 by phpDocumentor 1.4.3