original_string: protected function render_user_message(user_message $usermessage) {
          global $CFG;
  
          if (file_exists($CFG->dirroot . '/mod/chat/gui_ajax/theme/'.$usermessage->theme.'/config.php')) {
              include($CFG->dirroot . '/mod/chat/gui_ajax/theme/'.$usermessage->theme.'/config.php');
          }
  
          $patterns = array();
          $patterns[] = '___avatar___';
          $patterns[] = '___sender___';
          $patterns[] = '___senderprofile___';
          $patterns[] = '___time___';
          $patterns[] = '___message___';
          $patterns[] = '___mymessageclass___';
  
          $replacements = array();
          $replacements[] = $usermessage->avatar;
          $replacements[] = $usermessage->sendername;
          $replacements[] = $usermessage->senderprofile;
          $replacements[] = $usermessage->time;
          $replacements[] = $usermessage->message;
          $replacements[] = $usermessage->mymessageclass;
  
          $output = null;
  
          if (!empty($chattheme_cfg->avatar) and !empty($chattheme_cfg->align)) {
              if (!empty($usermessage->mymessageclass)) {
                  $output = str_replace($patterns, $replacements, $chattheme_cfg->user_message_right);
              } else {
                  $output = str_replace($patterns, $replacements, $chattheme_cfg->user_message_left);
              }
          } else {
              $output = str_replace($patterns, $replacements, $chattheme_cfg->user_message);
          }
  
          return $output;
      }
code: protected function render_user_message(user_message $usermessage) {
          global $CFG;
  
          if (file_exists($CFG->dirroot . '/mod/chat/gui_ajax/theme/'.$usermessage->theme.'/config.php')) {
              include($CFG->dirroot . '/mod/chat/gui_ajax/theme/'.$usermessage->theme.'/config.php');
          }
  
          $patterns = array();
          $patterns[] = '___avatar___';
          $patterns[] = '___sender___';
          $patterns[] = '___senderprofile___';
          $patterns[] = '___time___';
          $patterns[] = '___message___';
          $patterns[] = '___mymessageclass___';
  
          $replacements = array();
          $replacements[] = $usermessage->avatar;
          $replacements[] = $usermessage->sendername;
          $replacements[] = $usermessage->senderprofile;
          $replacements[] = $usermessage->time;
          $replacements[] = $usermessage->message;
          $replacements[] = $usermessage->mymessageclass;
  
          $output = null;
  
          if (!empty($chattheme_cfg->avatar) and !empty($chattheme_cfg->align)) {
              if (!empty($usermessage->mymessageclass)) {
                  $output = str_replace($patterns, $replacements, $chattheme_cfg->user_message_right);
              } else {
                  $output = str_replace($patterns, $replacements, $chattheme_cfg->user_message_left);
              }
          } else {
              $output = str_replace($patterns, $replacements, $chattheme_cfg->user_message);
          }
  
          return $output;
      }
code_tokens: protected function render_user_message ( user_message $ usermessage ) { global $ CFG ; if ( file_exists ( $ CFG -> dirroot . '/mod/chat/gui_ajax/theme/' . $ usermessage -> theme . '/config.php' ) ) { include ( $ CFG -> dirroot . '/mod/chat/gui_ajax/theme/' . $ usermessage -> theme . '/config.php' ) ; } $ patterns = array ( ) ; $ patterns [ ] = '___avatar___' ; $ patterns [ ] = '___sender___' ; $ patterns [ ] = '___senderprofile___' ; $ patterns [ ] = '___time___' ; $ patterns [ ] = '___message___' ; $ patterns [ ] = '___mymessageclass___' ; $ replacements = array ( ) ; $ replacements [ ] = $ usermessage -> avatar ; $ replacements [ ] = $ usermessage -> sendername ; $ replacements [ ] = $ usermessage -> senderprofile ; $ replacements [ ] = $ usermessage -> time ; $ replacements [ ] = $ usermessage -> message ; $ replacements [ ] = $ usermessage -> mymessageclass ; $ output = null ; if ( ! empty ( $ chattheme_cfg -> avatar ) and ! empty ( $ chattheme_cfg -> align ) ) { if ( ! empty ( $ usermessage -> mymessageclass ) ) { $ output = str_replace ( $ patterns , $ replacements , $ chattheme_cfg -> user_message_right ) ; } else { $ output = str_replace ( $ patterns , $ replacements , $ chattheme_cfg -> user_message_left ) ; } } else { $ output = str_replace ( $ patterns , $ replacements , $ chattheme_cfg -> user_message ) ; } return $ output ; }
docstring: Render a user message
  
  @param user_message $usermessage the user message to display
  @return string html representation of a user_message instance
docstring_tokens: Render a user message