function rdfx_admin_namespaces_form_validate in RDF Extensions 7.2
File
- ./
rdfx.admin.inc, line 214
Code
function rdfx_admin_namespaces_form_validate($form, &$form_state) {
// Loads the XML Namespace regular expression patterns.
module_load_include('inc', 'rdfx');
$prefix = $form_state['values']['prefix'];
$ns_uri = $form_state['values']['ns_uri'];
// Ensures that the namespace is a valid URI.
if (!valid_url($ns_uri, $absolute = TRUE)) {
form_set_error('ns_uri', t('The namespace URI must be a valid URI.'));
}
// Ensures the namespace URI ends in either / or #.
if (!preg_match('/(\\/|\\#)$/', $ns_uri)) {
form_set_error('ns_uri', t('The namespace URI must end in either a / or a #.'));
}
// Ensures the prefix is well formed according to the specification.
if (!preg_match('/^' . PREFIX . '$/', $prefix)) {
form_set_error('prefix', t('The prefix must follow the !link.', array(
'!link' => '<a href="http://www.w3.org/TR/xml-names11/#NT-NCName">XML Namespace Specification</a>',
)));
}
}