function nodewords_update_6102 in Nodewords: D6 Meta Tags 6
Same name and namespace in other branches
- 6.2 nodewords.install \nodewords_update_6102()
Implements hook_update_N().
File
- ./
nodewords.install, line 302 - Installation file for nodewords.module.
Code
function nodewords_update_6102() {
$metatags = array();
$ret = array();
$settings = variable_get('nodewords_global', array());
drupal_load('module', 'nodewords');
if (empty($settings['geourl'])) {
$coordinates = array(
0,
0,
);
}
else {
$coordinates = array_map('trim', explode(',', $settings['geourl']));
$coordinates[] = 0;
$coordinates[] = 0;
$coordinates = array_splice($coordinates, 0, 2);
}
$metatags['copyright'] = empty($settings['copyright']) ? '' : $settings['copyright'];
$metatags['geourl'] = $coordinates[0] . ',' . $coordinates[1];
$metatags['keywords'] = empty($settings['keywords']) ? '' : nodewords_unique_values($settings['keywords']);
$metatags['robots'] = empty($settings['robots']) ? '' : $settings['robots'];
foreach ($metatags as $name => $content) {
$result = db_result(db_query("SELECT 1 FROM {nodewords} WHERE type = 'default' AND id = '' AND name = '%s'", $name));
if ($result) {
$ret[] = update_sql("UPDATE {nodewords} SET content = '" . db_escape_string($content) . "' WHERE type = 'default' AND id = '' AND name = '" . db_escape_string($name) . "'");
}
else {
$ret[] = update_sql("INSERT INTO {nodewords} (type, id, name, content) VALUES ('default', '', '" . db_escape_string($name) . "', '" . db_escape_string($content) . "')");
}
}
$ret[] = array(
'success' => TRUE,
'query' => check_plain('The default meta tags values have been updated; verify they have the correct values at ' . url('admin/content/nodewords/meta-tags/default', array(
'absolute' => TRUE,
))),
);
return $ret;
}