You are here

function MailhandlerCommandsDefault::process in Mailhandler 6.2

Same name and namespace in other branches
  1. 7.2 plugins/mailhandler/commands/MailhandlerCommandsDefault.class.php \MailhandlerCommandsDefault::process()

Parse and process commands.

Overrides MailhandlerCommands::process

File

plugins/mailhandler/commands/MailhandlerCommandsDefault.class.php, line 45
MailhandlerCommandsDefault class.

Class

MailhandlerCommandsDefault
@file MailhandlerCommandsDefault class.

Code

function process(&$message, $source) {
  if (!empty($this->commands)) {
    foreach ($this->commands as $key => $value) {
      if (drupal_substr($value, 0, 1) == '[' && drupal_substr($value, -1, 1) == ']') {

        // Strip brackets.
        $value = rtrim(ltrim($value, '['), ']');
        $value = explode(',', $value);
      }
      $key = str_replace(' ', '_', $key);
      if (!empty($key) && empty($message[$key])) {
        $message[$key] = $value;
      }
    }
  }
}