function _domain_alias_placeholders_to_sql in Domain Access 6.2
Same name and namespace in other branches
- 7.3 domain_alias/domain_alias.module \_domain_alias_placeholders_to_sql()
- 7.2 domain_alias/domain_alias.module \_domain_alias_placeholders_to_sql()
Replace placeholders * and ? with SQL placeholders % and _
Parameters
$subdomain: String to work on.
Return value
String with replaced values.
3 calls to _domain_alias_placeholders_to_sql()
- domain_alias_form_submit in domain_alias/
domain_alias.admin.inc - Forms_API for domain_alias_form().
- _domain_alias_placeholders_from_sql in domain_alias/
domain_alias.module - Replace SQL placeholders % and _ by placeholders * and ?. Opposite of _domain_alias_placeholder_to_sql().
- _domain_alias_validate in domain_alias/
domain_alias.admin.inc - Helper function to validate alias entries.
File
- domain_alias/
domain_alias.module, line 239 - Interface for advanced domain matching for Domain Access.
Code
function _domain_alias_placeholders_to_sql($subdomain, $reverse = FALSE) {
$placeholders = array(
'*' => '%',
'?' => '_',
);
if ($reverse) {
return str_replace($placeholders, array_keys($placeholders), $subdomain);
}
else {
return str_replace(array_keys($placeholders), $placeholders, $subdomain);
}
}