Class Majax

Description

Main class of Majax library, that provides functions for

Located in /majax.php (line 198)

MajaxCore
   |
   --Majax
Variable Summary
Method Summary
 static string addSlashes (string $str)
 static void assign ($value $value, [ $encode = true])
 static void assignXML (string $xml)
 static Majax &Instance ()
 static mixed jsonDecode (string $value)
 static string jsonEncode (mixed $value)
 static void process ()
 static void register (string $name, [mixed $function = NULL])
 static void send ([bool $exit = true])
 static string toDOM (string $xml)
 Majax Majax ()
 void initDefaults ()
 mixed jsonDecode_ (string $json)
 string jsonEncodeArray_ (mixed $value, [bool $isObject = false])
 string jsonEncodeObject_ (object $value)
 string jsonEncode_ (mixed $value)
 void &__get ( $name)
Variables
static Majax $instance_ = null (line 206)

Instance of Majax - singleton.

  • access: private
MajaxFormHandler $form_ (line 228)

Instance of MajaxFormHandler.

  • access: private
array $registered_ (line 221)

Registered functions, that are processed on Majax calls.

  • access: private
string $value_ = array() (line 214)

Value, that is send. This value is assigned by

  1. assign
and
  1. assignXML
function.

  • access: private
Methods
static addSlashes (line 608)

Adds slashes to string calling addcslashes function.

  • return: string with slashes
  • access: public
string addSlashes (string $str)
  • string $str: string
static assign (line 269)

Assigns value, that will be sended.

If parameter $encode is set to true, than value will be encoded by jsonEncode function. Otherwise raw value is used.

  • access: public
void assign ($value $value, [ $encode = true])
  • $value $value: value
  • $encode
static assignXML (line 286)

Assigns value, that will be sended.

Value must be well-formed XML. Value is transformed by Majax::toDOM function.

  • see: Majax::toDom()
  • access: public
void assignXML (string $xml)
  • string $xml: well-formed XML
static Form (line 596)

Returns MajaxFormHandler instance.

  • access: public
static Instance (line 243)

Returns Majax instance.

  • access: public
Majax &Instance ()
static jsonDecode (line 335)

Decodes JSON value to standart PHP type.

  • return: php value
  • access: public
mixed jsonDecode (string $value)
  • string $value: JSON value
static jsonEncode (line 320)

Encodes string to JSON.

  • return: encoded value
  • access: public
string jsonEncode (mixed $value)
  • mixed $value: value
static process (line 557)

Processes AJAX request.

It's necessary to call this function to process MAJAX requests.

  • see: Majax::register
  • access: public
void process ()
static register (line 539)

Registeres PHP function that handles AJAX request.

Registres function, that is called when MAJAX request with name $name is processed. If function is not specified, function with name $function is called instead.

void register (string $name, [mixed $function = NULL])
  • string $name: request name
  • mixed $function: callback function
static send (line 301)

Sends (i. e. writes out) assigned values.

Sends assigned values. If $exit is set to true, then after sending exit. If assigned value is not a string, then jsonEncode function is used.

  • access: public
void send ([bool $exit = true])
  • bool $exit: exit after sending
static toDOM (line 461)

Converts well-formed XML to Javascript code, that creates this XML.

If $xml is not well-formed exception is thrown. Return Javascript code, that after evaluation creates DOM element representing $xml. This element can be appended to existing structure.

  • return: Javascript code
  • access: public
string toDOM (string $xml)
  • string $xml: well-formed XML
Constructor Majax (line 233)

Creates instance of Majax and initializes.

  • access: private
Majax Majax ()
initDefaults (line 255)

Initializes members.

  • access: private
void initDefaults ()
jsonDecode_ (line 429)

Decodes JSON value to PHP value.

  • return: PHP value
  • access: public
mixed jsonDecode_ (string $json)
  • string $json: JSON value
jsonEncodeArray_ (line 379)

Encodes PHP array or object to JSON.

Encodes PHP array ($isObject is false) or object ($isObject is true) to JSON value.

  • return: JSON value
  • access: private
string jsonEncodeArray_ (mixed $value, [bool $isObject = false])
  • mixed $value: PHP array or object
  • bool $isObject: True, if value is object, false otherwise.
jsonEncodeObject_ (line 418)

Encodes PHP object to JSON.

  • return: JSON
  • access: private
string jsonEncodeObject_ (object $value)
  • object $value: value
jsonEncode_ (line 350)

Encodes PHP value to JSON value.

  • return: JSON value
  • access: public
string jsonEncode_ (mixed $value)
  • mixed $value: value
__get (line 614)
  • access: public
void &__get ( $name)
  • $name

Redefinition of:
MajaxCore::__get()
Access to undefined attribute is error.

Inherited Methods

Inherited From MajaxCore

 MajaxCore::__get()
 MajaxCore::__set()

Documentation generated on Tue, 23 Feb 2010 10:23:57 +0100 by phpDocumentor 1.4.3