function _radioactivity_possibly_remap_id in Radioactivity 6
Same name and namespace in other branches
- 5 radioactivity.inc \_radioactivity_possibly_remap_id()
3 calls to _radioactivity_possibly_remap_id()
- radioactivity_delete_energy in ./
radioactivity.module - radioactivity_get_energy in ./
radioactivity.module - Reads energies for a node. Returns array of $dpid => $energy
- _radioactivity_add_energy_internal in ./
radioactivity.inc
File
- ./
radioactivity.inc, line 46
Code
function _radioactivity_possibly_remap_id($oid, $oclass) {
static $map = array();
if (!isset($map[$oclass][$oid])) {
$info = radioactivity_get_radioactivity_info();
$function = '';
if (isset($info['targets'][$oclass]['id_mapper'])) {
$function = $info['targets'][$oclass]['id_mapper'];
}
if ($function) {
// ok, remapper function defined for this object class. Use it to
// map the id into database id. This is used to map string ids, such as urls,
// into integers by some plugins (most notably arbitrary target)
$new_oid = $function($oid, $oclass);
}
else {
$new_oid = $oid;
}
$map[$oclass][$oid] = $new_oid;
}
return $map[$oclass][$oid];
}