protected function EasyRdf_Parser_Rdfa::guessTimeDatatype in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php \EasyRdf_Parser_Rdfa::guessTimeDatatype()
1 call to EasyRdf_Parser_Rdfa::guessTimeDatatype()
- EasyRdf_Parser_Rdfa::processNode in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Rdfa.php
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Rdfa.php, line 163
Class
- EasyRdf_Parser_Rdfa
- Class to parse RDFa 1.1 with no external dependancies.
Code
protected function guessTimeDatatype($value) {
if (preg_match('/^-?\\d{4}-\\d{2}-\\d{2}(Z|[\\-\\+]\\d{2}:\\d{2})?$/', $value)) {
return 'http://www.w3.org/2001/XMLSchema#date';
}
elseif (preg_match('/^\\d{2}:\\d{2}:\\d{2}(Z|[\\-\\+]\\d{2}:\\d{2})?$/', $value)) {
return 'http://www.w3.org/2001/XMLSchema#time';
}
elseif (preg_match('/^-?\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(Z|[\\-\\+]\\d{2}:\\d{2})?$/', $value)) {
return 'http://www.w3.org/2001/XMLSchema#dateTime';
}
elseif (preg_match('/^P(\\d+Y)?(\\d+M)?(\\d+D)?T?(\\d+H)?(\\d+M)?(\\d+S)?$/', $value)) {
return 'http://www.w3.org/2001/XMLSchema#duration';
}
elseif (preg_match('/^\\d{4}$/', $value)) {
return 'http://www.w3.org/2001/XMLSchema#gYear';
}
elseif (preg_match('/^\\d{4}-\\d{2}$/', $value)) {
return 'http://www.w3.org/2001/XMLSchema#gYearMonth';
}
else {
return null;
}
}