protected function QueryPathCssEventHandler::attrValMatches in QueryPath 7.3
Same name and namespace in other branches
- 6 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::attrValMatches()
- 7.2 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::attrValMatches()
2 calls to QueryPathCssEventHandler::attrValMatches()
- QueryPathCssEventHandler::attribute in QueryPath/
CssEventHandler.php - QueryPathCssEventHandler::attributeNS in QueryPath/
CssEventHandler.php
File
- QueryPath/
CssEventHandler.php, line 916
Class
Code
protected function attrValMatches($needle, $haystack, $operation) {
if (strlen($haystack) < strlen($needle)) {
return FALSE;
}
switch ($operation) {
case CssEventHandler::isExactly:
return $needle == $haystack;
case CssEventHandler::containsWithSpace:
return in_array($needle, explode(' ', $haystack));
case CssEventHandler::containsWithHyphen:
return in_array($needle, explode('-', $haystack));
case CssEventHandler::containsInString:
return strpos($haystack, $needle) !== FALSE;
case CssEventHandler::beginsWith:
return strpos($haystack, $needle) === 0;
case CssEventHandler::endsWith:
return preg_match('/' . $needle . '$/', $haystack) == 1;
}
return FALSE;
}