Class JSRSService

Description

Handles JSRS requests

JSRS is an acronym for Javascript Remote Scripting. It's a library that is able to perform calls to PHP functions from inside a Javascript code block. Internally, the request is performed through a hidden IFRAME element.

This class handles these requests. Parses the request, calls the requested function or method and prints its results.

Located in /core/service/JSRSService.class.php (line 47)

PHP2Go
   |
   --AbstractService
      |
      --JSRSService
Variable Summary
Method Summary
static string arrayToString (array $arr, [string $lineSep = '|'], [string $colSep = '~'])
static bool debugEnabled ()
bool acceptRequest ()
void onError (int $code, string $message, string $file, int $line, array $vars)
void sendResponse (string $response)
string _escapeResponse (string $response)
Variables
Methods
static method arrayToString (line 88)

Utility method to convert an array into a string with separators

static string arrayToString (array $arr, [string $lineSep = '|'], [string $colSep = '~'])
  • array $arr: Input array
  • string $lineSep: Lines separator
  • string $colSep: Columns separator
static method debugEnabled (line 105)

Verifies if JSRS debug flag is present in the request

static bool debugEnabled ()
static method getInstance (line 72)

Get the singleton of the JSRSService class

static JSRSService &getInstance ()
Constructor JSRSService (line 62)

Class constructor

JSRSService JSRSService ()
acceptRequest (line 116)

Tries to parse context ID, handler ID and handler arguments from the request

  • access: protected
bool acceptRequest ()

Redefinition of:
AbstractService::acceptRequest()
Must be implemented by child classes
onError (line 185)

Handles errors when error handling is enabled

void onError (int $code, string $message, string $file, int $line, array $vars)
  • int $code: Error code
  • string $message: Error message
  • string $file: File path
  • int $line: Line number
  • array $vars: Local scope variables

Redefinition of:
AbstractService::onError()
Must be implemented by child classes
onInvalidHandler (line 169)

Executed when JSRS handler ID is invalid

  • access: protected
void onInvalidHandler ()

Redefinition of:
AbstractService::onInvalidHandler()
Must be implemented by child classes
onMissingHandler (line 157)

Executed when JSRS handler ID is not found in the request

  • access: protected
void onMissingHandler ()

Redefinition of:
AbstractService::onMissingHandler()
Must be implemented by child classes
sendResponse (line 142)

Builds and prints the response produced by the JSRS handler

  • access: protected
void sendResponse (string $response)
  • string $response: Response contents

Redefinition of:
AbstractService::sendResponse()
Must be implemented by child classes
_escapeResponse (line 205)

Escape some special chars inside a response

  • access: private
string _escapeResponse (string $response)
  • string $response: Response

Inherited Methods

Inherited From AbstractService

AbstractService::AbstractService()
AbstractService::acceptRequest()
AbstractService::handleRequest()
AbstractService::onError()
AbstractService::onInvalidHandler()
AbstractService::onMissingHandler()
AbstractService::registerHandler()
AbstractService::registerObject()
AbstractService::sendResponse()
AbstractService::setErrorHandling()
AbstractService::setFallbackHandler()

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:26:54 -0300 by phpDocumentor 1.3.2