PHP » Quellcode betrachten

Download

<?php
/* xml_extension class
 * (C) 2006 Julian von Mendel (http://derjulian.net)
 * License: LGPL
 */

class xml_option implements xml_widget
{
    public 
$node;
    public 
$xml ;

    function 
__construct($node$xml)
    {
        
$this->node $node;
        
$this->xml  $xml ;
    }

    public static function 
dtd()
    {
        return <<<DTD
DTD;
    }

    public  function 
output($returntype "xhtml")
    {
        if (!
method_exists($this$returntype))
        {
            return 
False;
        }

        
$parse      $this->xml->attributes($this->node, array("type""name""html""urlencode"));
        
$attributes $parse["attributes_array"];
        
$data $this->xml->getDataItem("option");
        if (!isset(
$data[$attributes["type"]][$attributes["name"]]))
        {
            return 
False;
        }
        
$data $data[$attributes["type"]][$attributes["name"]];

        return 
call_user_func(array($this$returntype), $data$attributes["html"], $attributes["urlencode"]);
    }

    private function 
xhtml($data$html$urlencode)
    {
        if (
$urlencode == "urlencode")
        {
            
$data urlencode($data);
        }
        if (
$html != "html")
        {
            
$data xml::mask_xml($data);
        }
        return 
$data;
    }
}
?>

© 2009 Julian von Mendel (http://derjulian.net) | Datum: 26.04.2024