assoc_array("select * from email_template where et_id = " . $_id); $et_data_array = $et_data_assoc_array[0]; foreach ($et_data_array as $field => $value) { $function_name = "set_" . $field; $this->$function_name($value); } } /** * @return mixed */ public function get_et_id() { return $this->et_id; } /** * @param mixed $et_id * * @return self */ public function set_et_id($et_id) { $this->et_id = $et_id; return $this; } /** * @return mixed */ public function get_et_name() { return $this->et_name; } /** * @param mixed $et_name * * @return self */ public function set_et_name($et_name) { $this->et_name = $et_name; return $this; } /** * @return mixed */ public function get_et_title() { return $this->et_title; } /** * @param mixed $et_title * * @return self */ public function set_et_title($et_title) { $this->et_title = $et_title; return $this; } /** * @return mixed */ public function get_et_deleted() { return $this->et_deleted; } /** * @param mixed $et_deleted * * @return self */ public function set_et_deleted($et_deleted) { $this->et_deleted = $et_deleted; return $this; } /** * @return mixed */ public function get_et_message() { return $this->et_message; } /** * @param mixed $et_message * * @return self */ public function set_et_message($et_message) { $this->et_message = $et_message; return $this; } /** * @return mixed */ public function get_et_subject() { return $this->et_subject; } /** * @param mixed $et_subject * * @return self */ public function set_et_subject($et_subject) { $this->et_subject = $et_subject; return $this; } /** * @return mixed */ public function get_et_from_name() { return $this->et_from_name; } /** * @param mixed $et_from_name * * @return self */ public function set_et_from_name($et_from_name) { $this->et_from_name = $et_from_name; return $this; } /** * @return mixed */ public function get_et_from_email() { return $this->et_from_email; } /** * @param mixed $et_from_email * * @return self */ public function set_et_from_email($et_from_email) { $this->et_from_email = $et_from_email; return $this; } public function personalize($_raw, $_variable_array) { $matches = null; preg_match_all('/{\$([a-z0-9\_]+)}/', $_raw, $matches); //print_r($matches); //[0] {$variable} //[1] variable foreach ($matches[0] as $key => $match) { $_raw = str_replace($match, $_variable_array[$matches[1][$key]], $_raw); } return $_raw; } } ?>