Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
TemplateParser.php
Go to the documentation of this file.
1<?php
2
4
14class TemplateParser {
15 private $fileContent;
16
17 public function __construct($fileName) {
18 $this->fileContent = $this->parse ( \file_get_contents ( $fileName ) );
19 }
20
21 private function parse($html) {
22 $startPoint = '{{';
23 $endPoint = '}}';
24 $result = \preg_replace ( '/(' . \preg_quote ( $startPoint ) . ')(.*?)(' . \preg_quote ( $endPoint ) . ')/sim', '<?php echo $2 ?>', $html );
25 return $result;
26 }
27
28 public function __toString() {
29 return $this->fileContent;
30 }
31}