1 | <?php |
||
4 | class BasicConvert implements Converter |
||
5 | { |
||
6 | protected $content; |
||
7 | |||
8 | protected $options = [ |
||
9 | "preg_replace" => [ |
||
10 | [ |
||
11 | '/{{/', |
||
12 | '/}}/', |
||
13 | '/\[\[/', |
||
14 | '/\]\]/', |
||
15 | '/^\s*@(.*)$/m', |
||
16 | '/^\s*\[@\s*parent\s*([\w|\.]*)\s*@\]\s*$/m', |
||
17 | '/\s*\[@\s*content\s*(\w*)\s*@\](.*)\[@\s*endcontent\s*@\]/Usm' |
||
18 | ], |
||
19 | [ |
||
20 | '<?php echo(htmlspecialchars(', |
||
21 | |||
22 | ")); ?>", |
||
23 | |||
24 | '<?php ', |
||
25 | |||
26 | " ?>", |
||
27 | |||
28 | "<?php \\1 ?>", |
||
29 | |||
30 | "<?php \$this->setParent('\\1'); ?>", |
||
31 | |||
32 | " <?php if (array_key_exists('\\1', \$this->contentParent)) { |
||
33 | print(\$this->contentParent['\\1']); |
||
34 | } elseif (!\$this->parent) { ?> |
||
35 | \\2 |
||
36 | <?php } else { ?> |
||
37 | <?php ob_start(); ?> \\2 <?php \$this->contentParent['\\1'] = ob_get_contents(); ob_end_clean(); ?> |
||
38 | <?php } ?>" |
||
39 | ] |
||
40 | ], |
||
41 | ]; |
||
42 | |||
43 | public function setContent($content) |
||
47 | |||
48 | 15 | public function build($content = null, $options = array()) |
|
58 | } |
||
59 |