function nodewords_extra_dc_date_prepare in Nodewords: D6 Meta Tags 6.2
Same name and namespace in other branches
- 6 nodewords_extra/nodewords_extra.module \nodewords_extra_dc_date_prepare()
Set the meta tag content.
File
- nodewords_extra/
includes/ nodewords_extra.nodewords.tags.inc, line 101 - Nodewords support file.
Code
function nodewords_extra_dc_date_prepare(&$tags, $content, $options) {
if (!empty($content['value'])) {
if (is_array($content['value'])) {
// Support the older date form element value.
$content['value'] = $content['value']['day'] . ' ' . $content['value']['month'] . ' ' . $content['value']['year'];
}
else {
$content['value'] = nodewords_replace_tokens($content['value'], $options);
}
$parts = preg_split('/\\s+/', $content['value'], -1, PREG_SPLIT_NO_EMPTY);
if (count($parts) == 3) {
list($day, $month, $year) = $parts;
if ($timestamp = @gmmktime(0, 0, 0, $month, $day, $year)) {
$tags['dc.date'] = gmdate('Y-m-d\\TH:i:s\\Z', $timestamp);
}
}
}
}