function notifications_array_serialize in Notifications 6.4
Same name and namespace in other branches
- 7 notifications.module \notifications_array_serialize()
Serialize an array ordering the keys before.
This is useful for cache indexes and signatures.
3 calls to notifications_array_serialize()
- Notifications_Subscription::get_instance in includes/
notifications_subscription.class.inc - Get instance of this one for certain conditions
- Notifications_Subscription::serialize_fields in includes/
notifications_subscription.class.inc - Order and serialize fields so we can get a unique signature for this subscription fields
- _notifications_signature in ./
notifications.module - Signature for url parameters
File
- ./
notifications.module, line 1184 - Notifications module
Code
function notifications_array_serialize($array) {
if (!$array) {
return '';
}
// First we sort and serialize multiple conditions
foreach ($array as $key => $value) {
if (is_array($value)) {
asort($value);
$array[$key] = implode(':', $value);
}
}
// Now we sort the whole condtions array maintaining index association
ksort($array);
return implode(',', array_keys($array)) . '/' . implode(',', $array);
}