TeraWurfl
[ class tree: TeraWurfl ] [ index: TeraWurfl ] [ all elements ]

Class: TeraWurflWebservice

Source Location: /TeraWurflWebservice.php

Class Overview


The server-side Tera-WURFL webservice provider. Normally used with webservice.php


Variables

Methods



Class Details

[line 20]
The server-side Tera-WURFL webservice provider. Normally used with webservice.php



[ Top ]


Class Variables

static $ALLOWED_CLIENT_IPS =  false

[line 41]

Allow clients to query the webservice only from the listed networks. Setting this variable to false disables the filter and allows connections from ANY client IP.

To allow only certain networks, put them in CIDR notation in an array. For example, to allow only the range 172.16.10.0/24 and the single IP 192.168.2.17 you would use this as the setting:

  1.  public static $ALLOWED_CLIENT_IPS array('172.16.10.0/24','192.168.2.17/32');

NOTE: 127.0.0.1/32 is automatically allowed, however, some clients may use a different loopback address like 127.1.1.1. In this case, add 127.0.0.0/8 to your list.

Unauthorized attempts to use this webservice are logged to the Tera-WURFL log file with a severity of LOG_WARNING.




Tags:

access:  public

Type:   Mixed


[ Top ]

static $FORMAT_JSON =  'json'

[line 44]



Tags:

access:  public

Type:   mixed


[ Top ]

static $FORMAT_XML =  'xml'

[line 43]



Tags:

access:  public

Type:   mixed


[ Top ]

$access_log_filename =  'webservice_access.log'

[line 70]

Filename of access log



Tags:

access:  public

Type:   String


[ Top ]

$access_log_path =  null

[line 75]

The directory where the access log is stored. Set to null to use the Tera-WURFL data/ directory



Tags:

access:  public

Type:   String


[ Top ]

$enable_access_log =  false

[line 65]

Log all access of the webservice



Tags:

var:  Enable
access:  public

Type:   Boolean


[ Top ]

$enable_error_log =  true

[line 50]

Log all errors from the webservice



Tags:

var:  Enable
access:  public

Type:   Boolean


[ Top ]

$error_log_filename =  'webservice_error.log'

[line 55]

Filename of error log



Tags:

access:  public

Type:   String


[ Top ]

$error_log_path =  null

[line 60]

The directory where the error log is stored. Set to null to use the Tera-WURFL data/ directory



Tags:

access:  public

Type:   String


[ Top ]

$flatCapabilities = array()

[line 85]



Tags:

access:  protected

Type:   mixed


[ Top ]

$format =

[line 77]



Tags:

access:  protected

Type:   mixed


[ Top ]

$json =

[line 79]



Tags:

access:  protected

Type:   mixed


[ Top ]

$out_cap = array()

[line 80]



Tags:

access:  protected

Type:   mixed


[ Top ]

$out_errors = array()

[line 82]



Tags:

access:  protected

Type:   mixed


[ Top ]

$search_results = array()

[line 81]



Tags:

access:  protected

Type:   mixed


[ Top ]

$userAgent =

[line 83]



Tags:

access:  protected

Type:   mixed


[ Top ]

$wurflObj =

[line 84]



Tags:

access:  protected

Type:   mixed


[ Top ]

$xml =

[line 78]



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


static method ipInCIDRNetwork [line 162]

static Bool ipInCIDRNetwork( String $cidr_network, String $ip)

See if a given ip ($ip) is in a given CIDR network ($cidr_range)



Tags:

return:  IP Address is in CIDR Network
access:  public


Parameters:

String   $cidr_network   CIDR Network (e.g. "192.168.2.0/24")
String   $ip   IP Address

[ Top ]

constructor __construct [line 87]

TeraWurflWebservice __construct( $userAgent, $searchPhrase, [ $data_format = 'xml'], [ $teraWurflInstance = null])



Tags:

access:  public


Parameters:

   $userAgent  
   $searchPhrase  
   $data_format  
   $teraWurflInstance  

[ Top ]

method addError [line 216]

void addError( String $name, String $desc)

Add an error to the errors array that will be sent in the response



Tags:

access:  protected


Parameters:

String   $name   Capability name that is in error
String   $desc   Description of the error

[ Top ]

method exportValue [line 205]

String exportValue( Mixed $in)

Converts PHP variables to an XML friendly string



Tags:

return:  Value
access:  protected


Parameters:

Mixed   $in   Value

[ Top ]

method flattenCapabilities [line 255]

void flattenCapabilities( )

Flatten the multi-tiered capabilities array into a list of capabilities.



Tags:

access:  protected


[ Top ]

method generateJSON [line 293]

void generateJSON( )

Generate JSON response



Tags:

access:  protected


[ Top ]

method generateXML [line 271]

void generateXML( )

Generate the XML response



Tags:

access:  protected


[ Top ]

method generateXMLErrors [line 309]

String generateXMLErrors( )

Generate the errors section of the XML response



Tags:

return:  XML errors section
access:  protected


[ Top ]

method getResponse [line 120]

String getResponse( )

Get the response that would normally be sent to the client.



Tags:

return:  Response
access:  public


[ Top ]

method isClientAllowed [line 192]

Bool isClientAllowed( )

Is the connecting client allowed to use this webservice



Tags:

access:  protected


[ Top ]

method logAccess [line 325]

void logAccess( )

Log this access with the IP of the requestor and the user agent



Tags:

access:  protected


[ Top ]

method logError [line 344]

void logError( String $text, [String $requestedLogLevel = LOG_NOTICE], [ $func = "TeraWurflWebservice"])

Log an error in the TeraWurflWebservice log file



Tags:

access:  protected


Parameters:

String   $text   The error message text
String   $requestedLogLevel   The function or code that was being run when the error occured
   $func  

[ Top ]

method search [line 226]

void search( String $searchPhrase)

Search through all the capabilities and place the requested ones in search_results to be sent in the response.



Tags:

access:  protected


Parameters:

String   $searchPhrase   Search phrase (e.g. "is_wireless_device|streaming|tera_wurfl")

[ Top ]

method sendHTTPHeaders [line 135]

void sendHTTPHeaders( )

Send the HTTP Headers for the return data



Tags:

access:  public


[ Top ]

method sendResponse [line 152]

void sendResponse( )

Send the complete response to the client, including the HTTP Headers and the response.



Tags:

access:  public


[ Top ]

method __handleExceptions [line 361]

void __handleExceptions( $exception)



Tags:

access:  public


Parameters:

Exception   $exception  

[ Top ]


Documentation generated on Sun, 19 Sep 2010 00:16:04 +0000 by phpDocumentor 1.4.3