added two more match-type values from CardDAV:text-match

This commit is contained in:
Ralf Becker 2011-09-24 21:15:44 +00:00
parent 0a7b7e40c8
commit b4b04844fe

View File

@ -310,6 +310,8 @@ class groupdav_principals extends groupdav_handler
/**
* Match using $match_type
*
* It's not defined in WebDAV ACL, but CardDAV:text-match seems similar
*
* @param string $value value to test
* @param string $match criteria/sub-string
* @param string $match_type='contains' or 'starts-with'
@ -318,9 +320,15 @@ class groupdav_principals extends groupdav_handler
{
switch($match_type)
{
case 'equals':
return $value === $match;
case 'starts-with':
return stripos($value, $match) === 0;
case 'ends-with':
return stripos($value, $match) === strlen($value) - strlen($match);
case 'contains':
default:
return stripos($value, $match) !== false;