/** * Allows us to save variables of template as they are */ public function cleanBean() { $this->storedVariables = array(); $this->body_html = preg_replace_callback('/\\{::[^}]+::\\}/', array($this, 'storeVariables'), $this->body_html); parent::cleanBean(); $this->body_html = str_replace(array_values($this->storedVariables), array_keys($this->storedVariables), $this->body_html); }