kritbit

kritbit Git Source Tree


Root/web/system/vendor/h2o/nodes.php

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/*
        Nodes
*/
 
class H2o_Node {
    var $position;
    function __construct($argstring) {}
     
    function render($context, $stream) {}
}
 
class NodeList extends H2o_Node implements IteratorAggregate  {
    var $parser;
    var $list;
     
    function __construct(&$parser, $initial = null, $position = 0) {
        $this->parser = $parser;
        if (is_null($initial))
            $initial = array();
        $this->list = $initial;
        $this->position = $position;
    }
 
    function render($context, $stream) {
        foreach($this->list as $node) {
            $node->render($context, $stream);
        }
    }
     
    function append($node) {
        array_push($this->list, $node);
    }
 
    function extend($nodes) {
        array_merge($this->list, $nodes);
    }
 
    function getLength() {
        return count($this->list);
    }
     
    function getIterator() {
        return new ArrayIterator( $this->list );
    }
}
 
class VariableNode extends H2o_Node {
    private $filters = array();
    var $variable;
     
    function __construct($variable, $filters, $position = 0) {
        if (!empty($filters))
            $this->filters = $filters;
        $this->variable = $variable;
    }
 
    function render($context, $stream) {
        $value = $context->resolve($this->variable);
        $value = $context->escape($value, $this->variable);
        $stream->write($value);
    }
}
 
class CommentNode extends H2o_Node {}
 
class TextNode extends H2o_Node {
    var $content;
    function __construct($content, $position = 0) {
        $this->content = $content;
        $this->position = $position;
    }
     
    function render($context, $stream) {
        $stream->write($this->content);
    }
     
    function is_blank() {
        return strlen(trim($this->content));
    }
}
 
 
?>

Archive Download this file

Branches

Number of commits:
Page rendered in 0.23340s using 11 queries.