function hosting_alias_insert in Hosting 5
Same name and namespace in other branches
- 6.2 alias/hosting_alias.module \hosting_alias_insert()
- 7.4 alias/hosting_alias.module \hosting_alias_insert()
- 7.3 alias/hosting_alias.module \hosting_alias_insert()
2 calls to hosting_alias_insert()
- hosting_alias_nodeapi in alias/
hosting_alias.module - Implementation of hook_nodeapi
- hosting_alias_update in alias/
hosting_alias.module
File
- alias/
hosting_alias.module, line 79
Code
function hosting_alias_insert($node) {
$automatic = hosting_alias_automatic_aliases($node->title);
if ($node->aliases || sizeof($automatic)) {
$aliases = is_array($node->aliases) ? $node->aliases : explode("\n", str_replace(",", "\n", $node->aliases));
if (is_array($aliases)) {
foreach ($aliases as $alias) {
if (($alias = trim($alias)) && !in_array($alias, $automatic)) {
db_query("INSERT INTO {hosting_site_alias} (vid, nid, alias, automatic) VALUES (%d, %d, '%s', %d)", $node->vid, $node->nid, $alias, HOSTING_ALIAS_CUSTOM);
}
}
}
if (sizeof($automatic)) {
foreach ($automatic as $alias) {
db_query("INSERT INTO {hosting_site_alias} (vid, nid, alias, automatic) VALUES (%d, %d, '%s', %d)", $node->vid, $node->nid, $alias, HOSTING_ALIAS_AUTOMATIC);
}
}
}
}