function heartbeat_decode_message_variables in Heartbeat 6.2
Same name and namespace in other branches
- 6.4 heartbeat.common.inc \heartbeat_decode_message_variables()
- 6.3 heartbeat.common.inc \heartbeat_decode_message_variables()
- 7 heartbeat.module \heartbeat_decode_message_variables()
Decode heartbeat message variables
3 calls to heartbeat_decode_message_variables()
- friendlist_activity_rules_action in user_activity/
modules/ friendlist_activity/ friendlist_activity.rules.inc - Action Implementation: Log an activity
- heartbeat_messages_edit in ./
heartbeat.admin.inc - Function to maintain and administer heartbeat messages
- user_activity::variables2array in ./
heartbeat.module - public function to set variables into readable array
File
- ./
heartbeat.module, line 461 - To fully understand this, you have to be familiar with the rules module. Lots of documentation can be found on http://drupal.org/node/298480 for an introduction and tutorial, but http://drupal.org/node/298486 is a lot of handy info for developers.
Code
function heartbeat_decode_message_variables($string, $object = false) {
// 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])) {
$variables[$parts[0]] = (string) $parts[1];
}
}
}
//$variables = unserialize($string);
return $object ? (object) $variables : (array) $variables;
}