public function getGuidBasedWhereSql($column, $guids)
{
// short circuit if nothing requested
// 0 is a valid guid
if (!$guids && $guids !== 0) {
return '';
}
// normalize and sanitise owners
if (!is_array($guids)) {
$guids = array($guids);
}
$guids_sanitized = array();
foreach ($guids as $guid) {
if ($guid !== ELGG_ENTITIES_NO_VALUE) {
$guid = sanitise_int($guid);
if (!$guid) {
return false;
}
}
$guids_sanitized[] = $guid;
}
$where = '';
$guid_str = implode(',', $guids_sanitized);
// implode(',', 0) returns 0.
if ($guid_str !== false && $guid_str !== '') {
$where = "({$column} IN ({$guid_str}))";
}
return $where;
}