PHP Classes

File: XsltPlugin.php

Recommend this page to a friend!
  Classes of Scott Christensen  >  Phramework  >  XsltPlugin.php  >  Download  
File: XsltPlugin.php
Role: Auxiliary script
Content type: text/plain
Description: Reusable view plugin class for XSLT in Phramework
Class: Phramework
MVC framework for building web applications
Author: By
Last change:
Date: 16 years ago
Size: 2,127 bytes


Class file image Download
 * Phramework Copyright (C) 2005
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option) any
 * later version.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License along
 * with this library; if not, write to theFree Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

 * This class requires no parameters but does require that the data sent into
 * this class has the following key/value pairs
 * <ul>
 * <li>xml: (required) The XML data in string format.</li>
 * <li>params: (optional) An array of key/value pairs that coorespond to
 * parameters that should be passed into the XSL stylesheet.</li>
 * </ul>
 * This class also requires that CURL and an XSLT processor is compiled into PHP.
class XsltPlugin extends ViewPlugin {
XsltPlugin() {
// Nothing to set up here
init($params) {
// No parameters required

destroy() {
// Nothing to destroy

processView($viewValue, $data) {
$xml = $data['xml'];
$params = null;
        if (isset(
$data['params'])) {
$params = $data['params'];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $viewValue);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$xsl = curl_exec($ch);
$xslt=new Xslt();
        if (isset(
$params) && is_array($params)) {
$xslt->transform()) {
        } else {

For more information send a message to info at phpclasses dot org.