CPAINT :: Cross-Platform Asynchronous INterface Toolkit

Please note: CPAINT nor this website is under active development.

Backend: cpaint.register()

cpaint Method Summary

boolean register()
boolean unregister()
void start()
void return_data()
object add_node()
void set_data()
mixed get_data()
void set_id()
string get_id()
void set_attribute()
string get_attribute()
void set_name()
string get_name()
string get_response_type()

boolean register (mixed function_name [, string alias [, array input [, array output ]]])

Publishes a backend function as CPAINT API function.

Class

cpaint

Parameters

» mixed function_namename of the backend function.
» string aliasalias name for the function. Will be used by the frontend.
» array inputfunction input parameters (not yet used by CPAINT and subject to change).
» array outputfunction output format (not yet used by CPAINT and subject to change).

Return Value

» boolean

API Tags

» Access: public

Description

To avoid remote code-execution every backend function that is supposed to be callable by the CPAINT frontend cpaint.call() must be published to the CPAINT backend by this function.

Note: Obviously, all CPAINT API functions must be registered before cpaint.start() is called.

Note (PHP): CPAINT is able to use methods of an object as API functions. If you would like to do so, you must pass an array with a reference to the object and the method name to CPAINT, like this:
  $cp->register ( array ( &$my_object, 'object_method' ) );
Static class functions can be registered like this:
  $cp->register ( array ( 'class_name', 'object_method' ) );
If you're using only standalone functions you may simply suply the function name:
  $cp->register ( 'function_name' );

This behaviour is consistent with that of PHPs builtin functions call_user_func() and similar.

Note: The second and third argument input and output are present for forward-compatibility reasons only. They are entirely optional and unused by the CPAINT code.