function filehash_rss_elements in File Hash 8
Same name and namespace in other branches
- 7 filehash.module \filehash_rss_elements()
Adds <media:hash> RSS elements to $node object.
1 call to filehash_rss_elements()
File
- ./
filehash.module, line 209 - Generate hashes for each uploaded file.
Code
function filehash_rss_elements($file, $node) {
$names = [
'md5' => 'md5',
'sha1' => 'sha-1',
];
foreach ($names as $algo => $name) {
if (!empty($file->filehash[$algo])) {
$node->rss_elements[] = [
'key' => 'media:hash',
'attributes' => [
'algo' => $name,
],
'value' => $file->filehash[$algo],
];
}
}
$node->rss_namespaces['xmlns:media'] = 'http://search.yahoo.com/mrss/';
}