Sitellite Application Framework
Class Tree         Index         All Elements

Class: IOFilter

Source Location: Program_Root/CGI/IOFilter.php

Class Overview


IOFilter provides the skeleton for creating filters on incoming or outgoing data, including the automatic sending of relevant HTTP headers. Its purpose is to be extended through subclassing to create custom filters (ie. an XSLT filter).


Author(s)

Version

  • 1.0, 2002-08-10, $Id: IOFilter.php,v 1.2 2005/07/06 15:30:56 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 80]
IOFilter provides the skeleton for creating filters on incoming or outgoing data, including the automatic sending of relevant HTTP headers. Its purpose is to be extended through subclassing to create custom filters (ie. an XSLT filter).


1 <?php
2
3 class XsltFilter extends IOFilter {
4 var $xsltDoc = '';
5
6 function transform ($content) {
7 if (empty ($this->xsltDoc)) {
8 $this->error = 'No $xsltDoc property specified!';
9 return false;
10 }
11
12 global $loader
13 $loader->import ('saf.XML.XSLT');
14 $xslt = new XSLT ();
15
16 if ($res = $xslt->process ($this->xsltDoc, $content)) {
17 $xslt->free ();
18 return $res;
19 } else {
20 $this->error = $xslt->error ();
21 $xslt->free ();
22 return false;
23 }
24 }
25 }
26
27 $xslf = new XsltFilter ('xslt', 'text/html');
28
29 $xslf->xsltDoc = 'inc/xslt/xml2html.xslt';
30
31 if ($new_data = $xslf->transform ($original_data)) {
32 $xslf->sendHeaders ();
33 echo $new_data;
34 } else {
35 echo $xslf->error;
36 }
37
38 ?>




Tags:

access:  public
version:  1.0, 2002-08-10, $Id: IOFilter.php,v 1.2 2005/07/06 15:30:56 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$contentType =

[line 96]

The content type of the data, which if provided will be sent as an HTTP Content-Type header by sendHeaders().



Tags:

access:  public

Type:   mixed


[ Top ]

$error =

[line 113]

Contains an error message that may have been created during the execution of a transform() call.



Tags:

access:  public

Type:   mixed


[ Top ]

$extraHeaders =

[line 104]

A list of extra HTTP headers to send by sendHeaders().



Tags:

access:  public

Type:   mixed


[ Top ]

$name =

[line 87]

A name for this filter.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor IOFilter [line 123]

IOFilter IOFilter( string $name, [string $contentType = false])

Constructor method.



Tags:

access:  public


Parameters:

string   $name  
string   $contentType  

[ Top ]

method addHeader [line 137]

void addHeader( string $header)

Adds a header to $extraHeaders.



Tags:

access:  public


Parameters:

string   $header  

[ Top ]

method sendHeaders [line 162]

void sendHeaders( )

Sends any HTTP headers specified, including the Content-Type header if $contentType is specified.



Tags:

access:  public


[ Top ]

method transform [line 150]

string transform( string $content)

Transforms the content provided into a new format. This method is left blank for subclasses to fill in.



Tags:

access:  public


Parameters:

string   $content  

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:50 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2