You are here

public static function HeartbeatMessageTemplate::getVariablesFromMessage in Heartbeat 7

getVariablesFromMessage().

2 calls to HeartbeatMessageTemplate::getVariablesFromMessage()
ctools_export_ui_heartbeat_template::edit_form_submit in modules/heartbeat_ui/plugins/export_ui/ctools_export_ui_heartbeat_template.class.php
Implements edit_form_submit().
HeartbeatMessageTemplate::setMessageVariables in includes/heartbeatmessagetemplate.inc
setMessageVariables().

File

includes/heartbeatmessagetemplate.inc, line 242
HeartbeatMessageTemplate Template object that holds configuration for a message template. A HeartbeatActivity object will be able to have the template as composite.

Class

HeartbeatMessageTemplate
Class HeartbeatMessageTemplate

Code

public static function getVariablesFromMessage($message, $message_concat) {
  $variables = array();
  preg_match_all("/\\!([a-zA-Z0-9_]+)/", $message . ' ' . $message_concat, $matches);
  if (!empty($matches)) {

    // matches[0] contains variables prefixed with ! sign
    // matches[1] contains the variable names
    foreach ($matches[0] as $match) {
      $variables[$match] = '';
    }
  }
  return $variables;
}