You are here

public function MailhandlerCommandsDefault::process in Mailhandler 7.2

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

Parse and process commands.

Overrides MailhandlerCommands::process

File

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

Class

MailhandlerCommandsDefault
Provides default commands.

Code

public 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;
      }
    }
  }
}