summaryrefslogtreecommitdiffstats
path: root/codebase/Dhtmlx/Connector/Output/OutputWriter.php
blob: 9f93cf3628658c9c8f0a82b9706b006db0374c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

namespace Dhtmlx\Connector\Output;

class OutputWriter{
    private $start;
    private $end;
    private $type;

    public function __construct($start, $end = ""){
        $this->start = $start;
        $this->end = $end;
        $this->type = "xml";
    }
    public function add($add){
        $this->start.=$add;
    }
    public function reset(){
        $this->start="";
        $this->end="";
    }
    public function set_type($add){
        $this->type=$add;
    }
    public function output($name="", $inline=true, $encoding=""){
        ob_clean();

        if ($this->type == "xml"){
            $header = "Content-type: text/xml";
            if ("" != $encoding)
                $header.="; charset=".$encoding;
            header($header);
        }

        echo $this->__toString();
    }
    public function __toString(){
        return $this->start.$this->end;
    }
}