Class: ServOO_Client
Source Location: /lodel/scripts/servooclient.php
Class ServOO_Client
Class Overview
|
Client class for communicating with ServOO server.
This class is a wrapper around the class ServOO_SOAP_Server on the server-side. convert* methods convert the input files into the specified format and perform high level processing on the return file like unpacking ZIP archive or processing the XHTML file. Consider first using convertToAssoc since it is the highest-level method provided by this library. If finer control is required, lower-level methods are available. Listed by decreasing order of processing: convertToXHTML, convertUnpack, convertToFile, convertToString.
Located in /lodel/scripts/servooclient.php [line 51]
Author(s):
- Ghislain Picard, Gautier Poupeau, Luc Santeramo
Information Tags:
| Copyright: | Copyright (c) 2004, Ghislain Picard, Gautier Poupeau, Luc Santeramo |
| Copyright: | Copyright (c) 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy |
|
Properties
|
Methods
|
Descendants
| ServOO |
Client class for communicating with ServOO server.
|
Property Summary
| mixed |
$error |
true if an error occured. |
Method Summary
| array |
convertToAssoc() |
Convert the file $infilename from $informat into $outformat, extract the stylized blocks of the xhtml file into an association array. This is the highest level function unless finer controls are required. |
| bool |
convertToFile() |
Convert the file $infilename from $informat into $outformat and save the resulting file on the disk as $outfilename |
| bool |
convertToString() |
convert the file $infilename from $informat into $outformat. |
| array |
convertToXHTML() |
Convert the file $infilename from $informat into $outformat and extract the xhtml file and the images from the ZIP archive returned by the ServOO. |
| array |
convertUnpack() |
Convert the file $infilename from $informat into $outformat and extract the files from the ZIP archive returned by the ServOO. You must ensure that ServOO return ZIP archive for the selected $outformat (raise an error if not a ZIP archive). |
| array |
images() |
get the images contained in the XHTML file. |
| void |
setauth() |
Set the basic authentification parameters |
| void |
setproxy() |
Set the proxy parameters |
| string |
validateXML() |
Validate an XML file for a XML Schema |
| string |
version() |
Get the version of the ServOO. |
Properties
true if an error occured.
message of the last error.
array containing the http_request params.
API Tags:
Methods
ServOO_Client ServOO_Client(
string
$url
)
|
|
ServOO_Client constructor.
Parameters:
|
string |
$url: |
Location of the ServOO server. |
void call(
$operation, [
$params = array()]
)
|
|
Parameters:
API Tags:
array convertToAssoc(
string
$infilename, string
$informat, string
$outformat, string
$tmpdir, [string
$imagesdir = ""], [array
$options = array()], [array
$zipoptions = array()], [function
$callbackimages = ""], [mixed
$user_vars = ""]
)
|
|
Convert the file $infilename from $informat into $outformat, extract the stylized blocks of the xhtml file into an association array. This is the highest level function unless finer controls are required.
The images file are extracted from the archive and the <img src=""> are updated accordinatly.
Parameters:
|
string |
$infilename: |
input filename |
|
string |
$informat: |
MIME format or filename extension of the input file |
|
string |
$outformat: |
MIME format, filename extension, or especial type of the output file |
|
string |
$tmpdir: |
temporary directory for extracting the archive. |
|
string |
$imagesdir: |
directory where to transfer the image if no callback function is given. |
|
array |
$options: |
options to send to ServOO. Available options depend on outformat. |
|
array |
$zipoptions: |
See ServOO_Client::convertUnpack() for details. |
|
function |
$callbackimages: |
callback function taking threes arguments ( the original filename, the index in the zip archive and the user defined variable $user_vars) and must return the new full filename where the image shall be extracted or an empty string if the images should not be extracted. If no callback is provided the images filename a automatically assigned and stored in the $tmpdir directory. |
|
mixed |
$user_vars: |
variable transmitted to the callback. |
API Tags:
| Return: | associative array containing the style and the block. False on error message if any error |
| Access: | public |
bool convertToFile(
string
$infilename, string
$informat, string
$outformat, string
$outfilename, [array
$options = array()]
)
|
|
Convert the file $infilename from $informat into $outformat and save the resulting file on the disk as $outfilename
Parameters:
|
string |
$infilename: |
input filename |
|
string |
$outfilename: |
output filename |
|
string |
$informat: |
MIME format or filename extension of the input file |
|
string |
$outformat: |
MIME format, filename extension, or especial type of the output file |
|
array |
$options: |
options to send to ServOO. Available options depend on outformat. |
API Tags:
bool convertToString(
string
$infilename, string
$informat, string
$outformat,
&$outstring, [array
$options = array()]
)
|
|
convert the file $infilename from $informat into $outformat.
Parameters:
|
string |
$infilename: |
input filename |
|
string |
$informat: |
MIME format or filename extension of the input file |
|
string |
$outformat: |
MIME format, filename extension, or especial type of the output file |
|
array |
$options: |
options to send to ServOO. Available options depend on outformat. |
|
|
&$outstring: |
|
API Tags:
array convertToXHTML(
string
$infilename, string
$informat, string
$outformat, string
$tmpdir, [string
$imagesdir = ""], [array
$options = array()], [array
$zipoptions = array()], [function
$callbackimages = ""], [mixed
$user_vars = ""]
)
|
|
Convert the file $infilename from $informat into $outformat and extract the xhtml file and the images from the ZIP archive returned by the ServOO.
You must ensure that ServOO return ZIP archive containing a xhtml file and images for the selected $outformat.The images are transfered as defined by a callback function and the XHTML is updated to account for this change (change the href location).
Parameters:
|
string |
$infilename: |
input filename |
|
string |
$informat: |
MIME format or filename extension of the input file |
|
string |
$outformat: |
MIME format, filename extension, or especial type of the output file |
|
string |
$tmpdir: |
temporary directory for extracting the archive. |
|
string |
$imagesdir: |
directory where to transfer the image if no callback function is given. |
|
array |
$options: |
options to send to ServOO. Available options depend on outformat. |
|
array |
$zipoptions: |
See ServOO_Client::convertUnpack() for details. |
|
function |
$callbackimages: |
callback function taking threes arguments ( the original filename, the index in the zip archive and the user defined variable $user_vars) and must return the new full filename where the image shall be extracted or an empty string if the images should not be extracted. If no callback is provided the images filename a automatically assigned and stored in the $tmpdir directory. |
|
mixed |
$user_vars: |
variable transmitted to the callback. |
API Tags:
| Return: | list of file fullname. False on error message if any error |
| Access: | public |
array convertUnpack(
string
$infilename, string
$informat, string
$outformat, string
$outdir, [array
$options = array()], [array
$zipoptions = array()], string
$outfilename
)
|
|
Convert the file $infilename from $informat into $outformat and extract the files from the ZIP archive returned by the ServOO. You must ensure that ServOO return ZIP archive for the selected $outformat (raise an error if not a ZIP archive).
Parameters:
|
string |
$infilename: |
input filename |
|
string |
$outfilename: |
output filename |
|
string |
$informat: |
MIME format or filename extension of the input file |
|
string |
$outformat: |
MIME format, filename extension, or especial type of the output file |
|
string |
$outdir: |
directory where files in the archive are extracted. |
|
array |
$options: |
options to send to ServOO. Available options depend on outformat. |
|
array |
$zipoptions: |
options to pass to PclZip lib. Two additional options are provided: denyextensions and allowextensions to select the files to extract. These options must be perl regexp. If allowextensions is not set the default value is xhtml|jpg|png|gif for security reason. Set allowextensions to "" or any other value if you don't want the default. The regexp search is done case-insensitive (/i modifier) |
API Tags:
| Return: | list of file fullname. False on error message if any error |
get the images contained in the XHTML file.
API Tags:
| Return: | array with images filename |
void setauth(
string
$user, string
$pass
)
|
|
Set the basic authentification parameters
Parameters:
|
string |
$user: |
username |
|
string |
$pass: |
password |
void setproxy(
string
$user, string
$pass
)
|
|
Set the proxy parameters
Parameters:
|
string |
$user: |
username |
|
string |
$pass: |
password |
string validateXML(
string
$xml, string
$xmlschema, [strign
$validator = "MSV"]
)
|
|
Validate an XML file for a XML Schema
Parameters:
|
string |
$xml: |
XML filename |
|
string |
$xmlschema: |
XML/Schema filename |
|
strign |
$validator: |
available validators are in ServOO_SOAP_Server class |
API Tags:
| Return: | return nothing if the document is valid. Otherwise, the string return by the validator or if any Error the message returned by the SOAP server |
Get the version of the ServOO.
API Tags:
|
|