/** * Fetch a message string from the database using the supplied code * * @param int $code * @param array $message_args (optional) * @return string */ public static function fetch_message($code, $message_args = array()) { $proto = new SystemMessage(); $sysmsg = $proto->getTable()->find($code); if (!$sysmsg || !$sysmsg->exists()) { throw new Exception("Cannot find {$code} in system_message"); } $msg = vsprintf($sysmsg->smsg_value, $message_args); return $msg; }