private function HeartbeatActivity::rebuild_arguments in Heartbeat 6.3
Same name and namespace in other branches
- 6.4 includes/heartbeatactivity.inc \HeartbeatActivity::rebuild_arguments()
- 7 includes/heartbeatactivity.inc \HeartbeatActivity::rebuild_arguments()
Rebuild the arguments for variables to share within this object
Parameters
array $raw_input of arguments:
2 calls to HeartbeatActivity::rebuild_arguments()
- HeartbeatActivity::save_locale in includes/
heartbeatactivity.inc - Save activity log with multilingual content and multilingual parts to pre-translate
- HeartbeatActivity::_save in includes/
heartbeatactivity.inc - Save activity log
File
- includes/
heartbeatactivity.inc, line 209
Class
- HeartbeatActivity
- Class to handle user activity data
Code
private function rebuild_arguments($raw_input, $locale = false) {
$args = array();
if ($locale) {
// Variables that need to be pre-translated go here
$args['locale'] = array();
}
// Rebuild arguments with language tokens
foreach ($this->m_variables_array as $key => $value) {
// Leave $key[0] == "!" asis
if ($key[0] != "@" && $key[0] != "#") {
continue;
// bad argument
}
$oldkey = $key;
// Reset the key of the arguments to ! to parse the next
// tokenization asis.
if ($key[0] == "@") {
$key[0] = "!";
}
// # and @ token replacement prefixes are kept,
// but set a flag for it in the raw_arguments
if ($key[0] == "#") {
//dsm($key.' '.$value);
// if it has to be translated ...
if ($locale) {
$args['locale'][$key] = $value;
}
// Now reset the key
$key[0] = "!";
}
// if argument is prefilled, override
if (isset($raw_args[$oldkey])) {
$args[$key] = $raw_args[$oldkey];
continue;
}
// Argument gets the value as in variables
$args[$key] = $value;
}
return $args;
}