You are here

function heartbeat_decode_message_variables in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.2 heartbeat.module \heartbeat_decode_message_variables()
  2. 6.3 heartbeat.common.inc \heartbeat_decode_message_variables()
  3. 7 heartbeat.module \heartbeat_decode_message_variables()

Decode heartbeat message variables

8 calls to heartbeat_decode_message_variables()
HeartbeatActivity::set_variables in includes/heartbeatactivity.inc
Sets the variables array Data variables are stored in an array to use them to build real variables. this means that when activity message objects get merged, the variables will be filled with variables components from all instances.
HeartbeatMessageTemplate::set_arguments in includes/heartbeatmessagetemplate.inc
Sets the concatenation arguments
HeartbeatMessageTemplate::set_variables in includes/heartbeatmessagetemplate.inc
Sets the variables array Data variables are stored in an array to use them to build real variables. this means that when activity message objects get merged, the variables will be filled with variables components from all instances.
heartbeat_features_export_render in ./heartbeat.features.inc
Implementation of hook_features_export_render().
heartbeat_messages_export_messages in ./heartbeat.admin.inc
Function to export messages to use as default

... See full list

File

./heartbeat.common.inc, line 40
Commonly functions used in heartbeat

Code

function heartbeat_decode_message_variables($string, $object = FALSE) {
  if (!is_string($string)) {
    return array();
  }

  // Variable string need to be cleared from spaces to decode properly
  $array = explode("-|-", $string);
  $variables = array();
  if (!empty($array)) {
    foreach ($array as $varvalue) {
      $parts = explode("=|=", $varvalue);
      if (isset($parts[0]) && !empty($parts[0])) {
        if (eregi("\\*\\*\\*", $parts[1])) {
          $parts[1] = explode("***", $parts[1]);
        }
        $variables[$parts[0]] = !is_array($parts[1]) ? (string) $parts[1] : $parts[1];
      }
    }
  }
  return $object ? (object) $variables : (array) $variables;
}