function _domain_alias_placeholders_to_sql in Domain Access 7.3
Same name and namespace in other branches
- 6.2 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.
4 calls to _domain_alias_placeholders_to_sql()
- domain_alias_features_rebuild in domain_alias/
domain_alias.features.inc - Implements hook_features_rebuild().
- 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 252 - 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);
}
}