Example #1
0
 protected function setProperties()
 {
     $this->_fullRoute = Router::getFullRoute();
     $this->_route = Router::getRoute();
     $this->_domain = Router::getDomain();
     preg_match_all('/\\{\\{((\\w*|\\d))\\}\\}/', $this->content, $matches);
     if (!empty($matches)) {
         foreach ($matches[0] as $match) {
             $matchName = trim(str_replace(array("{{", "}}"), array("", ""), $match));
             if (method_exists($this, $matchName)) {
                 $this->content = str_replace($match, $this->{$matchName}(), $this->content);
             } else {
                 if (property_exists($this, $matchName)) {
                     $this->content = str_replace($match, $this->{$matchName}, $this->content);
                 } else {
                     if (array_key_exists($matchName, $this->data)) {
                         $this->content = str_replace($match, $this->data[$matchName], $this->content);
                     }
                 }
             }
         }
     }
 }