[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/pear/HTML/AJAX/ -> Server.php (summary)

OO AJAX Implementation for PHP SVN Rev: $Id: Server.php,v 1.1.2.1 2008/10/03 07:09:51 nicolasconnault Exp $

Author: Joshua Eichorn <josh@bluga.net>
Copyright: 2005 Joshua Eichorn
License: http://www.opensource.org/licenses/lgpl-license.php LGPL
Version: Release: @package_version@
File Size: 725 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

HTML_AJAX_Server:: (23 methods):
  HTML_AJAX_Server()
  handleRequest()
  registerClass()
  setSerializer()
  registerJSLibrary()
  registerInitObject()
  registerPhpCallback()
  generateClient()
  _readFile()
  clientJsLocation()
  setClientJsLocation()
  setJavascriptLibraryPath()
  setJavascriptLibraryPaths()
  _loadOptions()
  _cleanIdentifier()
  _initAll()
  _init()
  _cacheRuleFile()
  _cacheRuleApi()
  _cacheRuleContent()
  _sendCacheHeaders()
  _compareEtags()
  _callCacheRule()


Class: HTML_AJAX_Server  - X-Ref

Class for creating an external AJAX server

Can be used in 2 different modes, registerClass mode where you create an instance of the server and add the classes that will be registered
and then run handle request

Or you can extend it and add init{className} methods for each class you want to export

Client js generation is exposed through 2 _GET params client and stub
Setting the _GET param client to `all` will give you all the js classes needed
Setting the _GET param stub to `all` will give you stubs of all registered classes, you can also set it too just 1 class

HTML_AJAX_Server($serverUrl = false)   X-Ref
Constructor creates the HTML_AJAX instance

param: string $serverUrl (Optional) the url the client should be making a request too

handleRequest()   X-Ref
Handle a client request, either generating a client or having HTML_AJAX handle the request

return: boolean true if request was handled, false otherwise

registerClass(&$instance, $exportedName = false, $exportedMethods = false)   X-Ref
Register method passthrough to HTML_AJAX


setSerializer($type)   X-Ref
Change default serialization - important for exporting classes

I wanted this for the xml serializer :)

registerJSLibrary($libraryName,$fileName,$path = false)   X-Ref
Register a new js client library

param: string          $libraryName name you'll reference the library as
param: string|array    $fileName   actual filename with no path, for example customLib.js
param: string|false    $path   Optional, if not set the result from jsClientLocation is used

registerInitObject(&$instance)   X-Ref
Register init methods from an external class

param: object    $instance an external class with initClassName methods

registerPhpCallback($callback)   X-Ref
Register a callback to be exported to the client

This function uses the PHP callback pseudo-type


generateClient()   X-Ref
Generate client js


_readFile($file)   X-Ref
Run readfile on input with basic error checking

param: string  $file   file to read

clientJsLocation()   X-Ref
Get the location of the client js
To override the default pear datadir location set $this->clientJsLocation

return: string

setClientJsLocation($location)   X-Ref
Set the location of the client js

param: string  $location   Location
return: void

setJavascriptLibraryPath($library, $path)   X-Ref
Set the path to a Javascript libraries

param: string  $library    Library name
param: string  $path       Path
return: void

setJavascriptLibraryPaths($paths)   X-Ref
Set the path to more than one Javascript libraries at once

param: array   $paths  Paths
return: void

_loadOptions()   X-Ref
Load options from _GET


_cleanIdentifier($input)   X-Ref
Clean an identifier like a class name making it safe to use

param: string  $input
return: string

_initAll()   X-Ref
Run every init method on the class


_init($className)   X-Ref
Init one class

param: string  $className

_cacheRuleFile($files)   X-Ref
Generate a hash from a list of files

param: array   $files  file list
return: string  a hash that can be used as an etag

_cacheRuleApi($classes)   X-Ref
Generate a hash from the api of registered classes

param: array   $classes class list
return: string  a hash that can be used as an etag

_cacheRuleContent($content)   X-Ref
Generate a hash from the raw content

param: array   $content
return: string  a hash that can be used as an etag

_sendCacheHeaders($etag,$notModified)   X-Ref
Send cache control headers


_compareEtags($serverETag)   X-Ref
Compare eTags

param: string  $serverETag server eTag
return: boolean

_callCacheRule($rule,$payload)   X-Ref
Call a cache rule and return its retusn

param: string  $rule Stub|Client
param: mixed   $payload
return: boolean



Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7